Skip to content
Snippets Groups Projects
Commit e48898cc authored by Julian Horner's avatar Julian Horner
Browse files

Minor improvements

parent dce11f40
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="dummy-service-1.0.0"> <wb-module deploy-name="authentication-service-1.0.0">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="java-output-path" value="/api-gateway/target/classes"/> <property name="java-output-path" value="/api-gateway/target/classes"/>
<property name="context-root" value="dummy-service"/> <property name="context-root" value="authentication-service"/>
</wb-module> </wb-module>
</project-modules> </project-modules>
...@@ -73,12 +73,13 @@ public class JwtUsernameAndPasswordAuthenticationFilter ...@@ -73,12 +73,13 @@ public class JwtUsernameAndPasswordAuthenticationFilter
HttpServletResponse response) throws AuthenticationException { HttpServletResponse response) throws AuthenticationException {
try { try {
// 1. Get credentials from request // 1. Get credentials from request
UserCredentials creds = UserCredentials credentials =
new ObjectMapper().readValue(request.getInputStream(), UserCredentials.class); new ObjectMapper().readValue(request.getInputStream(), UserCredentials.class);
// 2. Create auth object (contains credentials) which will be used by auth manager // 2. Create auth object (contains credentials) which will be used by auth manager
UsernamePasswordAuthenticationToken authToken = UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(
new UsernamePasswordAuthenticationToken( credentials.getUsername(), credentials.getPassword(), Collections.emptyList());
creds.getUsername(), creds.getPassword(), Collections.emptyList());
// 3. Authentication manager authenticate the user, and use // 3. Authentication manager authenticate the user, and use
// UserDetailsServiceImpl::loadUserByUsername() method to load the user. // UserDetailsServiceImpl::loadUserByUsername() method to load the user.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment