Skip to content

Commit

Permalink
Don't supply AuthenticationManager bean in attempt to solve errors wh…
Browse files Browse the repository at this point in the history
…en oauth token is invalid
  • Loading branch information
clezag committed Dec 5, 2023
1 parent 538339e commit b71ed77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public void afterCompletion(
request.setAttribute("level", "WARN");
LOG.warn("API call", v("api_request_info", logPayload));
} else {
logPayload.put("exception", Arrays.toString(exception.getStackTrace()));
logPayload.put("exception", exception != null ? Arrays.toString(exception.getStackTrace()) : "<null>");
logPayload.put("request_state", "ERROR");
LOG.error("API call", v("api_request_info", logPayload));
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled() && exception != null) {
exception.printStackTrace(System.err);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
Expand All @@ -37,11 +35,6 @@ public SessionAuthenticationStrategy sessionAuthenticationStrategy() {
return new NullAuthenticatedSessionStrategy();
}

@Bean
public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
return http.getSharedObject(AuthenticationManagerBuilder.class).build();
}

// For some reason, spring does not read the role claim from the jwt.
// Since we're basing our authorization on roles, we have to extend the spring security jwt converter to get that functionality.
// see https://stackoverflow.com/questions/65518172/spring-security-cant-extract-roles-from-jwt for reference
Expand Down

0 comments on commit b71ed77

Please sign in to comment.