Skip to content

Commit

Permalink
Refactor attributesWhitelist to be only extended by external identity
Browse files Browse the repository at this point in the history
providers.
[#99445176] https://www.pivotaltracker.com/story/show/99445176

Signed-off-by: Jonathan Lo <jlo@us.ibm.com>
  • Loading branch information
mbhave authored and jlo committed Sep 29, 2015
1 parent 77524cc commit a27f23e
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
Expand Up @@ -14,15 +14,12 @@

package org.cloudfoundry.identity.uaa;

import java.util.LinkedHashMap;
import java.util.List;

public abstract class AbstractIdentityProviderDefinition {
public static final String EMAIL_DOMAIN_ATTR = "emailDomain";
public static final String ATTR_WHITELIST = "attributesWhitelist";

private List<String> emailDomain;
private LinkedHashMap<String, String> attributesWhitelist;

public List<String> getEmailDomain() {
return emailDomain;
Expand All @@ -32,13 +29,4 @@ public AbstractIdentityProviderDefinition setEmailDomain(List<String> emailDomai
this.emailDomain = emailDomain;
return this;
}

public LinkedHashMap<String, String> getAttributesWhitelist() {
return attributesWhitelist;
}

public AbstractIdentityProviderDefinition setAttributesWhitelist(LinkedHashMap<String, String> attributesWhitelist) {
this.attributesWhitelist = attributesWhitelist;
return this;
}
}
@@ -0,0 +1,30 @@
package org.cloudfoundry.identity.uaa;

import java.util.LinkedHashMap;

/*******************************************************************************
* Cloud Foundry
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved.
* <p>
* This product is licensed to you under the Apache License, Version 2.0 (the "License").
* You may not use this product except in compliance with the License.
* <p>
* This product includes a number of subcomponents with
* separate copyright notices and license terms. Your use of these
* subcomponents is subject to the terms and conditions of the
* subcomponent's license, as noted in the LICENSE file.
*******************************************************************************/
public class ExternalIdentityProviderDefinition extends AbstractIdentityProviderDefinition {
public static final String ATTR_WHITELIST = "attributesWhitelist";

private LinkedHashMap<String, String> attributesWhitelist;

public LinkedHashMap<String, String> getAttributesWhitelist() {
return attributesWhitelist;
}

public AbstractIdentityProviderDefinition setAttributesWhitelist(LinkedHashMap<String, String> attributesWhitelist) {
this.attributesWhitelist = attributesWhitelist;
return this;
}
}
Expand Up @@ -13,9 +13,8 @@
package org.cloudfoundry.identity.uaa.ldap;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.cloudfoundry.identity.uaa.AbstractIdentityProviderDefinition;
import org.cloudfoundry.identity.uaa.ExternalIdentityProviderDefinition;
import org.cloudfoundry.identity.uaa.config.NestedMapPropertySource;
import org.cloudfoundry.identity.uaa.util.JsonUtils;
import org.springframework.core.env.AbstractEnvironment;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;
Expand All @@ -26,7 +25,7 @@
import java.util.List;
import java.util.Map;

public class LdapIdentityProviderDefinition extends AbstractIdentityProviderDefinition {
public class LdapIdentityProviderDefinition extends ExternalIdentityProviderDefinition {

private String ldapProfileFile;
private String baseUrl;
Expand Down
Expand Up @@ -19,7 +19,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.client.utils.URIBuilder;
import org.cloudfoundry.identity.uaa.AbstractIdentityProviderDefinition;
import org.cloudfoundry.identity.uaa.login.util.FileLocator;
import org.cloudfoundry.identity.uaa.zone.IdentityZone;
import org.opensaml.saml2.metadata.provider.MetadataProviderException;
Expand Down Expand Up @@ -47,8 +46,8 @@
import java.util.Timer;
import java.util.TimerTask;

import static org.cloudfoundry.identity.uaa.AbstractIdentityProviderDefinition.ATTR_WHITELIST;
import static org.cloudfoundry.identity.uaa.AbstractIdentityProviderDefinition.EMAIL_DOMAIN_ATTR;
import static org.cloudfoundry.identity.uaa.ExternalIdentityProviderDefinition.ATTR_WHITELIST;

public class SamlIdentityProviderConfigurator implements InitializingBean {
private static Log logger = LogFactory.getLog(SamlIdentityProviderConfigurator.class);
Expand Down
Expand Up @@ -13,7 +13,7 @@
package org.cloudfoundry.identity.uaa.login.saml;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.cloudfoundry.identity.uaa.AbstractIdentityProviderDefinition;
import org.cloudfoundry.identity.uaa.ExternalIdentityProviderDefinition;
import org.cloudfoundry.identity.uaa.login.util.FileLocator;

import java.io.File;
Expand All @@ -22,7 +22,7 @@
import java.util.LinkedHashMap;
import java.util.List;

public class SamlIdentityProviderDefinition extends AbstractIdentityProviderDefinition {
public class SamlIdentityProviderDefinition extends ExternalIdentityProviderDefinition {

public static final String DEFAULT_HTTP_SOCKET_FACTORY = "org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory";
public static final String DEFAULT_HTTPS_SOCKET_FACTORY = "org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory";
Expand Down
Expand Up @@ -38,8 +38,8 @@
import java.util.LinkedList;
import java.util.Map;

import static org.cloudfoundry.identity.uaa.AbstractIdentityProviderDefinition.ATTR_WHITELIST;
import static org.cloudfoundry.identity.uaa.AbstractIdentityProviderDefinition.EMAIL_DOMAIN_ATTR;
import static org.cloudfoundry.identity.uaa.ExternalIdentityProviderDefinition.ATTR_WHITELIST;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down
Expand Up @@ -23,7 +23,6 @@

import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

Expand Down

0 comments on commit a27f23e

Please sign in to comment.