[java-identity-provider] branch master updated: Add cas option to metadata query flow.

Scott Cantor cantor.2 at osu.edu
Wed Nov 6 11:46:51 EST 2019


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=48d7da8abd5df420a16b83f8eabc52df85045d77

The following commit(s) were added to refs/heads/master by this push:
       new  48d7da8   Add cas option to metadata query flow.
48d7da8 is described below

commit 48d7da8abd5df420a16b83f8eabc52df85045d77
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Nov 6 11:46:46 2019 -0500

    Add cas option to metadata query flow.
---
 .../shibboleth/idp/cli/MetadataQueryArguments.java | 36 ++++++++++++++--------
 .../profile/impl/MetadataQueryRequestDecoder.java  |  5 +++
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/idp-core/src/main/java/net/shibboleth/idp/cli/MetadataQueryArguments.java b/idp-core/src/main/java/net/shibboleth/idp/cli/MetadataQueryArguments.java
index 081fced..0a5c5c6 100644
--- a/idp-core/src/main/java/net/shibboleth/idp/cli/MetadataQueryArguments.java
+++ b/idp-core/src/main/java/net/shibboleth/idp/cli/MetadataQueryArguments.java
@@ -43,24 +43,34 @@ public class MetadataQueryArguments extends AbstractCommandLineArguments {
     /** SAML 2.0 protocol. */
     @Parameter(names = {"--saml2"}, description = "Query for SAML 2.0 role")
     private boolean saml2;
-    
+
+    /** CAS protocol. */
+    @Parameter(names = {"--cas"}, description = "Query for CAS role")
+    private boolean cas;
+
+// Checkstyle: CyclomaticComplexity OFF
     /** {@inheritDoc} */
     @Override
     public void validate() {
-        if (saml1) {
-            if (saml2 || protocol != null) {
-                throw new IllegalArgumentException("The saml1, saml2, and protocol options are mutually exclusive");
-            }
-        } else if (saml2) {
-            if (saml1 || protocol != null) {
-                throw new IllegalArgumentException("The saml1, saml2, and protocol options are mutually exclusive");
-            }
-        } else if (protocol != null) {
-            if (saml1 || saml2) {
-                throw new IllegalArgumentException("The saml1, saml2, and protocol options are mutually exclusive");
+        try {
+            if (saml1) {
+                if (saml2 || cas || protocol != null) {
+                    throw new IllegalArgumentException();
+                }
+            } else if (saml2) {
+                if (cas || protocol != null) {
+                    throw new IllegalArgumentException();
+                }
+            } else if (cas) {
+                if (protocol != null) {
+                    throw new IllegalArgumentException();
+                }
             }
+        } catch (final IllegalArgumentException e) {
+            throw new IllegalArgumentException("The saml1, saml2, cas, and protocol options are mutually exclusive");
         }
     }
+// Checkstyle: CyclomaticComplexity ON
 
     /** {@inheritDoc} */
     @Override
@@ -82,6 +92,8 @@ public class MetadataQueryArguments extends AbstractCommandLineArguments {
                 builder.append("&saml1");
             } else if (saml2) {
                 builder.append("&saml2");
+            } else if (cas) {
+                builder.append("&cas");
             } else if (protocol != null) {
                 builder.append("&protocol=").append(URLEncoder.encode(protocol, "UTF-8"));
             }
diff --git a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/MetadataQueryRequestDecoder.java b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/MetadataQueryRequestDecoder.java
index 25d32e8..82e3f9f 100644
--- a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/MetadataQueryRequestDecoder.java
+++ b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/MetadataQueryRequestDecoder.java
@@ -51,6 +51,9 @@ public class MetadataQueryRequestDecoder extends AbstractHttpServletRequestMessa
     /** Name of the query parameter for the SAML 2 protocol: {@value} . */
     @Nonnull @NotEmpty public static final String SAML2_PARAM = "saml2";
 
+    /** Name of the query parameter for the CAS protocol: {@value} . */
+    @Nonnull @NotEmpty public static final String CAS_PARAM = "cas";
+    
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(MetadataQueryRequestDecoder.class);
     
@@ -116,6 +119,8 @@ public class MetadataQueryRequestDecoder extends AbstractHttpServletRequestMessa
             return SAMLConstants.SAML11P_NS;
         } else if (request.getParameter(SAML2_PARAM) != null) {
             return SAMLConstants.SAML20P_NS;
+        } else if (request.getParameter(CAS_PARAM) != null) {
+            return "https://www.apereo.org/cas/protocol";
         }
         
         return null;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list