|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright 2002-2016 the original author or authors.
|
|
|
|
|
|
+ * Copyright 2002-2019 the original author or authors.
|
|
*
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -26,46 +26,71 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|
@Override
|
|
@Override
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
http
|
|
http
|
|
- .authorizeRequests()
|
|
|
|
- .antMatchers("/resources/**").permitAll()
|
|
|
|
- .anyRequest().authenticated()
|
|
|
|
- .and()
|
|
|
|
- .openidLogin()
|
|
|
|
- .loginPage("/login")
|
|
|
|
- .permitAll()
|
|
|
|
- .authenticationUserDetailsService(new CustomUserDetailsService())
|
|
|
|
- .attributeExchange("https://www.google.com/.*")
|
|
|
|
- .attribute("email")
|
|
|
|
- .type("https://axschema.org/contact/email")
|
|
|
|
- .required(true)
|
|
|
|
- .and()
|
|
|
|
- .attribute("firstname")
|
|
|
|
- .type("https://axschema.org/namePerson/first")
|
|
|
|
- .required(true)
|
|
|
|
- .and()
|
|
|
|
- .attribute("lastname")
|
|
|
|
- .type("https://axschema.org/namePerson/last")
|
|
|
|
- .required(true)
|
|
|
|
- .and()
|
|
|
|
- .and()
|
|
|
|
- .attributeExchange(".*yahoo.com.*")
|
|
|
|
- .attribute("email")
|
|
|
|
- .type("https://axschema.org/contact/email")
|
|
|
|
- .required(true)
|
|
|
|
- .and()
|
|
|
|
- .attribute("fullname")
|
|
|
|
- .type("https://axschema.org/namePerson")
|
|
|
|
- .required(true)
|
|
|
|
- .and()
|
|
|
|
- .and()
|
|
|
|
- .attributeExchange(".*myopenid.com.*")
|
|
|
|
- .attribute("email")
|
|
|
|
- .type("https://schema.openid.net/contact/email")
|
|
|
|
- .required(true)
|
|
|
|
- .and()
|
|
|
|
- .attribute("fullname")
|
|
|
|
- .type("https://schema.openid.net/namePerson")
|
|
|
|
- .required(true);
|
|
|
|
|
|
+ .authorizeRequests(authorizeRequests ->
|
|
|
|
+ authorizeRequests
|
|
|
|
+ .antMatchers("/resources/**").permitAll()
|
|
|
|
+ .anyRequest().authenticated()
|
|
|
|
+ )
|
|
|
|
+ .openidLogin(openidLogin ->
|
|
|
|
+ openidLogin
|
|
|
|
+ .loginPage("/login")
|
|
|
|
+ .permitAll()
|
|
|
|
+ .authenticationUserDetailsService(new CustomUserDetailsService())
|
|
|
|
+ .attributeExchange(googleExchange ->
|
|
|
|
+ googleExchange
|
|
|
|
+ .identifierPattern("https://www.google.com/.*")
|
|
|
|
+ .attribute(emailAttribute ->
|
|
|
|
+ emailAttribute
|
|
|
|
+ .name("email")
|
|
|
|
+ .type("https://axschema.org/contact/email")
|
|
|
|
+ .required(true)
|
|
|
|
+ )
|
|
|
|
+ .attribute(firstnameAttribute ->
|
|
|
|
+ firstnameAttribute
|
|
|
|
+ .name("firstname")
|
|
|
|
+ .type("https://axschema.org/namePerson/first")
|
|
|
|
+ .required(true)
|
|
|
|
+ )
|
|
|
|
+ .attribute(lastnameAttribute ->
|
|
|
|
+ lastnameAttribute
|
|
|
|
+ .name("lastname")
|
|
|
|
+ .type("https://axschema.org/namePerson/last")
|
|
|
|
+ .required(true)
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ .attributeExchange(yahooExchange ->
|
|
|
|
+ yahooExchange
|
|
|
|
+ .identifierPattern(".*yahoo.com.*")
|
|
|
|
+ .attribute(emailAttribute ->
|
|
|
|
+ emailAttribute
|
|
|
|
+ .name("email")
|
|
|
|
+ .type("https://axschema.org/contact/email")
|
|
|
|
+ .required(true)
|
|
|
|
+ )
|
|
|
|
+ .attribute(fullnameAttribute ->
|
|
|
|
+ fullnameAttribute
|
|
|
|
+ .name("fullname")
|
|
|
|
+ .type("https://axschema.org/namePerson")
|
|
|
|
+ .required(true)
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ .attributeExchange(myopenidExchange ->
|
|
|
|
+ myopenidExchange
|
|
|
|
+ .identifierPattern(".*myopenid.com.*")
|
|
|
|
+ .attribute(emailAttribute ->
|
|
|
|
+ emailAttribute
|
|
|
|
+ .name("email")
|
|
|
|
+ .type("https://schema.openid.net/contact/email")
|
|
|
|
+ .required(true)
|
|
|
|
+ )
|
|
|
|
+ .attribute(fullnameAttribute ->
|
|
|
|
+ fullnameAttribute
|
|
|
|
+ .name("fullname")
|
|
|
|
+ .type("https://schema.openid.net/namePerson")
|
|
|
|
+ .required(true)
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ );
|
|
}
|
|
}
|
|
// @formatter:on
|
|
// @formatter:on
|
|
}
|
|
}
|