[java-identity-provider] branch main updated: IDP-2471 - Review current state of DataSealer CLI
Codeberg
noreply at shibboleth.net
Wed Jul 29 16:48:13 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
https://codeberg.org/Shibboleth/java-identity-provider/commit/c083f2165aa76201a4e55cca1d51c93b1b1356ec
The following commit(s) were added to refs/heads/main by this push:
new c083f2165 IDP-2471 - Review current state of DataSealer CLI
c083f2165 is described below
commit c083f2165aa76201a4e55cca1d51c93b1b1356ec
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Wed Jul 29 12:47:55 2026 -0400
IDP-2471 - Review current state of DataSealer CLI
https://shibboleth.atlassian.net/browse/IDP-2471
Stop requiring a Spring configuration on the command line.
Add the IdP internal sealer beans as a resource to the command.
---
.../shibboleth/idp/cli/DataSealerArguments.java | 14 ++++++++---
.../java/net/shibboleth/idp/cli/DataSealerCLI.java | 29 +++++++++++++++++++++-
2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerArguments.java b/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerArguments.java
index 795929d78..87a331ba2 100644
--- a/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerArguments.java
+++ b/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerArguments.java
@@ -84,13 +84,19 @@ public class DataSealerArguments extends AbstractIdPHomeAwareCommandLineArgument
public void validate() throws IllegalArgumentException {
super.validate();
- if (getOtherArgs().size() < 3) {
+ final int opIndex;
+
+ if (getOtherArgs().size() == 2) {
+ opIndex = 0;
+ } else if (getOtherArgs().size() == 3) {
+ opIndex = 1;
+ } else {
throw new IllegalArgumentException("Missing one or more required arguments");
}
- if ("enc".equals(getOtherArgs().get(1))) {
+ if ("enc".equals(getOtherArgs().get(opIndex))) {
operation = OperationType.WRAP;
- } else if ("dec".equals(getOtherArgs().get(1))) {
+ } else if ("dec".equals(getOtherArgs().get(opIndex))) {
operation = OperationType.UNWRAP;
} else {
throw new IllegalArgumentException("Invalid operation requested, must be one of enc|dec");
@@ -102,7 +108,7 @@ public class DataSealerArguments extends AbstractIdPHomeAwareCommandLineArgument
out.println("DataSealerCLI");
out.println("Provides a command line interface for DataSealer wrap/unwrap operations.");
out.println();
- out.println(" DataSealerCLI [options] springConfiguration enc|dec string");
+ out.println(" DataSealerCLI [options] [springConfiguration] enc|dec string");
out.println();
out.println(" springConfiguration name of Spring configuration resource to use");
out.println(" enc|dec encrypt or decrypt operation");
diff --git a/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerCLI.java b/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerCLI.java
index 599425fa0..3274c3249 100644
--- a/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerCLI.java
+++ b/idp-cli/src/main/java/net/shibboleth/idp/cli/DataSealerCLI.java
@@ -14,14 +14,19 @@
package net.shibboleth.idp.cli;
+import java.util.List;
+
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
import net.shibboleth.idp.Version;
import net.shibboleth.idp.cli.DataSealerArguments.OperationType;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.security.DataSealer;
@@ -32,6 +37,10 @@ import net.shibboleth.shared.security.DataSealer;
*/
public class DataSealerCLI extends AbstractIdPHomeAwareCommandLine<DataSealerArguments> {
+ /** Path to internal resource defining the beans. */
+ @Nonnull @NotEmpty private static final String SEALER_SPRING_RESOURCE =
+ "classpath:/net/shibboleth/idp/conf/sealer.xml";
+
/** Class logger. */
@Nullable private Logger log;
@@ -58,10 +67,28 @@ public class DataSealerCLI extends AbstractIdPHomeAwareCommandLine<DataSealerArg
assert result!=null;
return result;
}
+
+ /** {@inheritDoc} */
+ @Override
+ @Nonnull protected List<Resource> getAdditionalSpringResources() {
+ return CollectionSupport.singletonList(new ClassPathResource(SEALER_SPRING_RESOURCE));
+ }
/** {@inheritDoc} */
@Override
protected int doRun(@Nonnull final DataSealerArguments args) {
+
+ final int dataIndex;
+
+ // With 2 args on the end, don't treat the first as a Spring resource.
+ if (args.getOtherArgs().size() == 2) {
+ setConsumeFirstOtherArgument(false);
+ dataIndex = 1;
+ } else {
+ // We know from validation that the count of args is 3.
+ dataIndex = 2;
+ }
+
final int ret = super.doRun(args);
if (ret != RC_OK) {
return ret;
@@ -77,7 +104,7 @@ public class DataSealerCLI extends AbstractIdPHomeAwareCommandLine<DataSealerArg
}
final OperationType op = args.getOperation();
- final String arg2 = args.getOtherArgs().get(2);
+ final String arg2 = args.getOtherArgs().get(dataIndex);
assert arg2 != null && op != null;
switch (op) {
case WRAP:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list