@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .requestMatchers().anyRequest() .and() .authorizeRequests() .antMatchers("/oauth/*").permitAll(); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .requestMatchers().anyRequest() .and() .authorizeRequests() .antMatchers("/oauth/**").permitAll(); // @formatter:on } }
@Override protected void configure(HttpSecurity http) throws Exception { http .requestMatchers().anyRequest() .and().authorizeRequests().antMatchers("/oauth/*").permitAll(); }
/** * 这一步的配置是必不可少的,否则SpringBoot会自动配置一个AuthenticationManager,覆盖掉内存中的用户 */ // @Bean // @Override // public AuthenticationManager authenticationManagerBean() throws Exception { // AuthenticationManager manager = super.authenticationManagerBean(); // return manager; // } @Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .requestMatchers().anyRequest() .and() .authorizeRequests() .antMatchers("/oauth/*").permitAll(); // @formatter:on } }
@Override public void configure(HttpSecurity http) throws Exception { http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) .and().requestMatchers().anyRequest() .and().anonymous() .and().authorizeRequests() // .antMatchers("/product/**").access("#oauth2.hasScope('select') and hasRole('ROLE_USER')") .antMatchers("/**").authenticated(); //配置访问权限控制,必须认证过后才可以访问 } }
@Override protected void configure(HttpSecurity http) throws Exception { http .requestMatchers().anyRequest() .and().authorizeRequests().antMatchers("/oauth/*").permitAll(); } }
@Override public void configure(HttpSecurity http) throws Exception { http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) .and().requestMatchers().anyRequest() .and().anonymous() .and().authorizeRequests() // .antMatchers("/product/**").access("#oauth2.hasScope('select') and hasRole('ROLE_USER')") .antMatchers("/**").authenticated(); //配置访问权限控制,必须认证过后才可以访问 } }