EncodePasswordOptionHandler Class — spring-boot Architecture
Architecture documentation for the EncodePasswordOptionHandler class in EncodePasswordCommand.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/encodepassword/EncodePasswordCommand.java lines 80–113
private static final class EncodePasswordOptionHandler extends OptionHandler {
@SuppressWarnings("NullAway.Init")
private OptionSpec<String> algorithm;
@Override
protected void options() {
this.algorithm = option(Arrays.asList("algorithm", "a"),
"The algorithm to use. Supported algorithms: "
+ StringUtils.collectionToDelimitedString(ENCODERS.keySet(), ", ")
+ ". The default algorithm uses bcrypt")
.withRequiredArg()
.defaultsTo("default");
}
@Override
protected ExitStatus run(OptionSet options) {
if (options.nonOptionArguments().size() != 1) {
Log.error("A single password option must be provided");
return ExitStatus.ERROR;
}
String algorithm = options.valueOf(this.algorithm);
String password = (String) options.nonOptionArguments().get(0);
Supplier<PasswordEncoder> encoder = ENCODERS.get(algorithm);
if (encoder == null) {
Log.error("Unknown algorithm, valid options are: "
+ StringUtils.collectionToCommaDelimitedString(ENCODERS.keySet()));
return ExitStatus.ERROR;
}
Log.info(encoder.get().encode(password));
return ExitStatus.OK;
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free