[java-idp-plugin-duo] branch main updated: Add redirect URI and Client ID audit extractors
Phil Smart
philip.smart at jisc.ac.uk
Thu Nov 17 11:47:33 UTC 2022
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-idp-plugin-duo.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-duo.git;a=commit;h=5b15866ad216a08021be13b2125a8671a6113676
The following commit(s) were added to refs/heads/main by this push:
new 5b15866 Add redirect URI and Client ID audit extractors
5b15866 is described below
commit 5b15866ad216a08021be13b2125a8671a6113676
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Thu Nov 17 11:47:28 2022 +0000
Add redirect URI and Client ID audit extractors
---
.../idp/plugin/authn/duo/audit/AuditFields.java | 5 ++++
.../duo/audit/impl/DuoClientIdAuditExtractor.java | 33 +++++++++++++++++++++
.../audit/impl/DuoRedirectUriAuditExtractor.java | 34 ++++++++++++++++++++++
.../META-INF/net.shibboleth.idp/postconfig.xml | 14 ++++++++-
4 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/AuditFields.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/AuditFields.java
index 025829c..137e0b9 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/AuditFields.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/AuditFields.java
@@ -59,4 +59,9 @@ public final class AuditFields {
/** The request state value sent to the Duo 2FA authz endpoint. */
@Nonnull @NotEmpty public static final String REQ_STATE = "DuoReqS";
+ /** The redirect URI sent to Duo. */
+ @Nonnull @NotEmpty public static final String REDIRECT_URI = "DuoRedirect";
+
+ /** The Duo client ID. */
+ @Nonnull @NotEmpty public static final String CLIENT_ID = "DuoCID";
}
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/impl/DuoClientIdAuditExtractor.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/impl/DuoClientIdAuditExtractor.java
new file mode 100644
index 0000000..a29cb6c
--- /dev/null
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/impl/DuoClientIdAuditExtractor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.plugin.authn.duo.audit.impl;
+
+import net.shibboleth.idp.plugin.authn.duo.audit.AbstractDuoAuditExtractor;
+import net.shibboleth.idp.plugin.authn.duo.context.DuoOIDCAuthenticationContext;
+
+/** An audit extractor to extract the Duo Client ID from the Duo integration.*/
+public class DuoClientIdAuditExtractor extends AbstractDuoAuditExtractor<String> {
+
+ @Override
+ protected String doLookup(final DuoOIDCAuthenticationContext context) {
+ if (context.getIntegration() != null) {
+ return context.getIntegration().getClientId();
+ }
+ return null;
+ }
+}
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/impl/DuoRedirectUriAuditExtractor.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/impl/DuoRedirectUriAuditExtractor.java
new file mode 100644
index 0000000..a49fc19
--- /dev/null
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/audit/impl/DuoRedirectUriAuditExtractor.java
@@ -0,0 +1,34 @@
+/*
+ * 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.plugin.authn.duo.audit.impl;
+
+import net.shibboleth.idp.plugin.authn.duo.audit.AbstractDuoAuditExtractor;
+import net.shibboleth.idp.plugin.authn.duo.context.DuoOIDCAuthenticationContext;
+
+/** An audit extractor to extract the Duo redirect URI from the Duo context.*/
+public class DuoRedirectUriAuditExtractor extends AbstractDuoAuditExtractor<String> {
+
+ @Override
+ protected String doLookup(final DuoOIDCAuthenticationContext context) {
+ if (context.getIntegration() != null) {
+ return context.getRedirectURIOverride() != null ?
+ context.getRedirectURIOverride() : context.getIntegration().getRedirectURI();
+ }
+ return context.getRedirectURIOverride();
+ }
+}
diff --git a/idp-duo-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/idp-duo-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index a540bfa..7c946b6 100644
--- a/idp-duo-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/idp-duo-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -47,7 +47,7 @@
<!-- Default audit format and extractors -->
<util:map id="shibboleth.authn.DuoOIDC.DefaultAuditFormattingMap">
- <entry key="Shibboleth-Audit.DuoOIDC" value="%AAF|%a|%T|%DuoU|%DuoReqS|%DuoRespS|%DuoTXID|%DuoDID|%DuoDN|%DuoR|%DuoF" />
+ <entry key="Shibboleth-Audit.DuoOIDC" value="%AAF|%a|%T|%DuoU|%DuoRedirect|%DuoCID|%DuoReqS|%DuoRespS|%DuoTXID|%DuoDID|%DuoDN|%DuoR|%DuoF" />
</util:map>
@@ -61,6 +61,18 @@
</key>
<bean class="net.shibboleth.idp.plugin.authn.duo.audit.impl.AttemptedAuthenticationFlowIdAuditExtractor" />
</entry>
+ <entry>
+ <key>
+ <util:constant static-field="net.shibboleth.idp.plugin.authn.duo.audit.AuditFields.CLIENT_ID"/>
+ </key>
+ <bean class="net.shibboleth.idp.plugin.authn.duo.audit.impl.DuoClientIdAuditExtractor" />
+ </entry>
+ <entry>
+ <key>
+ <util:constant static-field="net.shibboleth.idp.plugin.authn.duo.audit.AuditFields.REDIRECT_URI"/>
+ </key>
+ <bean class="net.shibboleth.idp.plugin.authn.duo.audit.impl.DuoRedirectUriAuditExtractor" />
+ </entry>
<entry>
<key>
<util:constant static-field="net.shibboleth.idp.plugin.authn.duo.audit.AuditFields.DUO_USER"/>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list