[java-identity-provider] branch master updated: IDP-1516 - Reduce Guava dependence
Scott Cantor
cantor.2 at osu.edu
Mon Oct 28 20:04:27 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=b083fa1c2ec2d59260f6a78e9660104d57b661f5
The following commit(s) were added to refs/heads/master by this push:
new b083fa1 IDP-1516 - Reduce Guava dependence
b083fa1 is described below
commit b083fa1c2ec2d59260f6a78e9660104d57b661f5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Oct 28 20:04:17 2019 -0400
IDP-1516 - Reduce Guava dependence
https://issues.shibboleth.net/jira/browse/IDP-1516
Also remove extra layer of profile-specific security defaults.
(This was added in IDP-390 but never used.)
---
.../DefaultRelyingPartyConfigurationResolver.java | 70 ++++------------------
1 file changed, 13 insertions(+), 57 deletions(-)
diff --git a/idp-profile-impl/src/main/java/net/shibboleth/idp/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java b/idp-profile-impl/src/main/java/net/shibboleth/idp/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java
index 9fcbb69..c812e13 100644
--- a/idp-profile-impl/src/main/java/net/shibboleth/idp/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java
+++ b/idp-profile-impl/src/main/java/net/shibboleth/idp/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java
@@ -19,10 +19,8 @@ package net.shibboleth.idp.relyingparty.impl;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
@@ -41,7 +39,6 @@ import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
import net.shibboleth.utilities.java.support.resolver.ResolverException;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -49,11 +46,6 @@ import org.opensaml.security.credential.Credential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
/**
* Retrieves a per-relying party configuration for a given profile request based on the request context.
*
@@ -79,9 +71,6 @@ public class DefaultRelyingPartyConfigurationResolver
/** The predicate which decides if this request is "verified". */
@NonnullAfterInit private Predicate<ProfileRequestContext> verificationPredicate;
-
- /** The map from profile ID to {@link SecurityConfiguration}. */
- @Nonnull @NonnullElements private Map<String,SecurityConfiguration> securityConfigurationMap;
/** A global default security configuration. */
@Nullable private SecurityConfiguration defaultSecurityConfiguration;
@@ -96,7 +85,6 @@ public class DefaultRelyingPartyConfigurationResolver
public DefaultRelyingPartyConfigurationResolver() {
rpConfigurations = Collections.emptyList();
verificationPredicate = new VerifiedProfilePredicate();
- securityConfigurationMap = Collections.emptyMap();
signingCredentials = Collections.emptyList();
encryptionCredentials = Collections.emptyList();
}
@@ -108,7 +96,7 @@ public class DefaultRelyingPartyConfigurationResolver
*/
@Nonnull @NonnullElements @Unmodifiable @NotLive public List<RelyingPartyConfiguration>
getRelyingPartyConfigurations() {
- return ImmutableList.copyOf(rpConfigurations);
+ return rpConfigurations;
}
/**
@@ -118,9 +106,8 @@ public class DefaultRelyingPartyConfigurationResolver
*/
public void setRelyingPartyConfigurations(@Nonnull @NonnullElements final List<RelyingPartyConfiguration> configs) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- Constraint.isNotNull(configs, "RelyingPartyConfiguration list cannot be null");
- rpConfigurations = new ArrayList<>(Collections2.filter(configs, Predicates.notNull()));
+ rpConfigurations = List.copyOf(Constraint.isNotNull(configs, "RelyingPartyConfiguration list cannot be null"));
}
/**
@@ -184,36 +171,6 @@ public class DefaultRelyingPartyConfigurationResolver
verificationPredicate = Constraint.isNotNull(predicate, "Verification predicate cannot be null");
}
-
- /**
- * Get the map we use to look up default security configurations.
- *
- * @return Returns the Map.
- */
- @Nonnull @NonnullElements @Unmodifiable @NotLive public Map<String,SecurityConfiguration>
- getSecurityConfigurationMap() {
- return ImmutableMap.copyOf(securityConfigurationMap);
- }
-
- /**
- * Set the map we use to look up default configuration.
- *
- * @param map what to set.
- */
- public void setSecurityConfigurationMap(@Nonnull @NonnullElements final Map<String,SecurityConfiguration> map) {
- ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- Constraint.isNotNull(map, "SecurityConfiguration map cannot be null");
-
- securityConfigurationMap = new HashMap<>(map.size());
- for (final Map.Entry<String,SecurityConfiguration> entry : map.entrySet()) {
- if (entry.getValue() != null) {
- final String trimmed = StringSupport.trimOrNull(entry.getKey());
- if (trimmed != null) {
- securityConfigurationMap.put(trimmed, entry.getValue());
- }
- }
- }
- }
/**
* Set the global default {@link SecurityConfiguration}.
@@ -317,8 +274,7 @@ public class DefaultRelyingPartyConfigurationResolver
/** {@inheritDoc} */
@Override
@Nullable public SecurityConfiguration getDefaultSecurityConfiguration(@Nonnull @NotEmpty final String profileId) {
- final SecurityConfiguration config = securityConfigurationMap.get(profileId);
- return config != null ? config : defaultSecurityConfiguration;
+ return defaultSecurityConfiguration;
}
/**
@@ -327,7 +283,7 @@ public class DefaultRelyingPartyConfigurationResolver
* @return the list of signing credentials
*/
@Nonnull @NonnullElements @Unmodifiable @NotLive public List<Credential> getSigningCredentials() {
- return ImmutableList.copyOf(signingCredentials);
+ return signingCredentials;
}
/**
@@ -335,12 +291,12 @@ public class DefaultRelyingPartyConfigurationResolver
*
* @param credentials the list of signing credentials, may be null
*/
- public void setSigningCredentials(@Nullable final List<Credential> credentials) {
- if (credentials == null) {
+ public void setSigningCredentials(@Nullable @NonnullElements final List<Credential> credentials) {
+ if (credentials != null) {
+ signingCredentials = List.copyOf(credentials);
+ } else {
signingCredentials = Collections.emptyList();
- return;
}
- signingCredentials = new ArrayList<>(Collections2.filter(credentials, Predicates.notNull()));
}
/**
@@ -349,7 +305,7 @@ public class DefaultRelyingPartyConfigurationResolver
* @return the list of encryption credentials
*/
@Nonnull @NonnullElements @Unmodifiable @NotLive public List<Credential> getEncryptionCredentials() {
- return ImmutableList.copyOf(encryptionCredentials);
+ return encryptionCredentials;
}
/**
@@ -357,12 +313,12 @@ public class DefaultRelyingPartyConfigurationResolver
*
* @param credentials the list of encryption credentials, may be null
*/
- public void setEncryptionCredentials(@Nullable final List<Credential> credentials) {
- if (credentials == null) {
+ public void setEncryptionCredentials(@Nullable @NonnullElements final List<Credential> credentials) {
+ if (credentials != null) {
+ encryptionCredentials = List.copyOf(credentials);
+ } else {
encryptionCredentials = Collections.emptyList();
- return;
}
- encryptionCredentials = new ArrayList<>(Collections2.filter(credentials, Predicates.notNull()));
}
/** {@inheritDoc} */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list