[java-identity-provider] branch maint-4 updated: IDP-1999 - Metadata tag functions explicitly take full Attribute name
Scott Cantor
cantor.2 at osu.edu
Mon Aug 29 12:33:09 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch maint-4
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=2a3170c2226d21c586cbd035381857939cde3c34
The following commit(s) were added to refs/heads/maint-4 by this push:
new 2a3170c22 IDP-1999 - Metadata tag functions explicitly take full Attribute name
2a3170c22 is described below
commit 2a3170c2226d21c586cbd035381857939cde3c34
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Aug 29 08:33:05 2022 -0400
IDP-1999 - Metadata tag functions explicitly take full Attribute name
https://shibboleth.atlassian.net/browse/IDP-1999
---
...tMetadataDrivenConfigurationLookupStrategy.java | 56 ++++++++++++++++++----
1 file changed, 47 insertions(+), 9 deletions(-)
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 39775461e..26044ab9d 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
@@ -100,6 +100,9 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
/** Examine only decoded/mapped tags in object metadata. */
private boolean ignoreUnmappedEntityAttributes;
+ /** Prevents prefixing of property name by profile/aliases. */
+ private boolean explicitPropertyName;
+
/** Base name of property to produce. */
@NonnullAfterInit @NotEmpty private String propertyName;
@@ -130,6 +133,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setStrictNameFormat(final boolean flag) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
strictNameFormat = flag;
}
@@ -143,6 +147,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setEnableCaching(final boolean flag) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
enableCaching = flag;
}
@@ -157,10 +162,29 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setIgnoreUnmappedEntityAttributes(final boolean flag) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
ignoreUnmappedEntityAttributes = flag;
}
+ /**
+ * Sets whether to treat the property name as absolute instead of auto-prefixed
+ * by profile or alias values.
+ *
+ * <p>Used to allow for direct lookup of a specific tag instead implicitly prefixing the
+ * tag name based on configuration "context".</p>
+ *
+ * @param flag flag to set
+ *
+ * @since 4.3.0
+ */
+ public void setExplicitPropertyName(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
+ explicitPropertyName = flag;
+ }
+
/**
* Sets the "base" name of the property/setting to derive.
*
@@ -168,6 +192,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setPropertyName(@Nonnull @NotEmpty final String name) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
propertyName = Constraint.isNotNull(StringSupport.trimOrNull(name), "Property name cannot be null or empty");
}
@@ -182,6 +207,8 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setProfileAliases(@Nonnull @NonnullElements final Collection<String> aliases) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
Constraint.isNotNull(aliases, "Alias collection cannot be null");
propertyAliases = List.copyOf(StringSupport.normalizeStringCollection(aliases));
@@ -194,6 +221,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setDefaultValue(@Nullable final T value) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
defaultValueStrategy = FunctionSupport.constant(value);
}
@@ -207,6 +235,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setDefaultValueStrategy(@Nonnull final Function<BaseContext,T> strategy) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
defaultValueStrategy = Constraint.isNotNull(strategy, "Default value strategy cannot be null");
}
@@ -218,6 +247,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setMetadataLookupStrategy(@Nonnull final Function<BaseContext,EntityDescriptor> strategy) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
metadataLookupStrategy = Constraint.isNotNull(strategy, "Metadata lookup strategy cannot be null");
}
@@ -229,6 +259,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
*/
public void setProfileIdLookupStrategy(@Nonnull final Function<BaseContext,String> strategy) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
profileIdLookupStrategy = Constraint.isNotNull(strategy, "Profile ID lookup strategy cannot be null");
}
@@ -255,6 +286,7 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
/** {@inheritDoc} */
@Nullable public T apply(@Nullable final BaseContext input) {
ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
CachedConfigurationContext cacheContext = null;
@@ -284,18 +316,23 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
return defaultValueStrategy.apply(input);
}
- if (profileIdLookupStrategy != null) {
- profileId = profileIdLookupStrategy.apply(input);
- } else if (input instanceof ProfileRequestContext) {
- profileId = DEFAULT_PRC_PROFILE_ID_LOOKUP.apply((ProfileRequestContext) input);
- } else if (input instanceof MessageContext) {
- profileId = DEFAULT_MC_PROFILE_ID_LOOKUP.apply((MessageContext) input);
+ if (!explicitPropertyName) {
+ if (profileIdLookupStrategy != null) {
+ profileId = profileIdLookupStrategy.apply(input);
+ } else if (input instanceof ProfileRequestContext) {
+ profileId = DEFAULT_PRC_PROFILE_ID_LOOKUP.apply((ProfileRequestContext) input);
+ } else if (input instanceof MessageContext) {
+ profileId = DEFAULT_MC_PROFILE_ID_LOOKUP.apply((MessageContext) input);
+ } else {
+ profileId = "";
+ }
} else {
- profileId = "";
+ profileId = null;
}
// Look for "primary" tag name based on profile/property using mapped tags.
- IdPAttribute idpAttribute = findMatchingMappedTag(entity, profileId + '/' + propertyName);
+ IdPAttribute idpAttribute = findMatchingMappedTag(entity,
+ profileId != null ? profileId + '/' + propertyName : propertyName);
if (idpAttribute != null) {
log.debug("Found matching tag '{}' for property '{}'", idpAttribute.getId(), propertyName);
final T result = translate(idpAttribute);
@@ -328,7 +365,8 @@ public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> exten
}
// Look for "primary" tag name based on profile/property.
- Attribute attribute = findMatchingTag(entity, profileId + '/' + propertyName);
+ Attribute attribute = findMatchingTag(entity,
+ profileId != null ? profileId + '/' + propertyName : propertyName);
if (attribute != null) {
log.debug("Found matching tag '{}' for property '{}'", attribute.getName(), propertyName);
final T result = translate(attribute);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list