[java-identity-provider] branch main updated: Add a generic function for accessing flow scope variables.
Scott Cantor
cantor.2 at osu.edu
Fri Mar 11 17:17:46 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=75603a5b028873bf353c316e9037778e24bd0f0c
The following commit(s) were added to refs/heads/main by this push:
new 75603a5b0 Add a generic function for accessing flow scope variables.
75603a5b0 is described below
commit 75603a5b028873bf353c316e9037778e24bd0f0c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Mar 11 12:17:09 2022 -0500
Add a generic function for accessing flow scope variables.
---
.../function/SpringFlowScopeLookupFunction.java | 69 ++++++++++++++++++++++
.../idp/profile/function/package-info.java | 22 +++++++
2 files changed, 91 insertions(+)
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/function/SpringFlowScopeLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/function/SpringFlowScopeLookupFunction.java
new file mode 100644
index 000000000..16731d013
--- /dev/null
+++ b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/function/SpringFlowScopeLookupFunction.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.profile.function;
+
+import java.util.function.Function;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.springframework.webflow.execution.RequestContext;
+
+import net.shibboleth.idp.profile.context.SpringRequestContext;
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
+/**
+ * A lookup function that fetches a SWF flow scope parameters.
+ *
+ * @since 4.2.0
+ */
+public class SpringFlowScopeLookupFunction implements Function<ProfileRequestContext,String> {
+
+ /** Parameter name. */
+ @Nonnull @NotEmpty private final String paramName;
+
+ /**
+ * Constructor.
+ *
+ * @param name parameter name
+ */
+ public SpringFlowScopeLookupFunction(@Nonnull @NotEmpty @ParameterName(name="name") final String name) {
+ paramName = Constraint.isNotNull(StringSupport.trimOrNull(name), "Parameter name cannot be null");
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public String apply(final @Nullable ProfileRequestContext profileRequestContext) {
+ final SpringRequestContext springRequestContext =
+ profileRequestContext != null ? profileRequestContext.getSubcontext(SpringRequestContext.class) : null;
+ if (springRequestContext == null) {
+ return null;
+ }
+
+ final RequestContext requestContext = springRequestContext.getRequestContext();
+ if (requestContext == null) {
+ return null;
+ }
+
+ return (String) requestContext.getFlowScope().get(paramName);
+ }
+
+}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/function/package-info.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/function/package-info.java
new file mode 100644
index 000000000..953b86b83
--- /dev/null
+++ b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/function/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Functional classes for profile behavior.
+ */
+
+package net.shibboleth.idp.profile.function;
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list