Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud-1955 fix rest ssl with new realm #41

Merged
merged 1 commit into from
Aug 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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}"
}
17 changes: 11 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,23 @@ 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 />"
if [ -n "$REST_SECURITY_DOMAIN" ]; then
encryption="<encryption security-realm=\"$REST_SECURITY_DOMAIN\" />"
else
encryption="<encryption security-realm=\"ApplicationRealm\" />"
fi

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
11 changes: 9 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 @@ -50,7 +51,7 @@ Feature: Openshift JDG REST tests
| HTTPS_KEYSTORE_DIR | /etc/datagrid-secret-volume |
| HTTPS_KEYSTORE | keystore.jks |
| REST_SECURITY_DOMAIN | ManagementRealm |
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 ManagementRealm on XPath //*[local-name()='rest-connector']/*[local-name()='encryption']/@security-realm

@jboss-datagrid-7/datagrid71-openshift
Scenario: Should create security realm that maps to security domain
Expand All @@ -59,6 +60,12 @@ 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
Then XML file /opt/datagrid/standalone/configuration/clustered-openshift.xml should contain value jdg-openshift on XPath //*[local-name()='rest-connector']/*[local-name()='encryption']/@security-realm