You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
844 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. package ru.digitalbanana.demoresourceserver.config;
  2. import org.springframework.context.annotation.Configuration;
  3. import org.springframework.http.HttpMethod;
  4. import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  5. import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  6. @Configuration
  7. public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  8. @Override
  9. protected void configure(HttpSecurity http) throws Exception {
  10. http
  11. .authorizeRequests()
  12. .antMatchers(HttpMethod.GET, "/userinfo", "/user/**")
  13. .authenticated()
  14. // .hasAuthority("SCOPE_web-api")
  15. .anyRequest()
  16. .permitAll()
  17. .and()
  18. .oauth2ResourceServer()
  19. .jwt();
  20. }
  21. }