[java-identity-provider COMMIT] in /trunk/idp-attribute-resolver-impl/src: main/java/edu/internet2/middleware/shibbol...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Apr 1 04:49:10 EDT 2013
Author: rdw
Date: Mon Apr 1 04:49:10 2013
New Revision: 4375
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4375&view=rev
Log:
IDP-206 Add in support for the V2 context and tests
Added:
trunk/idp-attribute-resolver-impl/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/V2SAMLProfileRequestContext.java (with props)
trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/requestContext.script
Modified:
trunk/idp-attribute-resolver-impl/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/BasicAttribute.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ScriptedAttributeDefinition.java
trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/ad/ScriptedAttributeTest.java
Modified: trunk/idp-attribute-resolver-impl/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/BasicAttribute.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/BasicAttribute.java?rev=4375&r1=4374&r2=4375&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/BasicAttribute.java (original)
+++ trunk/idp-attribute-resolver-impl/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/BasicAttribute.java Mon Apr 1 04:49:10 2013
@@ -17,20 +17,29 @@
package edu.internet2.middleware.shibboleth.common.attribute.provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import net.shibboleth.idp.attribute.Attribute;
import net.shibboleth.idp.attribute.resolver.impl.ad.ScriptedAttribute;
/**
- * A class which is here solely to provide compatibility for V2 scripted attribute definitions.
- * The assumption is that a constructor will be called with a string and that only {@link #getValues()}
- * would be called from then on.
+ * A class which is here solely to provide compatibility for V2 scripted attribute definitions. The assumption is that a
+ * constructor will be called with a string and that only {@link #getValues()} would be called from then on.
*/
-public class BasicAttribute extends ScriptedAttribute{
+public class BasicAttribute extends ScriptedAttribute {
+
+ /** Log. */
+ private Logger log = LoggerFactory.getLogger(BasicAttribute.class);
+
/**
* Constructor.
+ *
* @param id The attribute Id.
*/
public BasicAttribute(String id) {
super(new Attribute(id));
+ log.info("Scripted Attribute Definition: {} Use of V2 emulated class \""
+ + "BasicAttribute\", consider replacing this code", id);
}
}
Modified: trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ScriptedAttributeDefinition.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ScriptedAttributeDefinition.java?rev=4375&r1=4374&r2=4375&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ScriptedAttributeDefinition.java (original)
+++ trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ScriptedAttributeDefinition.java Mon Apr 1 04:49:10 2013
@@ -43,6 +43,8 @@
import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
+
+import edu.internet2.middleware.shibboleth.common.attribute.provider.V2SAMLProfileRequestContext;
/**
* An {@link BaseAttributeDefinition} that executes a script in order to populate the values of the generated attribute.
@@ -114,12 +116,12 @@
}
if (result instanceof ScriptedAttribute) {
-
+
ScriptedAttribute scriptedAttribute = (ScriptedAttribute) result;
return Optional.of(scriptedAttribute.getResultingAttribute());
-
+
} else {
-
+
throw new ResolutionException("AttributeDefinition '" + getId() + "'returned variable was of wrong type ("
+ result.getClass().toString() + ")");
}
@@ -164,6 +166,10 @@
log.debug("Attribute definition '{}': adding current attribute resolution context to script context", getId());
scriptContext.setAttribute("resolutionContext", resolutionContext, ScriptContext.ENGINE_SCOPE);
+ log.debug("Attribute definition '{}': adding emulated V2 request context context to script context", getId());
+ scriptContext.setAttribute("requestContext", new V2SAMLProfileRequestContext(resolutionContext, getId()),
+ ScriptContext.ENGINE_SCOPE);
+
[... 108 lines stripped ...]
More information about the commits
mailing list