Skip to content

Commit

Permalink
[pinpoint-apm#11167] Fix authorization and error page redirection issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ga-ram committed Jun 21, 2024
1 parent a5308d6 commit 4e96295
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,18 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
// for admin
http
.authorizeHttpRequests(customizer -> {
customizer.requestMatchers(antMatcher("/admin/**")).hasRole("ADMIN");
customizer.requestMatchers(antMatcher("/api/admin/**")).hasRole("ADMIN");
})
.exceptionHandling(customizer -> {
customizer.accessDeniedPage(BasicLoginConstants.URI_NOT_AUTHORIZED);
});

// for user
http.authorizeHttpRequests(customizer -> {
customizer.anyRequest().authenticated();
customizer
.requestMatchers(antMatcher("/api-public/**")).permitAll()
.requestMatchers(antMatcher("/api-ext-auth/**")).permitAll()
.anyRequest().authenticated();
});

http.addFilterBefore(new JwtRequestFilter(basicLoginService), UsernamePasswordAuthenticationFilter.class);
Expand Down

0 comments on commit 4e96295

Please sign in to comment.