SEC-1460: Added AxFetchListFactory which matches OpenID identifiers to lists of attributes to use in a fetch-request.
This allows different configurations to be used based on the identity-provider (google, yahoo etc). The default implementation iterates through a map of regex patterns to attribute lists. The namespace has also been extended to support this facility, with the "identifier-match" attribute being added to the attribute-exchange element. Multiple attribute-exchange elements can now be defined, each matching a different identifier.
This commit is contained in:
@@ -46,6 +46,7 @@ import org.springframework.security.openid.OpenIDAuthenticationProvider;
|
||||
import org.springframework.security.openid.OpenIDAuthenticationToken;
|
||||
import org.springframework.security.openid.OpenIDConsumer;
|
||||
import org.springframework.security.openid.OpenIDConsumerException;
|
||||
import org.springframework.security.openid.RegexBasedAxFetchListFactory;
|
||||
import org.springframework.security.util.FieldUtils;
|
||||
import org.springframework.security.web.FilterChainProxy;
|
||||
import org.springframework.security.web.FilterInvocation;
|
||||
@@ -1152,7 +1153,6 @@ public class HttpSecurityBeanDefinitionParserTests {
|
||||
assertEquals("/openid_login", ap.getLoginFormUrl());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void openIDWithAttributeExchangeConfigurationIsParsedCorrectly() throws Exception {
|
||||
setContext(
|
||||
@@ -1168,7 +1168,8 @@ public class HttpSecurityBeanDefinitionParserTests {
|
||||
OpenIDAuthenticationFilter apf = getFilter(OpenIDAuthenticationFilter.class);
|
||||
|
||||
OpenID4JavaConsumer consumer = (OpenID4JavaConsumer) FieldUtils.getFieldValue(apf, "consumer");
|
||||
List<OpenIDAttribute> attributes = (List<OpenIDAttribute>) FieldUtils.getFieldValue(consumer, "attributesToFetch");
|
||||
RegexBasedAxFetchListFactory axFactory = (RegexBasedAxFetchListFactory) FieldUtils.getFieldValue(consumer, "attributesToFetchFactory");
|
||||
List<OpenIDAttribute> attributes = axFactory.createAttributeList("https://anyopenidprovider.com/");
|
||||
assertEquals(2, attributes.size());
|
||||
assertEquals("nickname", attributes.get(0).getName());
|
||||
assertEquals("http://schema.openid.net/namePerson/friendly", attributes.get(0).getType());
|
||||
|
||||
Reference in New Issue
Block a user