Skip to content

Commit

Permalink
fix inclusion connect logout, to not need confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Oct 25, 2024
1 parent 5e07784 commit 948bdaf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ describe("InclusionConnectedAllowedRoutes", () => {
appConfig.inclusionConnectConfig.providerBaseUri
}/logout-inclusion-connect?${queryParamsAsString({
postLogoutRedirectUrl: appConfig.immersionFacileBaseUrl,
clientId: appConfig.inclusionConnectConfig.clientId,
idToken: "fake-id-token",
state,
})}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import {
GetLogoutUrlParams,
OAuthGateway,
} from "../../port/OAuthGateway";
import {
InclusionConnectLogoutQueryParams,
InclusionConnectRoutes,
} from "./inclusionConnect.routes";
import {
ProConnectLogoutQueryParams,
ProConnectRoutes,
} from "./proConnect.routes";
import { InclusionConnectRoutes } from "./inclusionConnect.routes";
import { ProConnectRoutes } from "./proConnect.routes";

export type OAuthLogoutQueryParams = {
post_logout_redirect_uri: AbsoluteUrl;
id_token_hint: string;
state: string;
};

const logger = createLogger(__filename);

Expand Down Expand Up @@ -216,20 +216,12 @@ export class HttpOAuthGateway implements OAuthGateway {
? `${this.inclusionConnectConfig.providerBaseUri}/logout/`
: `${this.proConnectConfig.providerBaseUri}/session/end`;

return provider === "inclusionConnect"
? `${uri}?${queryParamsAsString<InclusionConnectLogoutQueryParams>({
client_id: this.inclusionConnectConfig.clientId,
post_logout_redirect_uri:
this.inclusionConnectConfig.immersionRedirectUri.afterLogout,
id_token: params.idToken,
state: params.state,
})}`
: `${uri}?${queryParamsAsString<ProConnectLogoutQueryParams>({
post_logout_redirect_uri:
this.inclusionConnectConfig.immersionRedirectUri.afterLogout,
id_token_hint: params.idToken,
state: params.state,
})}`;
return `${uri}?${queryParamsAsString<OAuthLogoutQueryParams>({
state: params.state,
id_token_hint: params.idToken,
post_logout_redirect_uri:
this.inclusionConnectConfig.immersionRedirectUri.afterLogout,
})}`;
}

#makeRedirectAfterLoginUrl(params: WithSourcePage): AbsoluteUrl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export class InMemoryOAuthGateway implements OAuthGateway {
return `${logoutUri[provider]}?${queryParamsAsString({
postLogoutRedirectUrl:
this.providerConfig.immersionRedirectUri.afterLogout,
clientId: this.providerConfig.clientId,
idToken: params.idToken,
state: params.state,
})}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ const withContentTypeUrlEncodedSchema = z.object({
"Content-Type": z.literal("application/x-www-form-urlencoded"),
});

export type InclusionConnectLogoutQueryParams = {
client_id: string;
post_logout_redirect_uri: AbsoluteUrl;
id_token: string;
state: string;
};

export type InclusionConnectRoutes = ReturnType<
typeof makeInclusionConnectRoutes
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ const withContentTypeUrlEncodedSchema = z.object({
"Content-Type": z.literal("application/x-www-form-urlencoded"),
});

export type ProConnectLogoutQueryParams = {
post_logout_redirect_uri: AbsoluteUrl;
id_token_hint: string;
state: string;
};

export type ProConnectRoutes = ReturnType<typeof makeProConnectRoutes>;

export const makeProConnectRoutes = (proConnectBaseUrl: AbsoluteUrl) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe("GetInclusionConnectLogoutUrl", () => {
}/logout-${logoutSuffixe}?${queryParamsAsString({
postLogoutRedirectUrl:
fakeProviderConfig.immersionRedirectUri.afterLogout,
clientId: fakeProviderConfig.clientId,
idToken,
state: ongoingOAuth.state,
})}`,
Expand Down

0 comments on commit 948bdaf

Please sign in to comment.