[java-opensaml COMMIT] in /trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context: Abstract...
noreply at shibboleth.net
noreply at shibboleth.net
Fri May 10 21:55:16 EDT 2013
Author: putmanb
Date: Fri May 10 21:55:15 2013
New Revision: 3338
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3338&view=rev
Log:
Add some view-like support to SAML peer entity context for dynamically resolving the entity ID from the message context.
Modified:
trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/AbstractSamlEntityContext.java
trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/SamlPeerEntityContext.java
Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/AbstractSamlEntityContext.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/AbstractSamlEntityContext.java?rev=3338&r1=3337&r2=3338&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/AbstractSamlEntityContext.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/AbstractSamlEntityContext.java Fri May 10 21:55:15 2013
@@ -21,6 +21,7 @@
import javax.xml.namespace.QName;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
import org.opensaml.messaging.context.BaseContext;
@@ -51,7 +52,7 @@
* @param id the new entityId
*/
public void setEntityId(@Nullable final String id) {
- entityId = id;
+ entityId = StringSupport.trimOrNull(id);
}
/**
Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/SamlPeerEntityContext.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/SamlPeerEntityContext.java?rev=3338&r1=3337&r2=3338&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/SamlPeerEntityContext.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/context/SamlPeerEntityContext.java Fri May 10 21:55:15 2013
@@ -17,12 +17,301 @@
package org.opensaml.saml.common.messaging.context;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.saml.common.SAMLObject;
+import org.opensaml.saml.saml1.core.Assertion;
+import org.opensaml.saml.saml1.core.AssertionArtifact;
+import org.opensaml.saml.saml1.core.AttributeQuery;
+import org.opensaml.saml.saml1.core.AuthorizationDecisionQuery;
+import org.opensaml.saml.saml2.core.Issuer;
+import org.opensaml.saml.saml2.core.NameIDType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Subcontext that carries information about a SAML peer entity. This context will often
* contain subcontexts, whose data is construed to be scoped to that peer entity.
+ *
+ * <p>
+ * The method {@link #getEntityId()} will attempt to dynamically resolve the appropriate data
+ * from the SAML message held in the message context if the data has not been set statically
+ * by the corresponding setter method. This evaluation will be attempted only if the this
+ * context instance is an immediate child of the message context, as returned by {@link #getParent()}.
+ * </p>
*/
public class SamlPeerEntityContext extends AbstractAuthenticatableSamlEntityContext {
+ /** Logger. */
+ private Logger log = LoggerFactory.getLogger(SamlPeerEntityContext.class);
+
+ /** Whether to use the resource of SAML 1 queries to resolve the entity ID. */
+ private boolean useSaml1QueryResourceAsEntityId;
+
+
+ /** Constructor. */
+ public SamlPeerEntityContext() {
+ super();
+ useSaml1QueryResourceAsEntityId = true;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public String getEntityId() {
+ if (super.getEntityId() == null) {
+ setEntityId(resolveEntityId());
+ }
+ return super.getEntityId();
+ }
+
+ /**
+ * Gets whether to use the Resource attribute of some SAML 1 queries to resolve the entity
+ * ID.
+ *
+ * @return whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID
+ */
+ public boolean getUseSaml1QueryResourceAsEntityId() {
+ return useSaml1QueryResourceAsEntityId;
+ }
+
+ /**
+ * Sets whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID.
+ *
+ * @param useResource whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID
+ */
+ public void setUseSaml1QueryResourceAsEntityId(boolean useResource) {
+ useSaml1QueryResourceAsEntityId = useResource;
+ }
+
+ /**
[... 226 lines stripped ...]
More information about the commits
mailing list