是否可以通过login basic和oauth2在一个应用程序中组合authoryzation和身份验证?
我的项目基于jhipster项目,简单的弹簧安全会话登录,现在我需要为移动应用程序添加oauth2安全性,看起来它是不可能的.
现在我有工作其中一个的情况,oauth2确定如果WebSecurityConfigurerAdapter的订单号比ResourceServerConfiguration更大.这意味着如果首先是oauth安全过滤器.我在stackoverflow中阅读了很多内容并尝试了许多解决方案,例如:
Spring security oauth2和表单登录配置,对我来说这是不行的.
现在我知道这与一些安全过滤器冲突有关,但我不知道如何解决它.
如果有人有类似的问题并且他设法做到了,或者知道如何绕过或做得更好,我会很感激这些信息.在此先感谢您的帮助 :)
@Configuration
@EnableWebSecurity
public class SecurityOauth2Configuration extends WebSecurityConfigurerAdapter {
@Inject
private UserDetailsService userDetailsService;
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoder());
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/scripts/**/*.{js,html}")
.antMatchers("/bower_components/**")
.antMatchers("/i18n/**")
.antMatchers("/assets/**")
.antMatchers("/swagger-ui/index.html")
.antMatchers("/api/register")
.antMatchers("/api/activate")
.antMatchers("/api/account/reset_password/init")
.antMatchers("/api/account/reset_password/finish")
.antMatchers("/test/**");
}
@Configuration
@EnableAuthorizationServer
public static class …Run Code Online (Sandbox Code Playgroud) security spring spring-security spring-security-oauth2 spring-session