|
@@ -4,6 +4,8 @@ import com.auth0.jwt.JWT;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.galaxis.manatee.constant.SecurityConstant;
|
|
|
import com.galaxis.manatee.entity.User;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.authentication.AuthenticationManager;
|
|
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
|
import org.springframework.security.core.Authentication;
|
|
@@ -61,4 +63,11 @@ public class JwtAuthenticationFilter extends UsernamePasswordAuthenticationFilte
|
|
|
.sign(HMAC512(SecurityConstant.SECRET.getBytes()));
|
|
|
res.addHeader(SecurityConstant.HEADER_STRING, SecurityConstant.TOKEN_PREFIX + token);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) throws IOException {
|
|
|
+ response.setStatus(500);
|
|
|
+ response.getWriter().println("Login exception! Please check the username and password");
|
|
|
+ }
|
|
|
+
|
|
|
}
|