Skip to content

Commit

Permalink
since this application is not including a formlogin, its not needed t…
Browse files Browse the repository at this point in the history
…he entryPoint. But rather it may be used the BearerEntryPoint
  • Loading branch information
rcsoyer committed Apr 8, 2024
1 parent f751ccd commit 6aa5850
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
import org.springframework.security.oauth2.server.authorization.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration;
import org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer;
import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings;
import org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationEntryPoint;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.security.web.util.matcher.MediaTypeRequestMatcher;

import static org.acme.micros.authorizationserver.authorizationserver.config.DefaultSecurityConfig.LOGIN_URL;
import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.MediaType.TEXT_HTML;
Expand Down Expand Up @@ -59,9 +58,8 @@ AuthorizationServerSettings authorizationServerSettings() {
private Customizer<ExceptionHandlingConfigurer<HttpSecurity>> loginEntryPoint() {
return exceptions -> exceptions
.defaultAuthenticationEntryPointFor(
new LoginUrlAuthenticationEntryPoint(LOGIN_URL),
new BearerTokenAuthenticationEntryPoint(),
new MediaTypeRequestMatcher(TEXT_HTML)
)
.authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint(LOGIN_URL));
);
}
}

0 comments on commit 6aa5850

Please sign in to comment.