Skip to content

Commit

Permalink
cloud-1955 fix rest ssl with new realm
Browse files Browse the repository at this point in the history
  • Loading branch information
wdecoste committed Jul 28, 2017
1 parent e989a3c commit 9e95bd9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
15 changes: 14 additions & 1 deletion os-jdg7-launch/added/launch/authentication-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,20 @@ function configure_authentication() {
}

function add_realm_domain_mapping() {
local realm="<security-realm name=\"$SECDOMAIN_NAME\"><authentication><jaas name=\"$SECDOMAIN_NAME\"/></authentication></security-realm>"
local realm="<security-realm name=\"$SECDOMAIN_NAME\"><authentication><jaas name=\"$SECDOMAIN_NAME\"/></authentication>"

if [ -n "${HTTPS_PASSWORD}" -a -n "${HTTPS_KEYSTORE_DIR}" -a -n "${HTTPS_KEYSTORE}" ]; then

if [ -n "$HTTPS_KEYSTORE_TYPE" ]; then
keystore_provider="provider=\"${HTTPS_KEYSTORE_TYPE}\""
fi
ssl="<server-identities>\n\
<ssl>\n\
<keystore ${keystore_provider} path=\"${HTTPS_KEYSTORE_DIR}/${HTTPS_KEYSTORE}\" keystore-password=\"${HTTPS_PASSWORD}\"/>\n\
</ssl>\n\
</server-identities>"
fi
realm="$realm $ssl</security-realm>"

sed -i "s|<!-- ##DATAGRID_REALM## -->|${realm}|" "${CONFIG_FILE}"
}
12 changes: 6 additions & 6 deletions os-jdg7-launch/added/launch/infinispan-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -590,18 +590,18 @@ function configure_infinispan_endpoint() {
fi

if [ -n "${HTTPS_NAME}" -a -n "${HTTPS_PASSWORD}" -a -n "${HTTPS_KEYSTORE_DIR}" -a -n "${HTTPS_KEYSTORE}" ] ; then
encryption="<encryption $rest_security_realm />"
encryption="<encryption security-realm=\"ApplicationRealm\" />"
rest="\
<rest-connector name=\"rest-ssl\" socket-binding=\"rest-ssl\" cache-container=\"clustered\"> \
$rest_authentication \
$encryption \
</rest-connector>"
else
rest="$rest \
<rest-connector name=\"rest\" socket-binding=\"rest\" cache-container=\"clustered\"> \
$rest_authentication \
</rest-connector>"
fi

rest="$rest \
<rest-connector name=\"rest\" socket-binding=\"rest\" cache-container=\"clustered\"> \
$rest_authentication \
</rest-connector>"
;;
esac
done
Expand Down
9 changes: 7 additions & 2 deletions tests/features/datagrid/datagrid_rest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Feature: Openshift JDG REST tests
| HTTPS_PASSWORD | mykeystorepass |
| HTTPS_KEYSTORE_DIR | /etc/datagrid-secret-volume |
| HTTPS_KEYSTORE | keystore.jks |
Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml should contain value ApplicationRealm on XPath //*[local-name()='rest-connector']/*[local-name()='encryption']/@security-realm
Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml should contain value ApplicationRealm on XPath //*[local-name()='rest-connector'][@name='rest-ssl']/*[local-name()='encryption']/@security-realm
Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml should contain value rest on XPath //*[local-name()='rest-connector'][@name='rest']/@socket-binding

@jboss-datagrid-7/datagrid71-openshift
Scenario: Should create endpoint with encryption and specified security domain
Expand All @@ -59,6 +60,10 @@ Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml sho
| INFINISPAN_CONNECTORS | rest |
| USERNAME | tombrady |
| PASSWORD | sixrings |
| HTTPS_NAME | jboss |
| HTTPS_PASSWORD | mykeystorepass |
| HTTPS_KEYSTORE_DIR | /etc/datagrid-secret-volume |
| HTTPS_KEYSTORE | keystore.jks |
Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml should contain value jdg-openshift on XPath //*[local-name()='security-realms']/*[local-name()='security-realm']/@name
Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml should contain value jdg-openshift on XPath //*[local-name()='security-realms']/*[local-name()='security-realm'][@name='jdg-openshift']/*[local-name()='authentication']/*[local-name()='jaas']/@name

Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml should contain value mykeystorepass on XPath //*[local-name()='security-realms']/*[local-name()='security-realm'][@name='jdg-openshift']/*[local-name()='server-identities']/*[local-name()='ssl']/*[local-name()='keystore']/@keystore-password

0 comments on commit 9e95bd9

Please sign in to comment.