Skip to content
Browse files

Add vault support to sever secrets

  • Loading branch information...
1 parent 0cb083a commit cdf49afe383f666a6eb088df9461af95a02d890a @n1hility n1hility committed Feb 15, 2012
View
10 ...nagement/src/main/java/org/jboss/as/domain/management/security/SecretIdentityService.java
@@ -54,9 +54,13 @@
private volatile CallbackHandlerFactory factory;
- public SecretIdentityService(final String base64Password) {
- byte[] value = Base64.decode(base64Password);
- password = new String(value).toCharArray();
+ public SecretIdentityService(final String password, boolean base64) {
+ if (base64) {
+ byte[] value = Base64.decode(password);
+ this.password = new String(value).toCharArray();
+ } else {
+ this.password = password.toCharArray();
+ }
}
View
2 .../java/org/jboss/as/domain/management/security/SecretServerIdentityResourceDefinition.java
@@ -42,7 +42,7 @@
public class SecretServerIdentityResourceDefinition extends SimpleResourceDefinition {
public static final SimpleAttributeDefinition VALUE = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.VALUE, ModelType.STRING, false)
- .setValidator(new StringLengthValidator(1, Integer.MAX_VALUE, false, false)).build();
+ .setValidator(new StringLengthValidator(1, Integer.MAX_VALUE, false, true)).setAllowExpression(true).build();
public SecretServerIdentityResourceDefinition() {
super(PathElement.pathElement(ModelDescriptionConstants.SERVER_IDENTITY, ModelDescriptionConstants.SECRET),
View
5 ...gement/src/main/java/org/jboss/as/domain/management/security/SecurityRealmAddHandler.java
@@ -296,9 +296,10 @@ private ServiceName addSSLService(OperationContext context, ModelNode ssl, Model
private ServiceName addSecretService(OperationContext context, ModelNode secret, ServiceName realmServiceName, ServiceTarget serviceTarget, List<ServiceController<?>> newControllers) throws OperationFailedException {
ServiceName secretServiceName = realmServiceName.append(SecretIdentityService.SERVICE_SUFFIX);
- String secretValue = context.resolveExpressions(secret.require(VALUE)).asString();
+ ModelNode secretValueNode = secret.require(VALUE);
+ String resolvedValue = context.resolveExpressions(secretValueNode).asString();
- SecretIdentityService sis = new SecretIdentityService(secretValue);
+ SecretIdentityService sis = new SecretIdentityService(resolvedValue, secretValueNode.asString().equals(resolvedValue));
final ServiceController<CallbackHandlerFactory> serviceController = serviceTarget.addService(secretServiceName, sis)
.setInitialMode(ON_DEMAND)
.install();

0 comments on commit cdf49af

Please sign in to comment.
Something went wrong with that request. Please try again.