Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
fowards path parameter to app access authentication (#913) (#964)
Browse files Browse the repository at this point in the history
* fowards path parameter to app access authentication

* add some comments and clearer naming convention

* revert params change, single line comment
  • Loading branch information
avatus authored Jul 7, 2022
1 parent 02665e8 commit 8bd73c3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/teleport/src/AppLauncher/useAppLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ function resolveRedirectUrl(params: UrlLauncherParams) {
const port = location.port ? ':' + location.port : '';
const state = getUrlParameter('state', location.search);
const arn = getUrlParameter('awsrole', location.search);
// redirectPath captures and pass any requested App Access path during the `x-teleport-auth` process
const redirectPath = getUrlParameter('path', location.search);

// no state value: let the target app know of a new auth exchange
if (!state) {
Expand All @@ -62,7 +64,9 @@ function resolveRedirectUrl(params: UrlLauncherParams) {
if (params.arn) {
url.searchParams.set('awsrole', decodeURIComponent(params.arn));
}

if (redirectPath) {
url.searchParams.set('path', redirectPath);
}
return url.toString();
});
}
Expand All @@ -75,6 +79,9 @@ function resolveRedirectUrl(params: UrlLauncherParams) {
const url = new URL(`https://${result.fqdn}${port}/x-teleport-auth`);
url.searchParams.set('state', state);
url.hash = `#value=${result.value}`;
if (redirectPath) {
url.searchParams.set('path', redirectPath);
}
return url.toString();
});
}

0 comments on commit 8bd73c3

Please sign in to comment.