[java-identity-provider] 03/03: IDP-2126 - Admin flow to report on config settings
Scott Cantor
cantor.2 at osu.edu
Mon Jun 12 17:47:18 UTC 2023
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=c93e50691db4617a545835434bea03aedebc9c42
commit c93e50691db4617a545835434bea03aedebc9c42
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jun 12 13:47:12 2023 -0400
IDP-2126 - Admin flow to report on config settings
https://shibboleth.atlassian.net/browse/IDP-2126
Add arg class for CLI and add driver scripts.
---
.../shibboleth/idp/cli/DumpConfigArguments.java | 122 +++++++++++++++++++++
.../net/shibboleth/idp/module/bin/dumpconfig.bat | 4 +
.../net/shibboleth/idp/module/bin/dumpconfig.sh | 8 ++
.../idp/module/core/impl/module.properties | 10 ++
4 files changed, 144 insertions(+)
diff --git a/idp-cli/src/main/java/net/shibboleth/idp/cli/DumpConfigArguments.java b/idp-cli/src/main/java/net/shibboleth/idp/cli/DumpConfigArguments.java
new file mode 100644
index 000000000..3709a7de6
--- /dev/null
+++ b/idp-cli/src/main/java/net/shibboleth/idp/cli/DumpConfigArguments.java
@@ -0,0 +1,122 @@
+/*
+ * 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.cli;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.beust.jcommander.Parameter;
+
+/** Command line processing for DumpConfig flow. */
+public class DumpConfigArguments extends AbstractCommandLineArguments {
+
+ /** Attribute requester identity. */
+ @Parameter(names = {"-r", "--requester"}, required = true, description = "Relying party identity")
+ @Nullable private String requester;
+
+ /** Index into metadata. */
+ @Parameter(names = {"-p", "--profile"}, description = "Profile identifier")
+ @Nullable private String profile;
+
+ /** Exact protocol for metadata lookup. */
+ @Parameter(names = {"--protocol"}, description = "Protocol support enumeration for metadata lookup")
+ @Nullable private String protocol;
+
+ /** SAML 1.1 protocol. */
+ @Parameter(names = {"--saml1"}, description = "Use SAML 1.1 protocol for metadata lookup")
+ private boolean saml1;
+
+ /** SAML 2.0 protocol. */
+ @Parameter(names = {"--saml2"}, description = "Use SAML 2.0 protocol for metadata lookup")
+ private boolean saml2;
+
+ /** CAS protocol. */
+ @Parameter(names = {"--cas"}, description = "Use CAS protocol for metadata lookup")
+ private boolean cas;
+
+ /** OIDC protocol. */
+ @Parameter(names = {"--oidc"}, description = "Use OIDC protocol for metadata lookup")
+ private boolean oidc;
+
+ /** {@inheritDoc} */
+// Checkstyle: CyclomaticComplexity OFF
+ @Override
+ public void validate() {
+ final String msg = "The saml1, saml2, cas, oidc, and protocol options are mutually exclusive";
+ if (saml1) {
+ if (saml2 || cas || oidc || protocol != null) {
+ throw new IllegalArgumentException(msg);
+ }
+ } else if (saml2) {
+ if (saml1 || cas || oidc || protocol != null) {
+ throw new IllegalArgumentException(msg);
+ }
+ } else if (cas) {
+ if (saml1 || saml2 || oidc || protocol != null) {
+ throw new IllegalArgumentException(msg);
+ }
+ } else if (oidc) {
+ if (saml1 || saml2 || cas || protocol != null) {
+ throw new IllegalArgumentException(msg);
+ }
+ } else if (protocol != null) {
+ if (saml1 || saml2 || cas || oidc) {
+ throw new IllegalArgumentException(msg);
+ }
+ }
+ }
+// Checkstyle: CyclomaticComplexity ON
+
+ /** {@inheritDoc} */
+ @Override
+ protected @Nonnull StringBuilder doBuildURL(@Nonnull final StringBuilder builder) {
+
+ if (getPath() == null) {
+ builder.append("/profile/admin/dumpconfig");
+ }
+
+ if (builder.toString().contains("?")) {
+ builder.append('&');
+ } else {
+ builder.append('?');
+ }
+
+ try {
+ builder.append("requester=").append(URLEncoder.encode(requester, "UTF-8"));
+ if (saml1) {
+ builder.append("&saml1");
+ } else if (saml2) {
+ builder.append("&saml2");
+ } else if (cas) {
+ builder.append("&cas");
+ } else if (oidc) {
+ builder.append("&oidc");
+ } else if (protocol != null) {
+ builder.append("&protocol=").append(URLEncoder.encode(protocol, "UTF-8"));
+ }
+ } catch (final UnsupportedEncodingException e) {
+ // UTF-8 is a required encoding.
+ }
+
+ return builder;
+ }
+
+}
\ No newline at end of file
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/bin/dumpconfig.bat b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/bin/dumpconfig.bat
new file mode 100644
index 000000000..b1b0b7411
--- /dev/null
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/bin/dumpconfig.bat
@@ -0,0 +1,4 @@
+ at echo off
+setlocal
+
+"%~dp0\runclass.bat" -Dnet.shibboleth.idp.cli.arguments=net.shibboleth.idp.cli.DumpConfigArguments net.shibboleth.idp.cli.CLI %*
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/bin/dumpconfig.sh b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/bin/dumpconfig.sh
new file mode 100755
index 000000000..359126725
--- /dev/null
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/bin/dumpconfig.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+declare LOCATION
+
+LOCATION=$(dirname $0)
+
+$LOCATION/runclass.sh -Dnet.shibboleth.idp.cli.arguments=net.shibboleth.idp.cli.DumpConfigArguments \
+ net.shibboleth.idp.cli.CLI "$@"
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/core/impl/module.properties b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/core/impl/module.properties
index c694115af..0c57c31aa 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/core/impl/module.properties
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/core/impl/module.properties
@@ -120,6 +120,16 @@ idp.CommandLine.22.dest = bin/version.bat
idp.CommandLine.22.replace = true
idp.CommandLine.22.nonwindows = false
+idp.CommandLine.23.src = /net/shibboleth/idp/module/bin/dumpconfig.sh
+idp.CommandLine.23.dest = bin/dumpconfig.sh
+idp.CommandLine.23.exec = true
+idp.CommandLine.23.replace = true
+idp.CommandLine.23.windows = false
+idp.CommandLine.24.src = /net/shibboleth/idp/module/bin/dumpconfig.bat
+idp.CommandLine.24.dest = bin/dumpconfig.bat
+idp.CommandLine.24.replace = true
+idp.CommandLine.24.nonwindows = false
+
idp.EditWebApp.name = Overlay Tree for WAR Build
idp.EditWebApp.desc = Tree allowing overlay of files into the WAR build process
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list