Skip to content

Commit

Permalink
Fix parsing of access token in get parameter
Browse files Browse the repository at this point in the history
This is used by nodebb (passport)

Fixes #562
  • Loading branch information
Brutus5000 committed Feb 17, 2022
1 parent b901452 commit 6de4d18
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.oauth2.server.resource.web.DefaultBearerTokenResolver;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
Expand All @@ -26,6 +27,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

@Override
protected void configure(HttpSecurity http) throws Exception {
final var bearerTokenResolver = new DefaultBearerTokenResolver();
bearerTokenResolver.setAllowUriQueryParameter(true);

// @formatter:off
http
.csrf()
Expand All @@ -44,6 +48,7 @@ public boolean matches(HttpServletRequest request) {
.cacheControl().disable()
.and().formLogin().disable()
.oauth2ResourceServer()
.bearerTokenResolver(bearerTokenResolver)
.jwt()
.jwtAuthenticationConverter(new FafAuthenticationConverter())
.and()
Expand Down

0 comments on commit 6de4d18

Please sign in to comment.