[java-identity-provider] 01/03: IDP-1853 Remove Javascript dependencies from the IdP distribution
Scott Cantor
cantor.2 at osu.edu
Fri Dec 17 18:42:22 UTC 2021
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch maint-4.1
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=c30239998b82ac12c92f2987d13b00c09ede01f0
commit c30239998b82ac12c92f2987d13b00c09ede01f0
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Aug 19 11:02:50 2021 +0100
IDP-1853 Remove Javascript dependencies from the IdP distribution
https://shibboleth.atlassian.net/browse/IDP-1853
Replace the javascript for the bean shibboleth.ProtocolLookupFunction
with java code.
---
.../net/shibboleth/idp/conf/audit-system.xml | 17 +-------
.../audit/impl/MetadataProtocolAuditExtractor.java | 45 ++++++++++++++++++++++
2 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/audit-system.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/audit-system.xml
index 750afa9d0..eb4d025e2 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/audit-system.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/audit-system.xml
@@ -74,22 +74,7 @@
</constructor-arg>
</bean>
- <bean id="shibboleth.ProtocolLookupFunction" parent="shibboleth.ContextFunctions.Scripted" factory-method="inlineScript">
- <constructor-arg>
- <value>
- <![CDATA[
- var protocol = null;
- var springContext = input.getSubcontext("net.shibboleth.idp.profile.context.SpringRequestContext");
- if (springContext != null) {
- if (springContext.getRequestContext() != null) {
- protocol = springContext.getRequestContext().getActiveFlow().getApplicationContext().getBean('shibboleth.MetadataLookup.Protocol');
- }
- }
- protocol;
- ]]>
- </value>
- </constructor-arg>
- </bean>
+ <bean id="shibboleth.ProtocolLookupFunction" class="net.shibboleth.idp.saml.audit.impl.MetadataProtocolAuditExtractor"/>
<!--
The actual beans used are in user-space, but they inherit from the maps below. We have to use a
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/audit/impl/MetadataProtocolAuditExtractor.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/audit/impl/MetadataProtocolAuditExtractor.java
new file mode 100644
index 000000000..db9e7582d
--- /dev/null
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/audit/impl/MetadataProtocolAuditExtractor.java
@@ -0,0 +1,45 @@
+/*
+ * 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.saml.audit.impl;
+
+import java.util.function.Function;
+
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.springframework.webflow.execution.RequestContext;
+
+import net.shibboleth.idp.profile.context.SpringRequestContext;
+
+/** {@link Function} that returns the Metadata protocol (as defined by the bean
+ * called <code>shibboleth.MetadataLookup.Protocol</code>). */
+public class MetadataProtocolAuditExtractor implements Function<ProfileRequestContext,Object> {
+
+ /** {@inheritDoc} */
+ @Nullable public Object apply(@Nullable final ProfileRequestContext input) {
+ final SpringRequestContext springCtx = input.getSubcontext(SpringRequestContext.class);
+ if (springCtx == null) {
+ return null;
+ }
+ final RequestContext reqCtx = springCtx.getRequestContext();
+ if (reqCtx == null) {
+ return null;
+ }
+ return reqCtx.getActiveFlow().getApplicationContext().getBean("shibboleth.MetadataLookup.Protocol");
+ }
+}
\ 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