Skip to content

Commit

Permalink
Merge pull request #206 from Spyderisk/157-js-links-hardcoded-to-ssm-…
Browse files Browse the repository at this point in the history
…realm

157 js links hardcoded to ssm realm
  • Loading branch information
kenmeacham authored Sep 17, 2024
2 parents 081d2ff + 1c2e835 commit b296d5c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
# Location of the Spyderisk System Modeller documentation to be used in the web application:
#DOCUMENTATION_URL=https://spyderisk.org/documentation/modeller/latest/

# Set this if the realm name is different to the default value of 'ssm-realm'.
#KEYCLOAK_REALM=ssm-realm

# Secret shared for communication between Spyderisk and Keycloak services
# The docker-compose.yaml file demonstrates how to insert the value into the Keycloak configuration
#KEYCLOAK_CREDENTIALS_SECRET=DfkQBcVpjbO6gTMXMBUBfHe45UmFhGxk
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
kc_proxy_pass: '${EXTERNAL_KEYCLOAK_AUTH_SERVER_URL:-http://keycloak:8080/auth}'
documentation_url: '${DOCUMENTATION_URL:-https://spyderisk.org/documentation/modeller/latest/}'
tomcat_port: ${TOMCAT_PORT:-8081}
realm_name: '${KEYCLOAK_REALM:-ssm-realm}'
# When nginx starts it does a health check on the "upstream" servers and if none of them in a group are present it will fail.
# Hence, nginx must start after the ssm and keycloak.
# See https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-health-check/
Expand Down
2 changes: 1 addition & 1 deletion provisioning/nginx/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# `nginx.conf.template` to `nginx.conf` Then the `nginx` command is run the
# nginx service.

envsubst '$${scheme} $${server_port} $${kc_proxy_pass} $${documentation_url} $${tomcat_port}' < \
envsubst '$${scheme} $${server_port} $${kc_proxy_pass} $${documentation_url} $${tomcat_port} $${realm_name}' < \
/tmp/import/nginx.conf.template > /etc/nginx/nginx.conf

nginx -g 'daemon off;'
7 changes: 7 additions & 0 deletions provisioning/nginx/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ http {
proxy_pass http://ssm:$tomcat_port/system-modeller/;
}

location = /auth/account-management/ {
rewrite ^.*$ $scheme://$http_host/auth/realms/$realm_name/account/ redirect;
}
location = /auth/realm-management/ {
rewrite ^.*$ $scheme://$http_host/auth/admin/$realm_name/console/ redirect;
}

location = /auth {
rewrite ^(.*)$ $scheme://$http_host$1/ redirect;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/admin/components/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Admin extends Component {
<NavItem eventKey="1">Users</NavItem>
<NavItem
eventKey="1"
href="/auth/admin/ssm-realm/console/"
href="/auth/realm-management/"
>
Manage Accounts
</NavItem>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/common/components/header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ class Header extends React.Component {
</MenuItem>
<MenuItem
key={3.2}
href={"/auth/realms/ssm-realm/account/"}
href={"/auth/account-management/"}
>
Manage Account
</MenuItem>
Expand Down

0 comments on commit b296d5c

Please sign in to comment.