Skip to content

Commit

Permalink
feat: consume the get redirect url function from osd core
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Aug 13, 2024
1 parent 4cb813f commit c8e849c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server/auth/types/openid/openid_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class OpenIdAuthentication extends AuthenticationType {
const path = getRedirectUrl({
request,
basePath: this.coreSetup.http.basePath.serverBasePath,
nextUrl: request.url.pathname || '/app/opensearch-dashboards'
nextUrl: request.url.pathname || '/app/opensearch-dashboards',
});
return escape(path);
}
Expand Down
2 changes: 1 addition & 1 deletion server/auth/types/saml/saml_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class SamlAuthentication extends AuthenticationType {
let path = getRedirectUrl({
request,
basePath: this.coreSetup.http.basePath.serverBasePath,
nextUrl: request.url.pathname || '/app/opensearch-dashboards'
nextUrl: request.url.pathname || '/app/opensearch-dashboards',
});
if (request.url.search) {
path += request.url.search;
Expand Down
12 changes: 7 additions & 5 deletions server/utils/next_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ export function composeNextUrlQueryParam(
const nextUrl = parsedUrl?.path;

if (!!nextUrl && nextUrl !== '/') {
return `nextUrl=${encodeUriQuery(getRedirectUrl({
request,
basePath,
nextUrl,
}))}`;
return `nextUrl=${encodeUriQuery(
getRedirectUrl({
request,
basePath,
nextUrl,
})
)}`;
}
} catch (error) {
/* Ignore errors from parsing */
Expand Down

0 comments on commit c8e849c

Please sign in to comment.