[java-identity-provider] branch master updated: Add customObject hook to templates.
Scott Cantor
cantor.2 at osu.edu
Wed Jan 3 18:10:38 EST 2018
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=6be176cf184c862531c1fbef9a7feaf9889cd4aa
The following commit(s) were added to refs/heads/master by this push:
new 6be176c Add customObject hook to templates.
6be176c is described below
commit 6be176cf184c862531c1fbef9a7feaf9889cd4aa
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jan 3 18:10:36 2018 -0500
Add customObject hook to templates.
---
.../resolver/dc/http/impl/TemplatedBodyBuilder.java | 16 ++++++++++++++++
.../resolver/dc/http/impl/TemplatedURLBuilder.java | 19 ++++++++++++++++++-
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java
index 6d634be..8a200bb 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java
@@ -109,6 +109,9 @@ public class TemplatedBodyBuilder extends AbstractHTTPSearchBuilder {
/** Escaper for XML content. */
@Nonnull private final Escaper xmlContentEscaper;
+
+ /** A custom object to inject into the template. */
+ @Nullable private Object customObject;
/** Constructor. */
public TemplatedBodyBuilder() {
@@ -275,6 +278,18 @@ public class TemplatedBodyBuilder extends AbstractHTTPSearchBuilder {
charset = StringSupport.trimOrNull(c);
}
+ /**
+ * Set the custom (externally provided) object.
+ *
+ * @param object the custom object
+ */
+ public void setCustomObject(@Nullable final Object object) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
+ customObject = object;
+ }
+
/** {@inheritDoc} */
@Override protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
@@ -327,6 +342,7 @@ public class TemplatedBodyBuilder extends AbstractHTTPSearchBuilder {
context.put("pathEscaper", pathEscaper);
context.put("xmlAttributeEscaper", xmlAttributeEscaper);
context.put("xmlContentEscaper", xmlContentEscaper);
+ context.put("custom", customObject);
// inject dependencies
if (dependencyAttributes != null && !dependencyAttributes.isEmpty()) {
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java
index 61e2ee9..cc0a646 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java
@@ -71,7 +71,10 @@ public class TemplatedURLBuilder extends AbstractHTTPSearchBuilder {
/** Escaper for path segments. */
@Nonnull private final Escaper pathEscaper;
-
+
+ /** A custom object to inject into the template. */
+ @Nullable private Object customObject;
+
/** Constructor. */
public TemplatedURLBuilder() {
paramEscaper = UrlEscapers.urlFormParameterEscaper();
@@ -130,6 +133,19 @@ public class TemplatedURLBuilder extends AbstractHTTPSearchBuilder {
engine = Constraint.isNotNull(velocityEngine, "Velocity engine cannot be null");
}
+
+ /**
+ * Set the custom (externally provided) object.
+ *
+ * @param object the custom object
+ */
+ public void setCustomObject(@Nullable final Object object) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
+ customObject = object;
+ }
+
/** {@inheritDoc} */
@Override protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
@@ -171,6 +187,7 @@ public class TemplatedURLBuilder extends AbstractHTTPSearchBuilder {
context.put("paramEscaper", paramEscaper);
context.put("fragmentEscaper", fragmentEscaper);
context.put("pathEscaper", pathEscaper);
+ context.put("custom", customObject);
// inject dependencies
if (dependencyAttributes != null && !dependencyAttributes.isEmpty()) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list