Skip to content

Commit

Permalink
Fetch the appName context from window instead of fetching it from env…
Browse files Browse the repository at this point in the history
… variable (#6631)

* Fetch the appName context from window instead of hardcode it

* Remove useless file

* Get rid of the redirectUri variable

Until now the context of the app was created on the backend side and stored on the variable redirectUri. With this fix the context is determined by the FE

* remove useless docker variable

remove 
APP_CONFIG_OAUTH2_REDIRECT_LOGIN
APP_CONFIG_OAUTH2_REDIRECT_LOGOUT
the origin and context will be determined by the FE

* Update 30-sed-on-appconfig.sh

removing APP_CONFIG_OAUTH2_REDIRECT_LOGOUT and APP_CONFIG_OAUTH2_REDIRECT_LOGIN
  • Loading branch information
mauriziovitale committed Oct 6, 2021
1 parent 9bf1925 commit dc13364
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
14 changes: 0 additions & 14 deletions docker/docker-entrypoint.d/30-sed-on-appconfig.sh
Expand Up @@ -45,20 +45,6 @@ if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI}" ]; then
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
fi

if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGIN}" ]; then
replace="\/"
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGIN//\//$replace}
sed -e "s/\"redirectUri\": \".*\"/\"redirectUri\": \"${encoded}\"/g" \
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
fi

if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT}" ]; then
replace="\/"
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT//\//$replace}
sed -e "s/\"redirectUriLogout\": \".*\"/\"redirectUriLogout\": \"${encoded}\"/g" \
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
fi

if [[ -n "${APP_CONFIG_BPM_HOST}" ]]; then
replace="\/"
encoded=${APP_CONFIG_BPM_HOST//\//$replace}
Expand Down
2 changes: 0 additions & 2 deletions docker/run.sh
Expand Up @@ -16,8 +16,6 @@ docker run --rm -it \
--env APP_CONFIG_OAUTH2_IMPLICIT_FLOW=$APP_CONFIG_OAUTH2_IMPLICIT_FLOW \
--env APP_CONFIG_OAUTH2_SILENT_LOGIN=$APP_CONFIG_OAUTH2_SILENT_LOGIN \
--env APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI=$APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI \
--env APP_CONFIG_OAUTH2_REDIRECT_LOGIN=$APP_CONFIG_OAUTH2_REDIRECT_LOGIN \
--env APP_CONFIG_OAUTH2_REDIRECT_LOGOUT=$APP_CONFIG_OAUTH2_REDIRECT_LOGOUT \
--env APP_CONFIG_BPM_HOST=$APP_CONFIG_BPM_HOST \
--env APP_CONFIG_ECM_HOST=$APP_CONFIG_ECM_HOST \
--env APP_CONFIG_PROVIDERS=$APP_CONFIG_PROVIDERS \
Expand Down
4 changes: 2 additions & 2 deletions lib/core/services/alfresco-api.service.ts
Expand Up @@ -65,8 +65,8 @@ export class AlfrescoApiService {
protected initAlfrescoApi() {
const oauth: OauthConfigModel = Object.assign({}, this.appConfig.get<OauthConfigModel>(AppConfigValues.OAUTHCONFIG, null));
if (oauth) {
oauth.redirectUri = window.location.origin + (oauth.redirectUri || '/');
oauth.redirectUriLogout = window.location.origin + (oauth.redirectUriLogout || '/');
oauth.redirectUri = window.location.origin + window.location.pathname;
oauth.redirectUriLogout = window.location.origin + window.location.pathname;
}

const config = new AlfrescoApiConfig({
Expand Down

0 comments on commit dc13364

Please sign in to comment.