[java-identity-provider] branch main updated: IDP-2353 - C14n flow that runs a deployer-defined bean
Scott Cantor
cantor.2 at osu.edu
Thu Feb 27 20:07:07 UTC 2025
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=592b3e17ad85d3b837022a227463d0b9e4fd6588
The following commit(s) were added to refs/heads/main by this push:
new 592b3e17a IDP-2353 - C14n flow that runs a deployer-defined bean
592b3e17a is described below
commit 592b3e17ad85d3b837022a227463d0b9e4fd6588
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Feb 27 15:07:00 2025 -0500
IDP-2353 - C14n flow that runs a deployer-defined bean
https://shibboleth.atlassian.net/browse/IDP-2353
Implementation that just calls a function.
---
.../impl/FunctionSubjectCanonicalization.java | 76 ++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FunctionSubjectCanonicalization.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FunctionSubjectCanonicalization.java
new file mode 100644
index 000000000..2415e0bda
--- /dev/null
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FunctionSubjectCanonicalization.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed 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.authn.impl;
+
+import java.util.function.Function;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.action.EventIds;
+
+import net.shibboleth.idp.authn.AbstractSubjectCanonicalizer;
+import net.shibboleth.idp.authn.SubjectCanonicalizer;
+import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
+import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.logic.Constraint;
+
+/**
+ * A {@link SubjectCanonicalizer} that delegates implementation to a function, allowing
+ * scripted/etc. use.
+ *
+ * @since 5.2.0
+ */
+public class FunctionSubjectCanonicalization extends AbstractSubjectCanonicalizer {
+
+ /** Implementation of flow. */
+ @NonnullAfterInit private Function<SubjectCanonicalizationContext,String> delegatedFunction;
+
+ /**
+ * Set the function to use.
+ *
+ * @param f function to use
+ */
+ public void setFunction(@Nonnull final Function<SubjectCanonicalizationContext,String> f) {
+ checkSetterPreconditions();
+
+ delegatedFunction = Constraint.isNotNull(f, "Delegated function cannot be null");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void doInitialize() throws ComponentInitializationException {
+ super.doInitialize();
+
+ if (delegatedFunction == null) {
+ throw new ComponentInitializationException("Delegated function cannot be null");
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @Nullable public String doApply(@Nonnull final SubjectCanonicalizationContext c14nContext) {
+ final String result = delegatedFunction.apply(c14nContext);
+ if (EventIds.PROCEED_EVENT_ID.equals(result)) {
+ final String s = c14nContext.getPrincipalName();
+ if (s != null) {
+ c14nContext.setPrincipalName(applyTransforms(s));
+ }
+ }
+ return result;
+ }
+
+}
\ 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