[java-identity-provider COMMIT] /trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttribut...
noreply at shibboleth.net
noreply at shibboleth.net
Thu May 26 12:09:08 EDT 2016
Author: scantor
Date: Thu May 26 12:09:07 2016
New Revision: 8260
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8260&view=rev
Log:
Allow flows to populate AttributeResolutionContext externally.
Modified:
trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java?rev=8260&r1=8259&r2=8260&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java Thu May 26 12:09:07 2016
@@ -91,6 +91,9 @@
/** Whether to treat resolver errors as equivalent to resolving no attributes. */
private boolean maskFailures;
+
+ /** Whether to create and populate {@link AttributeResolutionContext}. */
+ private boolean createResolutionContext;
/** AuthenticationContext to work from (if any). */
@Nullable private AuthenticationContext authenticationContext;
@@ -120,6 +123,7 @@
Collections.<String>emptyList());
maskFailures = true;
+ createResolutionContext = true;
}
/**
@@ -219,6 +223,19 @@
maskFailures = flag;
}
+
+ /**
+ * Set whether to create the {@link AttributeResolutionContext} internally.
+ *
+ * <p>Defaults to 'true', disable to allow external creation of the context.</p>
+ *
+ * @param flag flag to set
+ */
+ public void setCreateResolutionContext(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ createResolutionContext = flag;
+ }
/** {@inheritDoc} */
@Override
@@ -243,12 +260,20 @@
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
- // Get the resolution context from the profile request
- // this may already exist but if not, auto-create it
- final AttributeResolutionContext resolutionContext =
- profileRequestContext.getSubcontext(AttributeResolutionContext.class, true);
-
- populateResolutionContext(profileRequestContext, resolutionContext);
+ final AttributeResolutionContext resolutionContext;
+ if (createResolutionContext) {
+ resolutionContext = profileRequestContext.getSubcontext(AttributeResolutionContext.class, true);
+ populateResolutionContext(profileRequestContext, resolutionContext);
+ } else {
+ resolutionContext = profileRequestContext.getSubcontext(AttributeResolutionContext.class);
+ if (resolutionContext == null) {
+ log.error("{} Unable to locate AttributeResolutionContext", getLogPrefix());
+ if (!maskFailures) {
+ ActionSupport.buildEvent(profileRequestContext, IdPEventIds.UNABLE_RESOLVE_ATTRIBS);
+ }
+ return;
+ }
+ }
ServiceableComponent<AttributeResolver> component = null;
try {
More information about the commits
mailing list