Guest User

Untitled

a guest
Jul 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. private static String REALM = "MY_TEST_REALM";
  2.  
  3. @Override
  4. protected void configure(HttpSecurity http) throws Exception {
  5.  
  6. JwtWebSecurityConfigurer
  7. .forRS256(apiAudience, issuer)
  8. .configure(http)
  9. .authorizeRequests()
  10. .antMatchers(HttpMethod.GET, "/es/status").permitAll()
  11. .antMatchers(HttpMethod.GET, "/login").permitAll()
  12. .antMatchers("/users/all").hasRole(Role.ADMIN.getValue())
  13. // .antMatchers("/users/all").hasRole("ADMIN") this also donot
  14. work
  15. .antMatchers("/v2/api-docs", "/configuration/ui", "/swagger-resources", "/configuration/security",
  16. "/swagger-ui.html", "/webjars/**", "/swagger-resources/configuration/ui", "/swagger-ui.html")
  17. .permitAll()
  18. .anyRequest().authenticated();
  19. }
  20.  
  21. {
  22. "timestamp": "2018-07-23T06:07:25.962+0000",
  23. "status": 403,
  24. "error": "Forbidden",
  25. "message": "Forbidden",
  26. "path": "/users/all"
  27. }
Add Comment
Please, Sign In to add comment