我正在尝试使用带有angular2的前端和带有弹簧引导的REST后端来开发Web应用程序.
我需要管理3种类型的身份验证: - 基本登录/密码匹配数据库 - ldap authentification - sso authentification
用户通过身份验证后,后端会生成JWT并发送到前端.所有请求必须在标头中包含jwt以与REST通信.
这时我的websecurity配置是:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableTransactionManagement
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
private static final String LDAP_AUTHENTIFICATION = "ldap";
private static final String SSO_AUTHENTIFICATION = "sso";
@Autowired
private DataBaseAuthentificationProvider authProvider;
@Value("${ldap.provider.url}")
private String ldapProviderUrl;
@Value("${ldap.user.dn.patterns}")
private String userDnPatterns;
@Value("${authentification.type}")
private String authentificationType;
public WebSecurityConfiguration() {
/*
* Ignores the default configuration, useless in our case (session
* management, etc..)
*/
super(true);
}
/**
* Configure AuthenticationManagerBuilder to use …Run Code Online (Sandbox Code Playgroud)