Spring boot Stormpath与现有spring boot应用程序集成
我有一个SpringBoot应用程序,它启用了SpringBoot安全性。 我使用的表是UserAccount和Role。现在我想集成stormpath进行访问控制。如何使用stormpath迁移现有系统?我的安全配置如下所示Spring boot Stormpath与现有spring boot应用程序集成,spring-boot,stormpath,Spring Boot,Stormpath,我有一个SpringBoot应用程序,它启用了SpringBoot安全性。 我使用的表是UserAccount和Role。现在我想集成stormpath进行访问控制。如何使用stormpath迁移现有系统?我的安全配置如下所示 @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter{ @Autowired private Custom
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
@Autowired
private CustomUserDetailsService customUserDetailsService;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http
.authorizeRequests()
.antMatchers("/*", "/static/**", "/css/**", "/js/**", "/images/**").permitAll()
.antMatchers("/school-admin/*").hasAuthority("SCHOOL_ADMIN").anyRequest().fullyAuthenticated()
.antMatchers("/teacher/*").hasAuthority("TEACHER").anyRequest().fullyAuthenticated()
.anyRequest().authenticated().and()
.formLogin()
.loginPage("/login.html").defaultSuccessUrl("/loginSuccess.html")
.failureUrl("/login.html?error").permitAll().and()
.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout.html")).logoutSuccessUrl("/login.html?logout");
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(customUserDetailsService).passwordEncoder(new BCryptPasswordEncoder());
}
}
您是否已经拥有Stormpath帐户?如果是这样的话,它应该很容易添加一个对Spring启动程序的依赖项,并使用一个与您正在使用的类似的
WebSecurityConfig
。您可能必须删除customuserdetails服务
和configureGlobal
方法。对于权限,您可以在Stormpath中创建组。您也不需要指定.formLogin()
或.logout()
,因为Stormpath提供了这些。是的,我有Stormpath帐户。用户和角色位于stormpath server中。在我的情况下,用户在我的服务器上。然后如何对其进行身份验证,如果注册了新用户,则该用户将位于我的服务器上,而不是stormpath服务器上。