[java-identity-provider] branch main updated: Null cleanup and deprecations to old settings.
Scott Cantor
cantor.2 at osu.edu
Fri Jan 20 19:06:39 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=a4fff317d0e8c3bf4cf4cddcc48493af98b0c1d8
The following commit(s) were added to refs/heads/main by this push:
new a4fff317d Null cleanup and deprecations to old settings.
a4fff317d is described below
commit a4fff317d0e8c3bf4cf4cddcc48493af98b0c1d8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Jan 20 14:06:36 2023 -0500
Null cleanup and deprecations to old settings.
---
.../profile/config/SSOSProfileConfiguration.java | 7 +-
.../NameIDCanonicalizationFlowDescriptor.java | 4 +-
...tractCollectionConfigurationLookupStrategy.java | 2 +-
...tMetadataDrivenConfigurationLookupStrategy.java | 29 +++++---
.../config/AbstractSAMLProfileConfiguration.java | 28 ++++----
.../config/BasicSAMLArtifactConfiguration.java | 7 +-
.../config/BeanConfigurationLookupStrategy.java | 9 ++-
.../config/BooleanConfigurationLookupStrategy.java | 2 +-
.../config/DoubleConfigurationLookupStrategy.java | 2 +-
.../DurationConfigurationLookupStrategy.java | 3 +-
.../config/IntegerConfigurationLookupStrategy.java | 2 +-
.../config/ListConfigurationLookupStrategy.java | 3 +-
.../config/LongConfigurationLookupStrategy.java | 2 +-
.../config/SetConfigurationLookupStrategy.java | 3 +-
.../config/StringConfigurationLookupStrategy.java | 2 +-
.../logic/AllowedSAMLPresentersPredicate.java | 26 +++++---
.../DetailedErrorsProfileConfigPredicate.java | 8 ++-
.../logic/IncludeAttributeStatementPredicate.java | 45 +++++++++----
.../logic/ProxyAwareForceAuthnPredicate.java | 8 ++-
.../ResolveAttributesProfileConfigPredicate.java | 47 -------------
.../config/logic/SignAssertionsPredicate.java | 15 +++--
.../config/logic/SignRequestsPredicate.java | 13 ++--
.../config/logic/SignResponsesPredicate.java | 2 +-
.../logic/DefaultNameIdentifierFormatStrategy.java | 13 ++--
.../logic/MappedEntityAttributesPredicate.java | 10 +--
.../config/BrowserSSOProfileConfiguration.java | 25 ++++---
...ractSAML2ArtifactAwareProfileConfiguration.java | 7 +-
.../config/AbstractSAML2ProfileConfiguration.java | 27 ++++----
.../config/BrowserSSOProfileConfiguration.java | 77 ++++++++++++++--------
.../profile/config/ECPProfileConfiguration.java | 6 +-
.../config/logic/CheckAddressPredicate.java | 8 ++-
.../logic/IgnoreRequestSignaturesPredicate.java | 10 +--
.../logic/IgnoreScopingProfileConfigPredicate.java | 8 ++-
.../profile/config/logic/SOAPErrorPredicate.java | 17 +++--
.../SuppressAuthenticatingAuthorityPredicate.java | 8 ++-
...yAwareAuthnContextComparisonLookupFunction.java | 13 ++--
...DefaultAuthenticationMethodsLookupFunction.java | 46 +++++++------
.../config/navigate/ProxyCountLookupFunction.java | 2 +-
.../navigate/ProxyRestrictionLookupFunction.java | 15 +++--
.../idp/saml/saml2/profile/package-info.java | 20 ------
.../AuthenticationMethodPrincipalTest.java | 8 ---
.../AuthnContextClassRefPrincipalTest.java | 8 ---
.../AuthnContextDeclRefPrincipalTest.java | 8 ---
.../AbstractSAMLProfileConfigurationTest.java | 27 +-------
.../config/BasicSAMLArtifactConfigurationTest.java | 1 +
...ArtifactResolutionProfileConfigurationTest.java | 2 +-
.../AttributeQueryProfileConfigurationTest.java | 2 +-
.../config/BrowserSSOProfileConfigurationTest.java | 9 ++-
.../AbstractSAML2ProfileConfigurationTest.java | 28 +-------
...ArtifactResolutionProfileConfigurationTest.java | 1 +
.../AttributeQueryProfileConfigurationTest.java | 1 +
.../config/BrowserSSOProfileConfigurationTest.java | 46 ++-----------
.../SingleLogoutProfileConfigurationTest.java | 1 +
.../idp/saml/session/SAML2SPSessionTest.java | 51 --------------
.../net/shibboleth/idp/session/BasicSPSession.java | 2 +-
55 files changed, 334 insertions(+), 442 deletions(-)
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/idwsf/profile/config/SSOSProfileConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/idwsf/profile/config/SSOSProfileConfiguration.java
index 216558528..8e86a2d21 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/idwsf/profile/config/SSOSProfileConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/idwsf/profile/config/SSOSProfileConfiguration.java
@@ -25,13 +25,12 @@ import javax.annotation.Nullable;
import net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.logic.PredicateSupport;
import net.shibboleth.shared.primitive.DeprecationSupport;
import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
import org.opensaml.profile.context.ProfileRequestContext;
-import com.google.common.base.Predicates;
-
/**
* Configuration support for the Liberty ID-WSF SSOS profile.
*
@@ -59,7 +58,7 @@ public class SSOSProfileConfiguration extends BrowserSSOProfileConfiguration {
protected SSOSProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
super(profileId);
- delegationPredicate = Predicates.alwaysFalse();
+ delegationPredicate = PredicateSupport.alwaysFalse();
DeprecationSupport.warn(ObjectType.BEAN, "Liberty.SSOS or Liberty.SSOS.MDDriven", "relying-party.xml",
"(none)");
@@ -84,7 +83,7 @@ public class SSOSProfileConfiguration extends BrowserSSOProfileConfiguration {
* @param flag flag to set
*/
public void setDelegation(final boolean flag) {
- delegationPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ delegationPredicate = PredicateSupport.constant(flag);
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java
index 6cdb1186e..0522ddcf1 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/nameid/NameIDCanonicalizationFlowDescriptor.java
@@ -18,7 +18,6 @@
package net.shibboleth.idp.saml.nameid;
import java.util.Collection;
-import java.util.Collections;
import java.util.Set;
import javax.annotation.Nonnull;
@@ -27,6 +26,7 @@ import net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.StringSupport;
@@ -42,7 +42,7 @@ public class NameIDCanonicalizationFlowDescriptor extends SubjectCanonicalizatio
/** Constructor. */
public NameIDCanonicalizationFlowDescriptor() {
- formats = Collections.emptySet();
+ formats = CollectionSupport.emptySet();
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractCollectionConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractCollectionConfigurationLookupStrategy.java
index a3f929399..56ade6ce5 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractCollectionConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractCollectionConfigurationLookupStrategy.java
@@ -32,12 +32,12 @@ import org.opensaml.core.xml.schema.XSInteger;
import org.opensaml.core.xml.schema.XSString;
import org.opensaml.core.xml.schema.XSURI;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives List<String>-valued
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java
index b7ccf7ce7..3e20b1c64 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractMetadataDrivenConfigurationLookupStrategy.java
@@ -42,7 +42,6 @@ import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.opensaml.saml.saml2.metadata.Extensions;
import org.opensaml.soap.client.security.SOAPClientSecurityProfileIdLookupFunction;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.AttributesMapContainer;
import net.shibboleth.idp.attribute.IdPAttribute;
@@ -56,6 +55,7 @@ import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
/**
@@ -108,14 +108,14 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
/** Alternative "full" property identifiers to support. */
@NonnullAfterInit @NonnullElements private Collection<String> propertyAliases;
- /** Optional default to return in the absence of a property. */
- @Nullable private Function<BaseContext,T> defaultValueStrategy;
+ /** Default to return in the absence of a property. */
+ @Nonnull private Function<BaseContext,T> defaultValueStrategy;
/** Strategy for obtaining metadata to check. */
@Nullable private Function<BaseContext,EntityDescriptor> metadataLookupStrategy;
/** Strategy for obtaining profile ID for property naming. */
- @Nullable @NotEmpty private Function<BaseContext,String> profileIdLookupStrategy;
+ @Nullable private Function<BaseContext,String> profileIdLookupStrategy;
/** Constructor. */
public AbstractMetadataDrivenConfigurationLookupStrategy() {
@@ -278,7 +278,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
CachedConfigurationContext cacheContext = null;
if (enableCaching && input != null) {
- cacheContext = input.getSubcontext(CachedConfigurationContext.class, true);
+ cacheContext = input.getOrCreateSubcontext(CachedConfigurationContext.class);
if (cacheContext.getPropertyMap().containsKey(propertyName)) {
log.debug("Returning cached property '{}'", propertyName);
return (T) cacheContext.getPropertyMap().get(propertyName);
@@ -324,6 +324,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
log.debug("Found matching tag '{}' for property '{}'", idpAttribute.getId(), propertyName);
final T result = translate(idpAttribute);
if (enableCaching) {
+ assert cacheContext != null;
cacheContext.getPropertyMap().put(propertyName, result);
}
return result;
@@ -336,6 +337,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
log.debug("Found matching tag '{}' for property '{}'", idpAttribute.getId(), propertyName);
final T result = translate(idpAttribute);
if (enableCaching) {
+ assert cacheContext != null;
cacheContext.getPropertyMap().put(propertyName, result);
}
return result;
@@ -346,6 +348,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
log.debug("No applicable mapped tag, applying default strategy for '{}'", propertyName);
final T ret = defaultValueStrategy.apply(input);
if (enableCaching) {
+ assert cacheContext != null;
cacheContext.getPropertyMap().put(propertyName, ret);
}
return ret;
@@ -358,6 +361,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
log.debug("Found matching tag '{}' for property '{}'", attribute.getName(), propertyName);
final T result = translate(attribute);
if (enableCaching) {
+ assert cacheContext != null;
cacheContext.getPropertyMap().put(propertyName, result);
}
return result;
@@ -370,6 +374,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
log.debug("Found matching tag '{}' for property '{}'", attribute.getName(), propertyName);
final T result = translate(attribute);
if (enableCaching) {
+ assert cacheContext != null;
cacheContext.getPropertyMap().put(propertyName, result);
}
return result;
@@ -379,6 +384,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
log.debug("No applicable tag, applying default strategy for '{}'", propertyName);
final T ret = defaultValueStrategy.apply(input);
if (enableCaching) {
+ assert cacheContext != null;
cacheContext.getPropertyMap().put(propertyName, ret);
}
return ret;
@@ -525,12 +531,16 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
@Nonnull @NotEmpty final String name) {
final List<AttributesMapContainer> containerList = input.get(AttributesMapContainer.class);
- if (null == containerList || containerList.isEmpty() || containerList.get(0).get() == null ||
- containerList.get(0).get().isEmpty()) {
+ if (null == containerList || containerList.isEmpty()) {
return null;
}
- final Collection<IdPAttribute> matches = containerList.get(0).get().get(name);
+ final AttributesMapContainer container = containerList.get(0);
+ if (container == null || container.get().isEmpty()) {
+ return null;
+ }
+
+ final Collection<IdPAttribute> matches = container.get().get(name);
return matches.isEmpty() ? null : matches.iterator().next();
}
@@ -591,4 +601,5 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
DEFAULT_MC_PROFILE_ID_LOOKUP = new SOAPClientSecurityProfileIdLookupFunction();
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfiguration.java
index 17a48b77c..9b2753b8a 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfiguration.java
@@ -19,7 +19,6 @@ package net.shibboleth.idp.saml.profile.config;
import java.time.Duration;
import java.util.Collection;
-import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -31,15 +30,13 @@ import net.shibboleth.idp.profile.config.AbstractConditionalProfileConfiguration
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
import net.shibboleth.shared.primitive.StringSupport;
import org.opensaml.profile.context.ProfileRequestContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Predicates;
/** Base class for SAML profile configurations. */
public abstract class AbstractSAMLProfileConfiguration extends AbstractConditionalProfileConfiguration implements
@@ -47,9 +44,6 @@ public abstract class AbstractSAMLProfileConfiguration extends AbstractCondition
/** Default assertion lifetime. */
@Nonnull public static final Duration DEFAULT_ASSERTION_LIFETIME = Duration.ofMinutes(5);
-
- /** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(AbstractSAMLProfileConfiguration.class);
/** Predicate used to determine if the generated request should be signed. Default returns false. */
@Nonnull private Predicate<ProfileRequestContext> signRequestsPredicate;
@@ -77,10 +71,10 @@ public abstract class AbstractSAMLProfileConfiguration extends AbstractCondition
public AbstractSAMLProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
super(profileId);
- signRequestsPredicate = Predicates.alwaysFalse();
- signResponsesPredicate = Predicates.alwaysFalse();
- signAssertionsPredicate = Predicates.alwaysFalse();
- includeNotBeforePredicate = Predicates.alwaysTrue();
+ signRequestsPredicate = PredicateSupport.alwaysFalse();
+ signResponsesPredicate = PredicateSupport.alwaysFalse();
+ signAssertionsPredicate = PredicateSupport.alwaysFalse();
+ includeNotBeforePredicate = PredicateSupport.alwaysTrue();
assertionLifetimeLookupStrategy = FunctionSupport.constant(DEFAULT_ASSERTION_LIFETIME);
assertionAudiencesLookupStrategy = FunctionSupport.constant(null);
}
@@ -96,7 +90,7 @@ public abstract class AbstractSAMLProfileConfiguration extends AbstractCondition
* @param flag flag to set
*/
public void setSignAssertions(final boolean flag) {
- signAssertionsPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ signAssertionsPredicate = PredicateSupport.constant(flag);
}
/**
@@ -121,7 +115,7 @@ public abstract class AbstractSAMLProfileConfiguration extends AbstractCondition
* @param flag flag to set
*/
public void setSignRequests(final boolean flag) {
- signRequestsPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ signRequestsPredicate = PredicateSupport.constant(flag);
}
/**
@@ -146,7 +140,7 @@ public abstract class AbstractSAMLProfileConfiguration extends AbstractCondition
* @param flag flag to set
*/
public void setSignResponses(final boolean flag) {
- signResponsesPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ signResponsesPredicate = PredicateSupport.constant(flag);
}
/**
@@ -202,7 +196,7 @@ public abstract class AbstractSAMLProfileConfiguration extends AbstractCondition
* @param flag flag to set
*/
public void setIncludeConditionsNotBefore(final boolean flag) {
- includeNotBeforePredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ includeNotBeforePredicate = PredicateSupport.constant(flag);
}
/**
@@ -225,7 +219,7 @@ public abstract class AbstractSAMLProfileConfiguration extends AbstractCondition
if (audiences != null) {
return Set.copyOf(audiences);
}
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfiguration.java
index 8c4bad7e1..db7d88b3c 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfiguration.java
@@ -63,9 +63,10 @@ public class BasicSAMLArtifactConfiguration implements SAMLArtifactConfiguration
}
final byte[] typeCode = ByteBuffer.allocate(4).putInt(type).array();
- artifactType = new byte[2];
- artifactType[0] = typeCode[2];
- artifactType[1] = typeCode[3];
+ final byte[] atype = new byte[2];
+ atype[0] = typeCode[2];
+ atype[1] = typeCode[3];
+ artifactType = atype;
}
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BeanConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BeanConfigurationLookupStrategy.java
index 119295c47..982e8b5b2 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BeanConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BeanConfigurationLookupStrategy.java
@@ -26,8 +26,9 @@ import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.schema.XSAny;
import org.opensaml.core.xml.schema.XSString;
import org.opensaml.saml.saml2.core.Attribute;
+
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -38,6 +39,7 @@ import net.shibboleth.idp.attribute.StringAttributeValue;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives bean-based
@@ -56,7 +58,7 @@ public class BeanConfigurationLookupStrategy<T> extends AbstractMetadataDrivenCo
@Nonnull private final Logger log = LoggerFactory.getLogger(BeanConfigurationLookupStrategy.class);
/** Enclosing Spring context. */
- @Nullable private ApplicationContext applicationContext;
+ @NonnullAfterInit private ApplicationContext applicationContext;
/** Type of bean to return. */
@NonnullAfterInit private Class<T> propertyType;
@@ -77,7 +79,7 @@ public class BeanConfigurationLookupStrategy<T> extends AbstractMetadataDrivenCo
}
/** {@inheritDoc} */
- public void setApplicationContext(final ApplicationContext context) throws BeansException {
+ public void setApplicationContext(@Nonnull final ApplicationContext context) throws BeansException {
checkSetterPreconditions();
applicationContext = context;
}
@@ -152,6 +154,7 @@ public class BeanConfigurationLookupStrategy<T> extends AbstractMetadataDrivenCo
if (value != null) {
try {
+ assert propertyType != null;
return applicationContext.getBean(value, propertyType);
} catch (final BeansException e) {
log.error("Error locating appropriately typed bean named {}", value, e);
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BooleanConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BooleanConfigurationLookupStrategy.java
index dc3ef4cd2..5d3b36cc1 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BooleanConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/BooleanConfigurationLookupStrategy.java
@@ -30,11 +30,11 @@ import org.opensaml.core.xml.schema.XSInteger;
import org.opensaml.core.xml.schema.XSString;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives Boolean-valued
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DoubleConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DoubleConfigurationLookupStrategy.java
index 3a5fbb656..89107bde2 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DoubleConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DoubleConfigurationLookupStrategy.java
@@ -30,11 +30,11 @@ import org.opensaml.core.xml.schema.XSInteger;
import org.opensaml.core.xml.schema.XSString;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives Double-valued
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DurationConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DurationConfigurationLookupStrategy.java
index 647034886..e6a683cac 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DurationConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/DurationConfigurationLookupStrategy.java
@@ -29,12 +29,13 @@ import org.opensaml.core.xml.schema.XSInteger;
import org.opensaml.core.xml.schema.XSString;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.core.convert.converter.Converter;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.spring.config.StringToDurationConverter;
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/IntegerConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/IntegerConfigurationLookupStrategy.java
index abe41a20b..c127ddd33 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/IntegerConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/IntegerConfigurationLookupStrategy.java
@@ -30,11 +30,11 @@ import org.opensaml.core.xml.schema.XSInteger;
import org.opensaml.core.xml.schema.XSString;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives Integer-valued
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/ListConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/ListConfigurationLookupStrategy.java
index 1a49f44a3..294434a7b 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/ListConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/ListConfigurationLookupStrategy.java
@@ -26,11 +26,11 @@ import javax.annotation.Nullable;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives List<String>-valued
@@ -74,6 +74,7 @@ public class ListConfigurationLookupStrategy<T> extends AbstractCollectionConfig
final List<XMLObject> values = tag.getAttributeValues();
final List<T> result = new ArrayList<>(values.size());
for (final XMLObject value : values) {
+ assert value != null;
final String converted = xmlObjectToString(value);
if (converted != null) {
try {
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/LongConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/LongConfigurationLookupStrategy.java
index 156056d07..77cbb56fc 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/LongConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/LongConfigurationLookupStrategy.java
@@ -32,11 +32,11 @@ import org.opensaml.core.xml.schema.XSInteger;
import org.opensaml.core.xml.schema.XSString;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives Long-valued
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SetConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SetConfigurationLookupStrategy.java
index ed840fee0..5dd358103 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SetConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SetConfigurationLookupStrategy.java
@@ -27,11 +27,11 @@ import javax.annotation.Nullable;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives Set<String>-valued
@@ -75,6 +75,7 @@ public class SetConfigurationLookupStrategy<T> extends AbstractCollectionConfigu
final List<XMLObject> values = tag.getAttributeValues();
final Set<T> result = new HashSet<>(values.size());
for (final XMLObject value : values) {
+ assert value != null;
final String converted = xmlObjectToString(value);
if (converted != null) {
try {
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/StringConfigurationLookupStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/StringConfigurationLookupStrategy.java
index 875f38599..47f2dadb4 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/StringConfigurationLookupStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/StringConfigurationLookupStrategy.java
@@ -34,11 +34,11 @@ import org.opensaml.core.xml.schema.XSString;
import org.opensaml.core.xml.schema.XSURI;
import org.opensaml.saml.saml2.core.Attribute;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A strategy function that examines SAML metadata associated with a relying party and derives String-valued
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java
index b17633431..d137744ee 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java
@@ -18,25 +18,28 @@
package net.shibboleth.idp.saml.profile.config.logic;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import java.util.function.Predicate;
+import org.opensaml.messaging.context.MessageContext;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.common.messaging.context.SAMLPresenterEntityContext;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
/**
* Predicate which evaluates the inbound {@link SAMLPresenterEntityContext#getEntityId()}
* against a specified collection of entityIDs.
*/
+ at SuppressWarnings("removal")
public class AllowedSAMLPresentersPredicate implements Predicate<ProfileRequestContext> {
/** Logger. */
@@ -47,7 +50,7 @@ public class AllowedSAMLPresentersPredicate implements Predicate<ProfileRequestC
/** Constructor. */
public AllowedSAMLPresentersPredicate() {
- allowedPresenters = Collections.emptySet();
+ allowedPresenters = CollectionSupport.emptySet();
}
/**
@@ -57,7 +60,7 @@ public class AllowedSAMLPresentersPredicate implements Predicate<ProfileRequestC
*/
public void setAllowedPresenters(@Nullable final Collection<String> presenters) {
if (presenters == null) {
- allowedPresenters = Collections.emptySet();
+ allowedPresenters = CollectionSupport.emptySet();
} else {
allowedPresenters = new HashSet<>(StringSupport.normalizeStringCollection(presenters));
}
@@ -65,13 +68,18 @@ public class AllowedSAMLPresentersPredicate implements Predicate<ProfileRequestC
/** {@inheritDoc} */
public boolean test(@Nullable final ProfileRequestContext input) {
- if (input == null || input.getInboundMessageContext() == null) {
- log.debug("ProfileRequestContext or inbound MessageContext were null");
+ if (input == null) {
+ log.debug("ProfileRequestContext was null");
+ return false;
+ }
+
+ final MessageContext mc = input.getInboundMessageContext();
+ if (mc == null) {
+ log.debug("Inbound MessageContext was null");
return false;
}
- final SAMLPresenterEntityContext presenterContext = input.getInboundMessageContext().getSubcontext(
- SAMLPresenterEntityContext.class);
+ final SAMLPresenterEntityContext presenterContext = mc.getSubcontext(SAMLPresenterEntityContext.class);
if (presenterContext == null) {
log.debug("No inbound SAMLPresenterEntityContext");
return false;
@@ -83,4 +91,4 @@ public class AllowedSAMLPresentersPredicate implements Predicate<ProfileRequestC
return result;
}
-}
+}
\ No newline at end of file
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/DetailedErrorsProfileConfigPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/DetailedErrorsProfileConfigPredicate.java
index 2be704fef..e117ea430 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/DetailedErrorsProfileConfigPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/DetailedErrorsProfileConfigPredicate.java
@@ -21,6 +21,7 @@ import javax.annotation.Nullable;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.logic.AbstractRelyingPartyPredicate;
+import net.shibboleth.idp.relyingparty.RelyingPartyConfiguration;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -37,8 +38,11 @@ public class DetailedErrorsProfileConfigPredicate extends AbstractRelyingPartyPr
/** {@inheritDoc} */
public boolean test(@Nullable final ProfileRequestContext input) {
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null && rpc.getConfiguration() != null) {
- return rpc.getConfiguration().isDetailedErrors(input);
+ if (rpc != null) {
+ final RelyingPartyConfiguration rpConfig = rpc.getConfiguration();
+ if (rpConfig != null) {
+ return rpConfig.isDetailedErrors(input);
+ }
}
return false;
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/IncludeAttributeStatementPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/IncludeAttributeStatementPredicate.java
index fd011432e..0f2f50ff7 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/IncludeAttributeStatementPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/IncludeAttributeStatementPredicate.java
@@ -22,6 +22,7 @@ import java.util.function.Function;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.logic.AbstractRelyingPartyPredicate;
import net.shibboleth.shared.logic.Constraint;
@@ -29,6 +30,7 @@ import net.shibboleth.shared.logic.Constraint;
import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
+import org.opensaml.saml.common.binding.BindingDescriptor;
import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
/**
@@ -65,27 +67,23 @@ public class IncludeAttributeStatementPredicate extends AbstractRelyingPartyPred
public boolean test(@Nullable final ProfileRequestContext input) {
// Check for an artifact binding.
- final SAMLBindingContext bindingCtx = bindingContextLookupStrategy.apply(input);
- if (bindingCtx != null && bindingCtx.getBindingDescriptor() != null
- && bindingCtx.getBindingDescriptor().isArtifact()) {
+ if (isArtifactBinding(input)) {
return true;
}
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null && rpc.getProfileConfig() != null) {
- if (rpc.getProfileConfig()
- instanceof net.shibboleth.idp.saml.saml1.profile.config.BrowserSSOProfileConfiguration) {
+ if (rpc != null) {
+ final ProfileConfiguration pc = rpc.getProfileConfig();
+
+ if (pc instanceof net.shibboleth.idp.saml.saml1.profile.config.BrowserSSOProfileConfiguration) {
return ((net.shibboleth.idp.saml.saml1.profile.config.BrowserSSOProfileConfiguration)
- rpc.getProfileConfig()).isIncludeAttributeStatement(input);
- } else if (rpc.getProfileConfig()
- instanceof net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration) {
+ pc).isIncludeAttributeStatement(input);
+ } else if (pc instanceof net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration) {
return ((net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration)
- rpc.getProfileConfig()).isIncludeAttributeStatement(input);
- } else if (rpc.getProfileConfig()
- instanceof net.shibboleth.idp.saml.saml1.profile.config.AttributeQueryProfileConfiguration) {
+ pc).isIncludeAttributeStatement(input);
+ } else if (pc instanceof net.shibboleth.idp.saml.saml1.profile.config.AttributeQueryProfileConfiguration) {
return true;
- } else if (rpc.getProfileConfig()
- instanceof net.shibboleth.idp.saml.saml2.profile.config.AttributeQueryProfileConfiguration) {
+ } else if (pc instanceof net.shibboleth.idp.saml.saml2.profile.config.AttributeQueryProfileConfiguration) {
return true;
}
}
@@ -93,4 +91,23 @@ public class IncludeAttributeStatementPredicate extends AbstractRelyingPartyPred
return false;
}
+ /**
+ * Returns true iff the SAML binding is an artifact variant.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return true iff the SAML binding is an artifact variant
+ */
+ private boolean isArtifactBinding(@Nullable final ProfileRequestContext profileRequestContext) {
+ final SAMLBindingContext bindingCtx = bindingContextLookupStrategy.apply(profileRequestContext);
+ if (bindingCtx != null) {
+ final BindingDescriptor bd = bindingCtx.getBindingDescriptor();
+ if (bd != null) {
+ return bd.isArtifact();
+ }
+ }
+
+ return false;
+ }
+
}
\ No newline at end of file
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/ProxyAwareForceAuthnPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/ProxyAwareForceAuthnPredicate.java
index 6ea6f2cb7..68ba1f48a 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/ProxyAwareForceAuthnPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/ProxyAwareForceAuthnPredicate.java
@@ -21,6 +21,7 @@ import java.util.function.Predicate;
import javax.annotation.Nullable;
+import org.opensaml.messaging.context.BaseContext;
import org.opensaml.profile.context.ProfileRequestContext;
import net.shibboleth.idp.authn.context.AuthenticationContext;
@@ -45,8 +46,11 @@ public class ProxyAwareForceAuthnPredicate implements Predicate<ProfileRequestCo
/** {@inheritDoc} */
public boolean test(@Nullable final ProfileRequestContext input) {
- if (input != null && input.getParent() instanceof AuthenticationContext) {
- return ((AuthenticationContext) input.getParent()).isForceAuthn();
+ if (input != null) {
+ final BaseContext parent = input.getParent();
+ if (parent instanceof AuthenticationContext) {
+ return ((AuthenticationContext) parent).isForceAuthn();
+ }
}
return false;
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/ResolveAttributesProfileConfigPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/ResolveAttributesProfileConfigPredicate.java
deleted file mode 100644
index 20300f14a..000000000
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/ResolveAttributesProfileConfigPredicate.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.saml.profile.config.logic;
-
-import javax.annotation.Nullable;
-
-import net.shibboleth.idp.profile.config.logic.ResolveAttributesPredicate;
-import net.shibboleth.shared.primitive.DeprecationSupport;
-import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
-
-import org.opensaml.profile.context.ProfileRequestContext;
-
-/**
- * A predicate that evaluates a {@link ProfileRequestContext} and determines whether attribute resolution
- * and filtering should take place.
- *
- * <p>For SAML 1 and SAML 2 SSO profiles, the "resolveAttributes" flag is the setting governing
- * this decision. For other profiles, false is returned.</p>
- *
- * @deprecated
- */
- at Deprecated(since="4.2.0", forRemoval=true)
-public class ResolveAttributesProfileConfigPredicate extends ResolveAttributesPredicate {
-
- /** {@inheritDoc} */
- public boolean test(@Nullable final ProfileRequestContext input) {
- DeprecationSupport.warnOnce(ObjectType.CLASS, getClass().getName(), null, ResolveAttributesPredicate.class.getName());
-
- return super.test(input);
- }
-
-}
\ No newline at end of file
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignAssertionsPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignAssertionsPredicate.java
index 8ba3ebdfd..5ffa63c50 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignAssertionsPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignAssertionsPredicate.java
@@ -24,6 +24,7 @@ import javax.annotation.Nullable;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.common.messaging.context.SAMLMetadataContext;
+import org.opensaml.saml.saml2.metadata.RoleDescriptor;
import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
import net.shibboleth.idp.profile.config.ProfileConfiguration;
@@ -75,11 +76,13 @@ public class SignAssertionsPredicate extends AbstractRelyingPartyPredicate {
if (honorMetadata) {
final SAMLMetadataContext metadataCtx = metadataContextLookupStrategy.apply(input);
- if (metadataCtx != null && metadataCtx.getRoleDescriptor() != null
- && metadataCtx.getRoleDescriptor() instanceof SPSSODescriptor) {
- final Boolean flag = ((SPSSODescriptor) metadataCtx.getRoleDescriptor()).getWantAssertionsSigned();
- if (flag != null && flag.booleanValue()) {
- return true;
+ if (metadataCtx != null) {
+ final RoleDescriptor role = metadataCtx.getRoleDescriptor();
+ if (role instanceof SPSSODescriptor) {
+ final Boolean flag = ((SPSSODescriptor) role).getWantAssertionsSigned();
+ if (flag != null && flag.booleanValue()) {
+ return true;
+ }
}
}
}
@@ -87,7 +90,7 @@ public class SignAssertionsPredicate extends AbstractRelyingPartyPredicate {
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
if (rpc != null) {
final ProfileConfiguration pc = rpc.getProfileConfig();
- if (pc != null && pc instanceof SAMLProfileConfiguration) {
+ if (pc instanceof SAMLProfileConfiguration) {
return ((SAMLProfileConfiguration) pc).isSignAssertions(input);
}
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignRequestsPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignRequestsPredicate.java
index d7fac1b3e..7b48b03bc 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignRequestsPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignRequestsPredicate.java
@@ -32,6 +32,7 @@ import net.shibboleth.shared.logic.Constraint;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.common.messaging.context.SAMLMetadataContext;
import org.opensaml.saml.saml2.metadata.IDPSSODescriptor;
+import org.opensaml.saml.saml2.metadata.RoleDescriptor;
/**
* A predicate implementation that forwards to
@@ -82,11 +83,13 @@ public class SignRequestsPredicate extends AbstractRelyingPartyPredicate {
if (honorMetadata) {
final SAMLMetadataContext metadataCtx = metadataContextLookupStrategy.apply(input);
- if (metadataCtx != null && metadataCtx.getRoleDescriptor() != null
- && metadataCtx.getRoleDescriptor() instanceof IDPSSODescriptor) {
- final Boolean flag = ((IDPSSODescriptor) metadataCtx.getRoleDescriptor()).getWantAuthnRequestsSigned();
- if (flag != null && flag.booleanValue()) {
- return true;
+ if (metadataCtx != null) {
+ final RoleDescriptor role = metadataCtx.getRoleDescriptor();
+ if (role instanceof IDPSSODescriptor) {
+ final Boolean flag = ((IDPSSODescriptor) role).getWantAuthnRequestsSigned();
+ if (flag != null && flag.booleanValue()) {
+ return true;
+ }
}
}
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignResponsesPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignResponsesPredicate.java
index c8baf817d..a9c3da0cb 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignResponsesPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/SignResponsesPredicate.java
@@ -35,7 +35,7 @@ public class SignResponsesPredicate extends AbstractRelyingPartyPredicate {
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
if (rpc != null) {
final ProfileConfiguration pc = rpc.getProfileConfig();
- if (pc != null && pc instanceof SAMLProfileConfiguration) {
+ if (pc instanceof SAMLProfileConfiguration) {
return ((SAMLProfileConfiguration) pc).isSignResponses(input);
}
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/DefaultNameIdentifierFormatStrategy.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/DefaultNameIdentifierFormatStrategy.java
index ac0be43be..ad63f3831 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/DefaultNameIdentifierFormatStrategy.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/DefaultNameIdentifierFormatStrategy.java
@@ -27,8 +27,11 @@ import javax.annotation.Nullable;
import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
+import net.shibboleth.idp.relyingparty.RelyingPartyConfiguration;
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import org.opensaml.messaging.context.navigate.ChildContextLookup;
@@ -36,7 +39,6 @@ import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.common.profile.logic.MetadataNameIdentifierFormatStrategy;
import org.opensaml.saml.saml2.core.NameID;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Function to filter a set of candidate NameIdentifier/NameID Format values derived from an entity's SAML metadata
@@ -103,18 +105,21 @@ public class DefaultNameIdentifierFormatStrategy extends MetadataNameIdentifierF
}
/** {@inheritDoc} */
- @Override @Nullable public List<String> apply(@Nullable final ProfileRequestContext input) {
+ @Override
+ @Nonnull @NonnullElements public List<String> apply(@Nullable final ProfileRequestContext input) {
final List<String> fromConfig = new ArrayList<>();
final List<String> fromMetadata = super.apply(input);
final RelyingPartyContext relyingPartyCtx = relyingPartyContextLookupStrategy.apply(input);
- if (relyingPartyCtx != null && relyingPartyCtx.getConfiguration() != null) {
+ final RelyingPartyConfiguration rpConfig = relyingPartyCtx != null ? relyingPartyCtx.getConfiguration() : null;
+ if (rpConfig != null) {
final ProfileConfiguration profileConfig;
if (profileId != null) {
log.debug("Using overridden profile configuration ID: {}", profileId);
- profileConfig = relyingPartyCtx.getConfiguration().getProfileConfiguration(input, profileId);
+ profileConfig = rpConfig.getProfileConfiguration(input, profileId);
} else {
+ assert relyingPartyCtx != null;
profileConfig = relyingPartyCtx.getProfileConfig();
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/MappedEntityAttributesPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/MappedEntityAttributesPredicate.java
index d0716fd5b..2f80b19c9 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/MappedEntityAttributesPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/logic/MappedEntityAttributesPredicate.java
@@ -31,7 +31,6 @@ import org.opensaml.saml.common.profile.logic.EntityAttributesPredicate.Candidat
import org.opensaml.saml.saml2.metadata.EntitiesDescriptor;
import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
@@ -43,6 +42,7 @@ import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
@@ -166,7 +166,7 @@ public class MappedEntityAttributesPredicate extends EntityAttributesPredicate {
*
* @return true iff the attached object metadata matched at least one input candidate
*/
- private boolean doTest(@Nullable final XMLObject input, @Nullable final String name,
+ private boolean doTest(@Nonnull final XMLObject input, @Nullable final String name,
@Nonnull @NonnullElements final Collection<Candidate> candidates) {
final List<AttributesMapContainer> containerList =
input.getObjectMetadata().get(AttributesMapContainer.class);
@@ -206,9 +206,9 @@ public class MappedEntityAttributesPredicate extends EntityAttributesPredicate {
// Checkstyle: CyclomaticComplexity OFF
/** {@inheritDoc} */
- public boolean test(@Nonnull final Candidate input) {
+ public boolean test(@Nullable final Candidate input) {
- if (input.getNameFormat() != null) {
+ if (input == null || input.getNameFormat() != null) {
return false;
}
@@ -227,6 +227,7 @@ public class MappedEntityAttributesPredicate extends EntityAttributesPredicate {
final String tagvalstr = tagvals.get(tagindex);
for (final IdPAttributeValue cval : a.getValues()) {
+ assert cval != null;
final String cvalstr = attributeValueToString(cval);
if (tagvalstr != null && cvalstr != null) {
if (tagvalstr.equals(cvalstr)) {
@@ -248,6 +249,7 @@ public class MappedEntityAttributesPredicate extends EntityAttributesPredicate {
for (int tagindex = 0; tagindex < tagexps.size(); ++tagindex) {
for (final IdPAttributeValue cval : a.getValues()) {
+ assert cval != null;
final String cvalstr = attributeValueToString(cval);
if (tagexps.get(tagindex) != null && cvalstr != null) {
if (tagexps.get(tagindex).matcher(cvalstr).matches()) {
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfiguration.java
index f1f325629..eb73f56b1 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfiguration.java
@@ -19,7 +19,6 @@ package net.shibboleth.idp.saml.saml1.profile.config;
import java.security.Principal;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
@@ -30,8 +29,6 @@ import javax.annotation.Nullable;
import org.opensaml.profile.context.ProfileRequestContext;
-import com.google.common.base.Predicates;
-
import net.shibboleth.idp.authn.config.AuthenticationProfileConfiguration;
import net.shibboleth.idp.profile.config.AttributeResolvingProfileConfiguration;
import net.shibboleth.idp.saml.authn.principal.AuthenticationMethodPrincipal;
@@ -40,8 +37,10 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
import net.shibboleth.shared.primitive.StringSupport;
/** Configuration for SAML 1 Browser SSO profile requests. */
@@ -89,13 +88,13 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
protected BrowserSSOProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
super(profileId);
setSignResponses(true);
- resolveAttributesPredicate = Predicates.alwaysTrue();
- includeAttributeStatementPredicate = Predicates.alwaysFalse();
+ resolveAttributesPredicate = PredicateSupport.alwaysTrue();
+ includeAttributeStatementPredicate = PredicateSupport.alwaysFalse();
authenticationFlowsLookupStrategy = FunctionSupport.constant(null);
postAuthenticationFlowsLookupStrategy = FunctionSupport.constant(null);
defaultAuthenticationMethodsLookupStrategy = FunctionSupport.constant(null);
nameIDFormatPrecedenceLookupStrategy = FunctionSupport.constant(null);
- forceAuthnPredicate = Predicates.alwaysFalse();
+ forceAuthnPredicate = PredicateSupport.alwaysFalse();
proxyCountLookupStrategy = FunctionSupport.constant(null);
}
@@ -110,7 +109,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
* @param flag flag to set
*/
public void setResolveAttributes(final boolean flag) {
- resolveAttributesPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ resolveAttributesPredicate = PredicateSupport.constant(flag);
}
/**
@@ -141,7 +140,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
* @param flag flag to set
*/
public void setIncludeAttributeStatement(final boolean flag) {
- includeAttributeStatementPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ includeAttributeStatementPredicate = PredicateSupport.constant(flag);
}
/**
@@ -166,7 +165,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
* @param flag flag to set
*/
public void setForceAuthn(final boolean flag) {
- forceAuthnPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ forceAuthnPredicate = PredicateSupport.constant(flag);
}
/**
@@ -186,7 +185,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
if (methods != null) {
return List.copyOf(methods);
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
@@ -224,7 +223,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
if (flows != null) {
return Set.copyOf(flows);
}
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
/**
@@ -260,7 +259,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
if (flows != null) {
return List.copyOf(flows);
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
@@ -302,7 +301,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML1ArtifactAwarePr
if (formats != null) {
return List.copyOf(formats);
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ArtifactAwareProfileConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ArtifactAwareProfileConfiguration.java
index bb590db3d..a9c078d65 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ArtifactAwareProfileConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ArtifactAwareProfileConfiguration.java
@@ -27,14 +27,13 @@ import org.opensaml.messaging.context.MessageContext;
import org.opensaml.messaging.logic.NoIntegrityMessageChannelPredicate;
import org.opensaml.profile.context.ProfileRequestContext;
-import com.google.common.base.Predicates;
-
import net.shibboleth.idp.saml.profile.config.SAMLArtifactAwareProfileConfiguration;
import net.shibboleth.idp.saml.profile.config.SAMLArtifactConfiguration;
import net.shibboleth.idp.saml.profile.config.SAMLArtifactConsumerProfileConfiguration;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
/**
* Configuration support for artifact-aware profiles.
@@ -103,7 +102,7 @@ public abstract class AbstractSAML2ArtifactAwareProfileConfiguration extends Abs
* @param flag flag to set
*/
public void setSignArtifactRequests(final boolean flag) {
- signArtifactRequestsPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ signArtifactRequestsPredicate = PredicateSupport.constant(flag);
}
/**
@@ -129,7 +128,7 @@ public abstract class AbstractSAML2ArtifactAwareProfileConfiguration extends Abs
* @param flag flag to set
*/
public void setClientTLSArtifactRequests(final boolean flag) {
- clientTLSArtifactRequestsPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ clientTLSArtifactRequestsPredicate = PredicateSupport.constant(flag);
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfiguration.java
index e65369fd6..085e728dc 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfiguration.java
@@ -18,7 +18,6 @@
package net.shibboleth.idp.saml.saml2.profile.config;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
@@ -33,14 +32,14 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
import net.shibboleth.shared.primitive.StringSupport;
import org.opensaml.profile.context.ProfileRequestContext;
-import com.google.common.base.Predicates;
-
/** Base class for SAML 2 profile configurations. */
public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProfileConfiguration implements
SAML2ProfileConfiguration {
@@ -74,11 +73,11 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
public AbstractSAML2ProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
super(profileId);
- ignoreRequestSignaturesPredicate = Predicates.alwaysFalse();
- encryptionOptionalPredicate = Predicates.alwaysFalse();
- encryptAssertionsPredicate = Predicates.alwaysFalse();
- encryptNameIDsPredicate = Predicates.alwaysFalse();
- encryptAttributesPredicate = Predicates.alwaysFalse();
+ ignoreRequestSignaturesPredicate = PredicateSupport.alwaysFalse();
+ encryptionOptionalPredicate = PredicateSupport.alwaysFalse();
+ encryptAssertionsPredicate = PredicateSupport.alwaysFalse();
+ encryptNameIDsPredicate = PredicateSupport.alwaysFalse();
+ encryptAttributesPredicate = PredicateSupport.alwaysFalse();
proxyCountLookupStrategy = FunctionSupport.constant(null);
proxyAudiencesLookupStrategy = FunctionSupport.constant(null);
}
@@ -122,7 +121,7 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
if (audiences != null) {
return Set.copyOf(audiences);
}
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
/**
@@ -164,7 +163,7 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
* @since 4.0.0
*/
public void setIgnoreRequestSignatures(final boolean flag) {
- ignoreRequestSignaturesPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ ignoreRequestSignaturesPredicate = PredicateSupport.constant(flag);
}
/**
@@ -189,7 +188,7 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
* @param flag flag to set
*/
public void setEncryptionOptional(final boolean flag) {
- encryptionOptionalPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ encryptionOptionalPredicate = PredicateSupport.constant(flag);
}
/**
@@ -214,7 +213,7 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
* @param flag flag to set
*/
public void setEncryptAssertions(final boolean flag) {
- encryptAssertionsPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ encryptAssertionsPredicate = PredicateSupport.constant(flag);
}
/**
@@ -239,7 +238,7 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
* @param flag flag to set
*/
public void setEncryptNameIDs(final boolean flag) {
- encryptNameIDsPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ encryptNameIDsPredicate = PredicateSupport.constant(flag);
}
/**
@@ -264,7 +263,7 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
* @param flag flag to set
*/
public void setEncryptAttributes(final boolean flag) {
- encryptAttributesPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ encryptAttributesPredicate = PredicateSupport.constant(flag);
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfiguration.java
index 21b076148..d91f3dac3 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfiguration.java
@@ -20,7 +20,6 @@ package net.shibboleth.idp.saml.saml2.profile.config;
import java.security.Principal;
import java.time.Duration;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
@@ -40,8 +39,12 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
+import net.shibboleth.shared.primitive.DeprecationSupport;
+import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
import net.shibboleth.shared.primitive.StringSupport;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -50,8 +53,6 @@ import org.opensaml.saml.saml2.core.AuthnContext;
import org.opensaml.saml.saml2.core.AuthnContextComparisonTypeEnumeration;
import org.opensaml.saml.saml2.core.SubjectLocality;
-import com.google.common.base.Predicates;
-
/** Configuration support for SAML 2 Browser SSO. */
public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwareProfileConfiguration
implements AuthenticationProfileConfiguration, AttributeResolvingProfileConfiguration {
@@ -149,19 +150,19 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
super(profileId);
setSignResponses(true);
setEncryptAssertions(true);
- resolveAttributesPredicate = Predicates.alwaysTrue();
- includeAttributeStatementPredicate = Predicates.alwaysTrue();
- ignoreScoping = Predicates.alwaysFalse();
+ resolveAttributesPredicate = PredicateSupport.alwaysTrue();
+ includeAttributeStatementPredicate = PredicateSupport.alwaysTrue();
+ ignoreScoping = PredicateSupport.alwaysFalse();
forceAuthnPredicate = new ProxyAwareForceAuthnPredicate();
- checkAddressPredicate = Predicates.alwaysTrue();
- skipEndpointValidationWhenSignedPredicate = Predicates.alwaysFalse();
- proxiedAuthnInstantPredicate = Predicates.alwaysTrue();
- suppressAuthenticatingAuthorityPredicate = Predicates.alwaysFalse();
- requireSignedRequestsPredicate = Predicates.alwaysFalse();
+ checkAddressPredicate = PredicateSupport.alwaysTrue();
+ skipEndpointValidationWhenSignedPredicate = PredicateSupport.alwaysFalse();
+ proxiedAuthnInstantPredicate = PredicateSupport.alwaysTrue();
+ suppressAuthenticatingAuthorityPredicate = PredicateSupport.alwaysFalse();
+ requireSignedRequestsPredicate = PredicateSupport.alwaysFalse();
maximumSPSessionLifetimeLookupStrategy = FunctionSupport.constant(null);
maximumTimeSinceAuthnLookupStrategy = FunctionSupport.constant(null);
maximumTokenDelegationChainLengthLookupStrategy = FunctionSupport.constant(DEFAULT_DELEGATION_CHAIN_LENGTH);
- allowDelegationPredicate = Predicates.alwaysFalse();
+ allowDelegationPredicate = PredicateSupport.alwaysFalse();
authenticationFlowsLookupStrategy = FunctionSupport.constant(null);
postAuthenticationFlowsLookupStrategy = FunctionSupport.constant(null);
authnContextTranslationStrategyLookupStrategy = FunctionSupport.constant(null);
@@ -182,7 +183,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @param flag flag to set
*/
public void setResolveAttributes(final boolean flag) {
- resolveAttributesPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ resolveAttributesPredicate = PredicateSupport.constant(flag);
}
/**
@@ -213,7 +214,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @param flag flag to set
*/
public void setIncludeAttributeStatement(final boolean flag) {
- includeAttributeStatementPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ includeAttributeStatementPredicate = PredicateSupport.constant(flag);
}
/**
@@ -250,7 +251,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @since 4.0.0
*/
public void setIgnoreScoping(final boolean flag) {
- ignoreScoping = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ ignoreScoping = PredicateSupport.constant(flag);
}
/**
@@ -275,7 +276,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @param flag flag to set
*/
public void setForceAuthn(final boolean flag) {
- forceAuthnPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ forceAuthnPredicate = PredicateSupport.constant(flag);
}
/**
@@ -310,7 +311,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @since 4.0.0
*/
public void setCheckAddress(final boolean flag) {
- checkAddressPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ checkAddressPredicate = PredicateSupport.constant(flag);
}
/**
@@ -346,7 +347,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @since 3.4.0
*/
public void setSkipEndpointValidationWhenSigned(final boolean flag) {
- skipEndpointValidationWhenSignedPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ skipEndpointValidationWhenSignedPredicate = PredicateSupport.constant(flag);
}
/**
@@ -386,7 +387,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @since 4.2.0
*/
public void setSuppressAuthenticatingAuthority(final boolean flag) {
- suppressAuthenticatingAuthorityPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ suppressAuthenticatingAuthorityPredicate = PredicateSupport.constant(flag);
}
/**
@@ -425,7 +426,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @since 4.0.0
*/
public void setProxiedAuthnInstant(final boolean flag) {
- proxiedAuthnInstantPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ proxiedAuthnInstantPredicate = PredicateSupport.constant(flag);
}
/**
@@ -461,7 +462,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @since 4.3.0
*/
public void setRequireSignedRequests(final boolean flag) {
- requireSignedRequestsPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ requireSignedRequestsPredicate = PredicateSupport.constant(flag);
}
/**
@@ -567,7 +568,10 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @param profileRequestContext current profile request context
*
* @return predicate used to determine if produced assertions may be delegated
+ *
+ * @deprecated
*/
+ @Deprecated(since="5.0.0", forRemoval=true)
public boolean isAllowDelegation(@Nullable final ProfileRequestContext profileRequestContext) {
return allowDelegationPredicate.test(profileRequestContext);
}
@@ -577,17 +581,25 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* Set whether produced assertions may be delegated.
*
* @param flag flag to set
+ *
+ * @deprecated
*/
+ @Deprecated(since="5.0.0", forRemoval=true)
public void setAllowDelegation(final boolean flag) {
- allowDelegationPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
+ DeprecationSupport.warnOnce(ObjectType.CONFIGURATION, "allowDelegation", "relying-party.xml", null);
+ allowDelegationPredicate = PredicateSupport.constant(flag);
}
/**
* Set the predicate used to determine if produced assertions may be delegated.
*
* @param predicate used to determine if produced assertions may be delegated
+ *
+ * @deprecated
*/
+ @Deprecated(since="5.0.0", forRemoval=true)
public void setAllowDelegationPredicate(@Nonnull final Predicate<ProfileRequestContext> predicate) {
+ DeprecationSupport.warnOnce(ObjectType.CONFIGURATION, "allowDelegationPredicate", "relying-party.xml", null);
allowDelegationPredicate = Constraint.isNotNull(predicate, "Allow delegation predicate cannot be null");
}
@@ -597,7 +609,10 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @param profileRequestContext current profile request context
*
* @return the limit on the total number of delegates that may be derived from the initial SAML token
+ *
+ * @deprecated
*/
+ @Deprecated(since="5.0.0", forRemoval=true)
@NonNegative public long getMaximumTokenDelegationChainLength(
@Nullable final ProfileRequestContext profileRequestContext) {
@@ -612,8 +627,13 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* Set the limits on the total number of delegates that may be derived from the initial SAML token.
*
* @param length the limit on the total number of delegates that may be derived from the initial SAML token
+ *
+ * @deprecated
*/
+ @Deprecated(since="5.0.0", forRemoval=true)
public void setMaximumTokenDelegationChainLength(@NonNegative final long length) {
+ DeprecationSupport.warnOnce(ObjectType.CONFIGURATION, "maximumTokenDelegationChainLength",
+ "relying-party.xml", null);
Constraint.isGreaterThanOrEqual(0, length, "Delegation chain length must be greater than or equal to 0");
maximumTokenDelegationChainLengthLookupStrategy = FunctionSupport.constant(length);
@@ -626,9 +646,14 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
* @param strategy lookup strategy
*
* @since 3.4.0
+ *
+ * @deprecated
*/
+ @Deprecated(since="5.0.0", forRemoval=true)
public void setMaximumTokenDelegationChainLengthLookupStrategy(
@Nonnull final Function<ProfileRequestContext,Long> strategy) {
+ DeprecationSupport.warnOnce(ObjectType.CONFIGURATION, "maximumTokenDelegationChainLengthLookupStrategy",
+ "relying-party.xml", null);
maximumTokenDelegationChainLengthLookupStrategy =
Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
}
@@ -780,7 +805,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
if (methods != null) {
return List.copyOf(methods);
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
@@ -816,7 +841,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
if (flows != null) {
return Set.copyOf(flows);
}
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
/**
@@ -852,7 +877,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
if (flows != null) {
return List.copyOf(flows);
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
@@ -895,7 +920,7 @@ public class BrowserSSOProfileConfiguration extends AbstractSAML2ArtifactAwarePr
if (formats != null) {
return List.copyOf(formats);
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/ECPProfileConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/ECPProfileConfiguration.java
index cb71f5e7e..a04b048ae 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/ECPProfileConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/ECPProfileConfiguration.java
@@ -18,7 +18,6 @@
package net.shibboleth.idp.saml.saml2.profile.config;
import java.util.Collection;
-import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
@@ -31,6 +30,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
import net.shibboleth.shared.primitive.StringSupport;
@@ -58,6 +58,8 @@ public class ECPProfileConfiguration extends BrowserSSOProfileConfiguration {
*/
protected ECPProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
super(profileId);
+
+ localEventsLookupStrategy = FunctionSupport.constant(null);
}
/**
@@ -76,7 +78,7 @@ public class ECPProfileConfiguration extends BrowserSSOProfileConfiguration {
if (events != null) {
return Set.copyOf(events);
}
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
/**
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/CheckAddressPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/CheckAddressPredicate.java
index 057fae5ca..e52345e46 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/CheckAddressPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/CheckAddressPredicate.java
@@ -19,6 +19,7 @@ package net.shibboleth.idp.saml.saml2.profile.config.logic;
import javax.annotation.Nullable;
+import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.logic.AbstractRelyingPartyPredicate;
import net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration;
@@ -39,8 +40,11 @@ public class CheckAddressPredicate extends AbstractRelyingPartyPredicate {
public boolean test(@Nullable final ProfileRequestContext input) {
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null && rpc.getProfileConfig() instanceof BrowserSSOProfileConfiguration) {
- return ((BrowserSSOProfileConfiguration) rpc.getProfileConfig()).isCheckAddress(input);
+ if (rpc != null) {
+ final ProfileConfiguration pc = rpc.getProfileConfig();
+ if (pc instanceof BrowserSSOProfileConfiguration) {
+ return ((BrowserSSOProfileConfiguration) pc).isCheckAddress(input);
+ }
}
return true;
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreRequestSignaturesPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreRequestSignaturesPredicate.java
index ae7e06236..22e4841f2 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreRequestSignaturesPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreRequestSignaturesPredicate.java
@@ -22,12 +22,13 @@ import javax.annotation.Nullable;
import org.opensaml.profile.context.ProfileRequestContext;
+import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.logic.AbstractRelyingPartyPredicate;
import net.shibboleth.idp.saml.saml2.profile.config.SAML2ProfileConfiguration;
+import net.shibboleth.shared.primitive.LoggerFactory;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/** Predicate that decides whether to ignore a request signature. */
public class IgnoreRequestSignaturesPredicate extends AbstractRelyingPartyPredicate {
@@ -39,17 +40,18 @@ public class IgnoreRequestSignaturesPredicate extends AbstractRelyingPartyPredic
public boolean test(@Nullable final ProfileRequestContext input) {
final RelyingPartyContext rpCtx = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpCtx == null) {
+ if (input == null || rpCtx == null) {
log.debug("No RelyingPartyContext found, assuming signatures should be checked");
return false;
}
- if (rpCtx.getProfileConfig() == null || !(rpCtx.getProfileConfig() instanceof SAML2ProfileConfiguration)) {
+ final ProfileConfiguration pc = rpCtx.getProfileConfig();
+ if (!(pc instanceof SAML2ProfileConfiguration)) {
log.debug("No SAML 2 profile configuration found, assuming signatures should be checked");
return false;
}
- return ((SAML2ProfileConfiguration) rpCtx.getProfileConfig()).isIgnoreRequestSignatures(input);
+ return ((SAML2ProfileConfiguration) pc).isIgnoreRequestSignatures(input);
}
}
\ No newline at end of file
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreScopingProfileConfigPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreScopingProfileConfigPredicate.java
index 973b960b9..f90a00bd2 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreScopingProfileConfigPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/IgnoreScopingProfileConfigPredicate.java
@@ -19,6 +19,7 @@ package net.shibboleth.idp.saml.saml2.profile.config.logic;
import javax.annotation.Nullable;
+import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.logic.AbstractRelyingPartyPredicate;
import net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration;
@@ -39,8 +40,11 @@ public class IgnoreScopingProfileConfigPredicate extends AbstractRelyingPartyPre
public boolean test(@Nullable final ProfileRequestContext input) {
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null && rpc.getProfileConfig() instanceof BrowserSSOProfileConfiguration) {
- return ((BrowserSSOProfileConfiguration) rpc.getProfileConfig()).isIgnoreScoping(input);
+ if (rpc != null) {
+ final ProfileConfiguration pc = rpc.getProfileConfig();
+ if (pc instanceof BrowserSSOProfileConfiguration) {
+ return ((BrowserSSOProfileConfiguration) pc).isIgnoreScoping(input);
+ }
}
return false;
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SOAPErrorPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SOAPErrorPredicate.java
index ea73145fb..5f3293a95 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SOAPErrorPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SOAPErrorPredicate.java
@@ -26,13 +26,14 @@ import org.opensaml.profile.context.EventContext;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.profile.context.navigate.CurrentOrPreviousEventLookup;
+import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.logic.AbstractRelyingPartyPredicate;
import net.shibboleth.idp.saml.saml2.profile.config.ECPProfileConfiguration;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Predicate that decides whether to handle an error by returning a SOAP fault to a requester
@@ -74,22 +75,24 @@ public class SOAPErrorPredicate extends AbstractRelyingPartyPredicate {
}
final EventContext eventCtx = eventContextLookupStrategy.apply(input);
- if (eventCtx == null || eventCtx.getEvent() == null) {
+ final Object event = eventCtx != null ? eventCtx.getEvent() : null;
+ if (event == null) {
log.debug("No event found, assuming error handled with SOAP fault");
return true;
}
- if (rpCtx.getProfileConfig() == null || !(rpCtx.getProfileConfig() instanceof ECPProfileConfiguration)) {
+ final ProfileConfiguration pc = rpCtx.getProfileConfig();
+ if (!(pc instanceof ECPProfileConfiguration)) {
log.debug("No ECP profile configuration found, assuming error handled with SOAP fault");
return true;
}
- final String event = eventCtx.getEvent().toString();
- if (((ECPProfileConfiguration) rpCtx.getProfileConfig()).getLocalEvents(input).contains(event)) {
- log.debug("Error event {} will be handled locally", event);
+ final String eventString = event.toString();
+ if (((ECPProfileConfiguration) pc).getLocalEvents(input).contains(eventString)) {
+ log.debug("Error event {} will be handled locally", eventString);
return false;
}
- log.debug("Error event {} will be handled with SOAP fault", event);
+ log.debug("Error event {} will be handled with SOAP fault", eventString);
return true;
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SuppressAuthenticatingAuthorityPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SuppressAuthenticatingAuthorityPredicate.java
index 9d8e2c8ec..cdb1d7673 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SuppressAuthenticatingAuthorityPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/logic/SuppressAuthenticatingAuthorityPredicate.java
@@ -19,6 +19,7 @@ package net.shibboleth.idp.saml.saml2.profile.config.logic;
import javax.annotation.Nullable;
+import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.logic.AbstractRelyingPartyPredicate;
import net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration;
@@ -39,8 +40,11 @@ public class SuppressAuthenticatingAuthorityPredicate extends AbstractRelyingPar
public boolean test(@Nullable final ProfileRequestContext input) {
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null && rpc.getProfileConfig() instanceof BrowserSSOProfileConfiguration) {
- return ((BrowserSSOProfileConfiguration) rpc.getProfileConfig()).isSuppressAuthenticatingAuthority(input);
+ if (rpc != null) {
+ final ProfileConfiguration pc = rpc.getProfileConfig();
+ if (pc instanceof BrowserSSOProfileConfiguration) {
+ return ((BrowserSSOProfileConfiguration) pc).isSuppressAuthenticatingAuthority(input);
+ }
}
return false;
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareAuthnContextComparisonLookupFunction.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareAuthnContextComparisonLookupFunction.java
index 29fe9dc8c..9ef2cc887 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareAuthnContextComparisonLookupFunction.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareAuthnContextComparisonLookupFunction.java
@@ -21,6 +21,7 @@ import java.util.function.Function;
import javax.annotation.Nullable;
+import org.opensaml.messaging.context.BaseContext;
import org.opensaml.profile.context.ProfileRequestContext;
import net.shibboleth.idp.authn.context.AuthenticationContext;
@@ -44,10 +45,14 @@ public class ProxyAwareAuthnContextComparisonLookupFunction implements Function<
/** {@inheritDoc} */
@Nullable public String apply(@Nullable final ProfileRequestContext input) {
- if (input != null && input.getParent() instanceof AuthenticationContext) {
- final RequestedPrincipalContext rpc = input.getParent().getSubcontext(RequestedPrincipalContext.class);
- if (rpc != null) {
- return rpc.getOperator();
+
+ if (input != null) {
+ final BaseContext parent = input.getParent();
+ if (parent instanceof AuthenticationContext) {
+ final RequestedPrincipalContext rpc = parent.getSubcontext(RequestedPrincipalContext.class);
+ if (rpc != null) {
+ return rpc.getOperator();
+ }
}
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareDefaultAuthenticationMethodsLookupFunction.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareDefaultAuthenticationMethodsLookupFunction.java
index 73f356bfd..25f97d0b5 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareDefaultAuthenticationMethodsLookupFunction.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyAwareDefaultAuthenticationMethodsLookupFunction.java
@@ -29,12 +29,14 @@ import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.opensaml.messaging.context.BaseContext;
import org.opensaml.profile.context.ProfileRequestContext;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
import net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.collection.CollectionSupport;
/**
* Implements a set of default logic for determining the custom principals to derive the
@@ -58,7 +60,7 @@ public class ProxyAwareDefaultAuthenticationMethodsLookupFunction
/** Constructor. */
public ProxyAwareDefaultAuthenticationMethodsLookupFunction() {
- principalMappings = Collections.emptyMap();
+ principalMappings = CollectionSupport.emptyMap();
}
/**
@@ -70,7 +72,7 @@ public class ProxyAwareDefaultAuthenticationMethodsLookupFunction
*/
public void setMappings(@Nullable @NonnullElements final Map<Principal,Collection<Principal>> mappings) {
if (mappings == null || mappings.isEmpty()) {
- principalMappings = Collections.emptyMap();
+ principalMappings = CollectionSupport.emptyMap();
return;
}
@@ -79,27 +81,31 @@ public class ProxyAwareDefaultAuthenticationMethodsLookupFunction
}
/** {@inheritDoc} */
- @Nullable public Collection<AuthnContextClassRefPrincipal> apply(@Nullable final ProfileRequestContext input) {
- if (input != null && input.getParent() instanceof AuthenticationContext) {
- final RequestedPrincipalContext rpc = input.getParent().getSubcontext(RequestedPrincipalContext.class);
- if (rpc != null) {
- // Returns a transformed collection of the original principals, replacing any elements
- // found in the multimap with the corresponding (possibly empty) set of replacements.
- return rpc.getRequestedPrincipals().stream()
- .map(p -> {
- if (principalMappings.containsKey(p)) {
- return principalMappings.get(p);
- }
- return Collections.singletonList(p);
- })
- .flatMap(Collection::stream)
- .filter(AuthnContextClassRefPrincipal.class::isInstance)
- .map(AuthnContextClassRefPrincipal.class::cast)
- .collect(Collectors.toUnmodifiableList());
+ @Nonnull @NonnullElements public Collection<AuthnContextClassRefPrincipal> apply(
+ @Nullable final ProfileRequestContext input) {
+ if (input != null) {
+ final BaseContext parent = input.getParent();
+ if (parent instanceof AuthenticationContext) {
+ final RequestedPrincipalContext rpc = parent.getSubcontext(RequestedPrincipalContext.class);
+ if (rpc != null) {
+ // Returns a transformed collection of the original principals, replacing any elements
+ // found in the multimap with the corresponding (possibly empty) set of replacements.
+ return rpc.getRequestedPrincipals().stream()
+ .map(p -> {
+ if (principalMappings.containsKey(p)) {
+ return principalMappings.get(p);
+ }
+ return Collections.singletonList(p);
+ })
+ .flatMap(Collection::stream)
+ .filter(AuthnContextClassRefPrincipal.class::isInstance)
+ .map(AuthnContextClassRefPrincipal.class::cast)
+ .collect(Collectors.toUnmodifiableList());
+ }
}
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
}
\ No newline at end of file
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyCountLookupFunction.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyCountLookupFunction.java
index 59b9b1fb0..7ee817284 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyCountLookupFunction.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyCountLookupFunction.java
@@ -42,7 +42,7 @@ public class ProxyCountLookupFunction extends AbstractRelyingPartyLookupFunction
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
if (rpc != null) {
final ProfileConfiguration pc = rpc.getProfileConfig();
- if (pc != null && pc instanceof SAML2ProfileConfiguration) {
+ if (pc instanceof SAML2ProfileConfiguration) {
return ((SAML2ProfileConfiguration) pc).getProxyCount(input);
}
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyRestrictionLookupFunction.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyRestrictionLookupFunction.java
index 9fda2379a..92bfee697 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyRestrictionLookupFunction.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/navigate/ProxyRestrictionLookupFunction.java
@@ -17,7 +17,6 @@
package net.shibboleth.idp.saml.saml2.profile.config.navigate;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Function;
@@ -32,6 +31,7 @@ import net.shibboleth.idp.profile.config.ProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.context.navigate.AbstractRelyingPartyLookupFunction;
import net.shibboleth.idp.saml.saml2.profile.config.SAML2ProfileConfiguration;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.logic.Constraint;
@@ -65,7 +65,7 @@ public class ProxyRestrictionLookupFunction extends AbstractRelyingPartyLookupFu
// Checkstyle: CyclomaticComplexity|MethodLength OFF
/** {@inheritDoc} */
- @Nullable public Pair<Integer,Set<String>> apply(@Nullable final ProfileRequestContext input) {
+ @Nonnull public Pair<Integer,Set<String>> apply(@Nullable final ProfileRequestContext input) {
// The proxy count is normally set to the minimum of local policy and upstream - 1, but
// null values have to be taken into account, and 0 is the minimum.
@@ -90,7 +90,7 @@ public class ProxyRestrictionLookupFunction extends AbstractRelyingPartyLookupFu
final SubjectContext sc = subjectContextLookupStrategy.apply(input);
final Set<ProxyAuthenticationPrincipal> proxieds =
- sc == null ? Collections.emptySet()
+ sc == null ? CollectionSupport.emptySet()
: sc.getSubjects().stream()
.map(s -> s.getPrincipals(ProxyAuthenticationPrincipal.class))
.flatMap(Set::stream)
@@ -116,7 +116,7 @@ public class ProxyRestrictionLookupFunction extends AbstractRelyingPartyLookupFu
// audiences, and can immediately exit signaling no proxying.
if (audiences.isEmpty()) {
- return new Pair<>(0, Collections.emptySet());
+ return new Pair<>(0, CollectionSupport.emptySet());
}
}
}
@@ -124,11 +124,12 @@ public class ProxyRestrictionLookupFunction extends AbstractRelyingPartyLookupFu
// Given a non-null upstream count, we reduce the local value if necessary, or possibly
// set it for the first time. The max expression just turns -1 back into 0.
- if (p.getProxyCount() != null) {
+ final Integer upstreamCount = p.getProxyCount();
+ if (upstreamCount != null) {
if (proxyCount != null) {
- proxyCount = Integer.min(proxyCount, Integer.max(0, p.getProxyCount() - 1));
+ proxyCount = Integer.min(proxyCount, Integer.max(0, upstreamCount - 1));
} else {
- proxyCount = Integer.max(0, p.getProxyCount() - 1);
+ proxyCount = Integer.max(0, upstreamCount - 1);
}
}
}
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/package-info.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/package-info.java
deleted file mode 100644
index bfe802806..000000000
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/saml2/profile/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** SAML 2 profile actions and classes helping to support them. */
-
-package net.shibboleth.idp.saml.saml2.profile;
\ No newline at end of file
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthenticationMethodPrincipalTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthenticationMethodPrincipalTest.java
index 77f9ee1f9..e1a66bc9d 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthenticationMethodPrincipalTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthenticationMethodPrincipalTest.java
@@ -17,7 +17,6 @@
package net.shibboleth.idp.saml.authn.principal;
-import net.shibboleth.idp.saml.authn.principal.AuthenticationMethodPrincipal;
import net.shibboleth.shared.logic.ConstraintViolationException;
import org.opensaml.saml.saml1.core.AuthenticationStatement;
@@ -39,13 +38,6 @@ public class AuthenticationMethodPrincipalTest {
AuthenticationMethodPrincipal principal2 = principal.clone();
Assert.assertEquals(principal.getName(), principal2.getName());
-
- try {
- new AuthenticationMethodPrincipal(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
try {
new AuthenticationMethodPrincipal("");
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextClassRefPrincipalTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextClassRefPrincipalTest.java
index 012300b70..4222e1a8b 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextClassRefPrincipalTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextClassRefPrincipalTest.java
@@ -17,7 +17,6 @@
package net.shibboleth.idp.saml.authn.principal;
-import net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal;
import net.shibboleth.shared.logic.ConstraintViolationException;
import org.opensaml.core.testing.XMLObjectBaseTestCase;
@@ -48,13 +47,6 @@ public class AuthnContextClassRefPrincipalTest extends XMLObjectBaseTestCase {
AuthnContextClassRefPrincipal principal2 = principal.clone();
assertXMLEquals(xml.getOwnerDocument(), principal2.getAuthnContextClassRef());
-
- try {
- new AuthnContextClassRefPrincipal(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
try {
new AuthnContextClassRefPrincipal("");
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextDeclRefPrincipalTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextDeclRefPrincipalTest.java
index 13d41470c..300e557ae 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextDeclRefPrincipalTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/authn/principal/AuthnContextDeclRefPrincipalTest.java
@@ -17,7 +17,6 @@
package net.shibboleth.idp.saml.authn.principal;
-import net.shibboleth.idp.saml.authn.principal.AuthnContextDeclRefPrincipal;
import net.shibboleth.shared.logic.ConstraintViolationException;
import org.opensaml.core.testing.XMLObjectBaseTestCase;
@@ -47,13 +46,6 @@ public class AuthnContextDeclRefPrincipalTest extends XMLObjectBaseTestCase {
AuthnContextDeclRefPrincipal principal2 = principal.clone();
assertXMLEquals(xml.getOwnerDocument(), principal2.getAuthnContextDeclRef());
-
- try {
- new AuthnContextDeclRefPrincipal(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
try {
new AuthnContextDeclRefPrincipal("");
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfigurationTest.java
index c350855ad..16458513d 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/AbstractSAMLProfileConfigurationTest.java
@@ -24,13 +24,13 @@ import java.util.Set;
import net.shibboleth.shared.logic.ConstraintViolationException;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
import org.testng.Assert;
import org.testng.annotations.Test;
-import com.google.common.base.Predicates;
-
/** Unit test for {@link AbstractSAMLProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class AbstractSAMLProfileConfigurationTest {
@Test public void testSignAssertionsCriteria() {
@@ -38,13 +38,6 @@ public class AbstractSAMLProfileConfigurationTest {
config.setSignAssertions(false);
Assert.assertFalse(config.isSignAssertions(null));
-
- try {
- config.setSignAssertionsPredicate(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
- // excepted this
- }
}
@Test public void testSignResponsesCriteria() {
@@ -52,13 +45,6 @@ public class AbstractSAMLProfileConfigurationTest {
config.setSignResponses(false);
Assert.assertFalse(config.isSignResponses(null));
-
- try {
- config.setSignResponsesPredicate(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
- // excepted this
- }
}
@Test public void testSignRequestsCriteria() {
@@ -66,13 +52,6 @@ public class AbstractSAMLProfileConfigurationTest {
config.setSignRequests(false);
Assert.assertFalse(config.isSignRequests(null));
-
- try {
- config.setSignRequestsPredicate(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
- // excepted this
- }
}
@Test public void testAssertionLifetime() {
@@ -122,7 +101,7 @@ public class AbstractSAMLProfileConfigurationTest {
@Test public void testIndirectIncludeNotBefore() {
final MockSAMLProfileConfiguration config = new MockSAMLProfileConfiguration();
- config.setIncludeConditionsNotBeforePredicate(Predicates.alwaysFalse());
+ config.setIncludeConditionsNotBeforePredicate(PredicateSupport.alwaysFalse());
Assert.assertFalse(config.isIncludeConditionsNotBefore(null));
}
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfigurationTest.java
index ba79e169a..8dfad2a57 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/profile/config/BasicSAMLArtifactConfigurationTest.java
@@ -21,6 +21,7 @@ import org.testng.Assert;
import org.testng.annotations.Test;
/** Unit test for {@link BasicSAMLArtifactConfiguration}. */
+ at SuppressWarnings("javadoc")
public class BasicSAMLArtifactConfigurationTest {
@Test public void testArtifactType() {
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/ArtifactResolutionProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/ArtifactResolutionProfileConfigurationTest.java
index 21a7af16f..c720e1aa0 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/ArtifactResolutionProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/ArtifactResolutionProfileConfigurationTest.java
@@ -17,12 +17,12 @@
package net.shibboleth.idp.saml.saml1.profile.config;
-import net.shibboleth.idp.saml.saml1.profile.config.ArtifactResolutionProfileConfiguration;
import org.testng.Assert;
import org.testng.annotations.Test;
/** Unit test for {@link ArtifactResolutionProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class ArtifactResolutionProfileConfigurationTest {
@Test
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/AttributeQueryProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/AttributeQueryProfileConfigurationTest.java
index 0bd6e68f4..57c1980d3 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/AttributeQueryProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/AttributeQueryProfileConfigurationTest.java
@@ -19,7 +19,6 @@ package net.shibboleth.idp.saml.saml1.profile.config;
import net.shibboleth.idp.saml.profile.config.BasicSAMLArtifactConfiguration;
import net.shibboleth.idp.saml.profile.config.SAMLArtifactConfiguration;
-import net.shibboleth.idp.saml.saml1.profile.config.AttributeQueryProfileConfiguration;
import net.shibboleth.shared.logic.FunctionSupport;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -27,6 +26,7 @@ import org.testng.Assert;
import org.testng.annotations.Test;
/** Unit test for {@link AttributeQueryProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class AttributeQueryProfileConfigurationTest {
@Test
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfigurationTest.java
index 7242a1365..fbbec670d 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml1/profile/config/BrowserSSOProfileConfigurationTest.java
@@ -20,18 +20,17 @@ package net.shibboleth.idp.saml.saml1.profile.config;
import net.shibboleth.idp.saml.authn.principal.AuthenticationMethodPrincipal;
import net.shibboleth.idp.saml.profile.config.BasicSAMLArtifactConfiguration;
import net.shibboleth.idp.saml.profile.config.SAMLArtifactConfiguration;
-import net.shibboleth.idp.saml.saml1.profile.config.BrowserSSOProfileConfiguration;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
import org.opensaml.profile.context.ProfileRequestContext;
import org.testng.Assert;
import org.testng.annotations.Test;
-import com.google.common.base.Predicates;
-
import java.util.*;
/** Unit test for {@link BrowserSSOProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class BrowserSSOProfileConfigurationTest {
@Test
@@ -55,7 +54,7 @@ public class BrowserSSOProfileConfigurationTest {
public void testIndirectResolveAttributes(){
final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
- config.setResolveAttributesPredicate(Predicates.alwaysFalse());
+ config.setResolveAttributesPredicate(PredicateSupport.alwaysFalse());
Assert.assertFalse(config.isResolveAttributes(null));
}
@@ -72,7 +71,7 @@ public class BrowserSSOProfileConfigurationTest {
public void testIndirectIncludeAttributeStatement(){
final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
- config.setIncludeAttributeStatementPredicate(Predicates.alwaysTrue());
+ config.setIncludeAttributeStatementPredicate(PredicateSupport.alwaysTrue());
Assert.assertTrue(config.isIncludeAttributeStatement(null));
}
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfigurationTest.java
index a93e8aa42..ef197b48e 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AbstractSAML2ProfileConfigurationTest.java
@@ -20,15 +20,14 @@ package net.shibboleth.idp.saml.saml2.profile.config;
import java.util.HashSet;
import java.util.Set;
-import net.shibboleth.shared.logic.ConstraintViolationException;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
import org.testng.Assert;
import org.testng.annotations.Test;
-import com.google.common.base.Predicates;
-
/** Unit test for {@link AbstractSAML2ProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class AbstractSAML2ProfileConfigurationTest {
@Test
@@ -44,7 +43,7 @@ public class AbstractSAML2ProfileConfigurationTest {
public void testIndirectEncryptionOptional(){
final MockSAML2ProfileConfiguration config = new MockSAML2ProfileConfiguration();
- config.setEncryptionOptionalPredicate(Predicates.alwaysTrue());
+ config.setEncryptionOptionalPredicate(PredicateSupport.alwaysTrue());
Assert.assertTrue(config.isEncryptionOptional(null));
}
@@ -53,13 +52,6 @@ public class AbstractSAML2ProfileConfigurationTest {
config.setEncryptNameIDs(true);
Assert.assertTrue(config.isEncryptNameIDs(null));
-
- try {
- config.setEncryptNameIDsPredicate(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
- // excepted this
- }
}
@Test public void testEncryptAssertionsPredicate() {
@@ -67,13 +59,6 @@ public class AbstractSAML2ProfileConfigurationTest {
config.setEncryptAssertions(true);
Assert.assertTrue(config.isEncryptAssertions(null));
-
- try {
- config.setEncryptAssertionsPredicate(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
- // excepted this
- }
}
@Test public void testEncryptAttributesPredicate() {
@@ -81,13 +66,6 @@ public class AbstractSAML2ProfileConfigurationTest {
config.setEncryptAttributes(true);
Assert.assertTrue(config.isEncryptAttributes(null));
-
- try {
- config.setEncryptAttributesPredicate(null);
- Assert.fail();
- } catch (ConstraintViolationException e) {
- // excepted this
- }
}
@Test public void testProxyCount() {
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/ArtifactResolutionProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/ArtifactResolutionProfileConfigurationTest.java
index c581887a2..830a06960 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/ArtifactResolutionProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/ArtifactResolutionProfileConfigurationTest.java
@@ -21,6 +21,7 @@ import org.testng.Assert;
import org.testng.annotations.Test;
/** Unit test for {@link ArtifactResolutionProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class ArtifactResolutionProfileConfigurationTest {
@Test
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AttributeQueryProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AttributeQueryProfileConfigurationTest.java
index 5a6dcde7e..6f5bf9598 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AttributeQueryProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/AttributeQueryProfileConfigurationTest.java
@@ -25,6 +25,7 @@ import net.shibboleth.idp.saml.profile.config.SAMLArtifactConfiguration;
import net.shibboleth.shared.logic.FunctionSupport;
/** Unit test for {@link AttributeQueryProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class AttributeQueryProfileConfigurationTest {
@Test
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfigurationTest.java
index 43233f007..7153a6d5c 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/BrowserSSOProfileConfigurationTest.java
@@ -20,23 +20,21 @@ package net.shibboleth.idp.saml.saml2.profile.config;
import net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal;
import net.shibboleth.idp.saml.profile.config.BasicSAMLArtifactConfiguration;
import net.shibboleth.idp.saml.profile.config.SAMLArtifactConfiguration;
-import net.shibboleth.shared.logic.ConstraintViolationException;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
import java.time.Duration;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.function.Predicate;
-import org.opensaml.profile.context.ProfileRequestContext;
import org.testng.Assert;
import org.testng.annotations.Test;
-import com.google.common.base.Predicates;
/** Unit test for {@link BrowserSSOProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class BrowserSSOProfileConfigurationTest {
@Test
@@ -60,7 +58,7 @@ public class BrowserSSOProfileConfigurationTest {
public void testIndirectResolveAttributes(){
final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
- config.setResolveAttributesPredicate(Predicates.alwaysFalse());
+ config.setResolveAttributesPredicate(PredicateSupport.alwaysFalse());
Assert.assertFalse(config.isResolveAttributes(null));
}
@@ -77,7 +75,7 @@ public class BrowserSSOProfileConfigurationTest {
public void testIndirectIncludeAttributeStatement(){
final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
- config.setIncludeAttributeStatementPredicate(Predicates.alwaysFalse());
+ config.setIncludeAttributeStatementPredicate(PredicateSupport.alwaysFalse());
Assert.assertFalse(config.isIncludeAttributeStatement(null));
}
@@ -94,7 +92,7 @@ public class BrowserSSOProfileConfigurationTest {
public void testIndirectEndpointValidationWhenSigned(){
final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
- config.setSkipEndpointValidationWhenSignedPredicate(Predicates.alwaysTrue());
+ config.setSkipEndpointValidationWhenSignedPredicate(PredicateSupport.alwaysTrue());
Assert.assertTrue(config.isSkipEndpointValidationWhenSigned(null));
}
@@ -114,40 +112,6 @@ public class BrowserSSOProfileConfigurationTest {
config.setMaximumSPSessionLifetimeLookupStrategy(FunctionSupport.constant(Duration.ofSeconds(1)));
Assert.assertEquals(config.getMaximumSPSessionLifetime(null), Duration.ofSeconds(1));
}
-
- @Test
- public void testAllowDelegation() {
- final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
- Assert.assertFalse(config.isAllowDelegation(null));
-
- final Predicate<ProfileRequestContext> predicate = Predicates.alwaysTrue();
- config.setAllowDelegationPredicate(predicate);
- Assert.assertTrue(config.isAllowDelegation(null));
-
- try {
- config.setAllowDelegationPredicate(null);
- Assert.fail("Null predicate should not have been allowed");
- } catch (ConstraintViolationException e) {
- // expected, do nothing
- }
- }
-
- @Test
- public void testMaximumTokenDelegationChainLength(){
- final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
- Assert.assertEquals(config.getMaximumTokenDelegationChainLength(null), 1);
-
- config.setMaximumTokenDelegationChainLength(10);
- Assert.assertEquals(config.getMaximumTokenDelegationChainLength(null), 10);
- }
-
- @Test
- public void testIndirectMaximumTokenDelegationChainLength(){
- final BrowserSSOProfileConfiguration config = new BrowserSSOProfileConfiguration();
-
- config.setMaximumTokenDelegationChainLengthLookupStrategy(FunctionSupport.constant(10L));
- Assert.assertEquals(config.getMaximumTokenDelegationChainLength(null), 10);
- }
@Test
public void testArtifactConfiguration() {
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/SingleLogoutProfileConfigurationTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/SingleLogoutProfileConfigurationTest.java
index 5472c6dc8..64abe2101 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/SingleLogoutProfileConfigurationTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/saml2/profile/config/SingleLogoutProfileConfigurationTest.java
@@ -25,6 +25,7 @@ import net.shibboleth.idp.saml.profile.config.SAMLArtifactConfiguration;
import net.shibboleth.shared.logic.FunctionSupport;
/** Unit test for {@link SingleLogoutProfileConfiguration}. */
+ at SuppressWarnings("javadoc")
public class SingleLogoutProfileConfigurationTest {
@Test
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/session/SAML2SPSessionTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/session/SAML2SPSessionTest.java
index 584846922..438497a7c 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/session/SAML2SPSessionTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/session/SAML2SPSessionTest.java
@@ -25,8 +25,6 @@ import org.opensaml.saml.saml2.core.NameID;
import org.testng.Assert;
import org.testng.annotations.Test;
-import net.shibboleth.shared.logic.ConstraintViolationException;
-
/** {@link SAML2SPSession} unit test. */
public class SAML2SPSessionTest extends OpenSAMLInitBaseTestCase {
@@ -55,55 +53,6 @@ public class SAML2SPSessionTest extends OpenSAMLInitBaseTestCase {
Assert.assertEquals(session.getSPSessionKey(), "joe at example.org");
Assert.assertEquals(session.getACSLocation(), "https://sp.example.org/acs");
Assert.assertFalse(session.supportsLogoutPropagation());
-
- try {
- new SAML2SPSession(null, Instant.ofEpochMilli(0), Instant.ofEpochMilli(0), null, null, null, true);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
-
- try {
- new SAML2SPSession("", Instant.ofEpochMilli(0), Instant.ofEpochMilli(0), null, null, null, true);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
-
- try {
- new SAML2SPSession(" ", Instant.ofEpochMilli(0), Instant.ofEpochMilli(0), null, null, null, true);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
-
- try {
- new SAML2SPSession("foo", Instant.ofEpochMilli(0), Instant.ofEpochMilli(0), null, null, null, true);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
-
- try {
- new SAML2SPSession("foo", start, Instant.ofEpochMilli(0), null, null, null, true);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
-
- try {
- new SAML2SPSession("foo", start, start, null, null, null, true);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
-
- try {
- new SAML2SPSession("foo", start, start, nameID, null, null, true);
- Assert.fail();
- } catch (ConstraintViolationException e) {
-
- }
}
}
\ No newline at end of file
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/BasicSPSession.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/BasicSPSession.java
index f4749ccbc..6fdeaa67a 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/BasicSPSession.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/BasicSPSession.java
@@ -96,7 +96,7 @@ public class BasicSPSession implements SPSession {
}
/** {@inheritDoc} */
- public boolean equals(@Nullable final Object obj) {
+ public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list