Skip to content

Commit

Permalink
[WFLY-8602] configuration changes because of URI attribute removal fr…
Browse files Browse the repository at this point in the history
…om credntial store resource
  • Loading branch information
pskopek committed Apr 20, 2017
1 parent d2f1c2b commit 5925f61
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
Expand Up @@ -18,7 +18,6 @@

import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELATIVE_TO;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.URI;
import static org.jboss.as.controller.security.CredentialReference.ALIAS;
import static org.jboss.as.controller.security.CredentialReference.CREDENTIAL_REFERENCE;

Expand Down Expand Up @@ -58,7 +57,9 @@ public void tearDown(ManagementClient managementClient, String s) throws Excepti

private void createCredentialStore(final ModelControllerClient client) throws IOException {
final ModelNode addOperation = Operations.createAddOperation(CREDENTIAL_STORE_ADDRESS.toModelNode());
addOperation.get(URI).set("cr-store://test/store001.jceks?create=true;keyStoreType=JCEKS;modifiable=true");
addOperation.get("create").set("true");
addOperation.get("modifiable").set("true");
addOperation.get("location").set("store001.jceks");
addOperation.get(RELATIVE_TO).set("jboss.server.data.dir");
final ModelNode credentialReference = addOperation.get(CREDENTIAL_REFERENCE).setEmptyObject();
credentialReference.get("clear-text").set("joshua");
Expand Down
4 changes: 2 additions & 2 deletions testsuite/integration/elytron/modify-elytron-config.cli
Expand Up @@ -47,8 +47,8 @@ embed-server --admin-only=true
/subsystem=elytron/filesystem-realm=ApplicationFsRealm/identity=guest:add-attribute(name=groups, value=["guest"])

# Create some test credential store entries (aliases) - they will be checked by CredentialStoreTestCase
# The keystore file for the credential store is created by keytool maven plugin in pom.xml.
/subsystem=elytron/credential-store=cred-store-default:add(uri="cr-store://cred-store-default/cred-store.jceks?keyStoreType=JCEKS;modifiable=true", relative-to=jboss.server.config.dir, credential-reference={clear-text=password})
# The keystore file for the credential store is created by keytool maven plugin in pom.xml.
/subsystem=elytron/credential-store=cred-store-default:add(location=cred-store.jceks, modifiable=true, relative-to=jboss.server.config.dir, credential-reference={clear-text=password})
/subsystem=elytron/credential-store=cred-store-default/alias=alias-password:add(secret-value=password)
/subsystem=elytron/credential-store=cred-store-default/alias=alias-secret:add(secret-value=secret)
/subsystem=elytron/credential-store=cred-store-default:remove()
Expand Down
11 changes: 10 additions & 1 deletion testsuite/integration/pom.xml
Expand Up @@ -211,7 +211,16 @@
<module>legacy</module>
</modules>
</profile>


<!-- -Dts.elytron -->
<profile>
<id>ts.integ.group.elytron</id>
<activation><property><name>ts.elytron</name></property></activation>
<modules>
<module>elytron</module>
</modules>
</profile>

<!-- profile to configure WildFly to use Elytron instead of legacy security: -Delytron -->
<profile>
<id>elytron.profile</id>
Expand Down
Expand Up @@ -60,33 +60,34 @@ private SimpleCredentialStore(Builder builder) {

@Override
public void create(CLIWrapper cli) throws Exception {
// /subsystem=elytron/credential-store=test:add(uri="cr-store://foo/a?create=true;keyStoreType=JCEKS;modifiable=true",
// /subsystem=elytron/credential-store=test:add(location=a,create=true,modifiable=true,implementation-properties={"keyStoreType"=>"JCEKS"},
// credential-reference={clear-text=pass123})

final StringBuilder sb = new StringBuilder("/subsystem=elytron/credential-store=");
sb.append(name).append(":add(").append("uri=\"cr-store://").append(name).append("/")
sb.append(name).append(":add(").append("location=")
.append(escapePath(keyStorePath.getPath()));
char separator = '?';
if (create != null) {
sb.append(separator).append("create=").append(create.toString());
separator = ';';
sb.append(",").append("create=").append(create.toString());
}
if (modifiable != null) {
sb.append(separator).append("modifiable=").append(modifiable.toString());
separator = ';';
sb.append(",").append("modifiable=").append(modifiable.toString());
}

if (keyStoreType != null) {
sb.append(separator).append("keyStoreType=").append(keyStoreType);
separator = ';';
sb.append(",")
.append("implementation-properties={")
.append("\"keyStoreType\"=>\"")
.append(keyStoreType)
.append("\"}");
}
sb.append("\", ");


if (credential != null) {
sb.append(credential.asString());
sb.append(",").append(credential.asString());
}

if (isNotBlank(keyStorePath.getRelativeTo())) {
sb.append("relative-to=\"").append(keyStorePath.getRelativeTo()).append("\"");
sb.append(",").append("relative-to=\"").append(keyStorePath.getRelativeTo()).append("\"");
}
sb.append(")");
cli.sendLine(sb.toString());
Expand Down

0 comments on commit 5925f61

Please sign in to comment.