-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
3 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,8 +55,7 @@ export class HttpOAuthGateway implements OAuthGateway { | |
{ nonce, page, state }: GetLoginUrlParams, | ||
provider: OAuthProvider, | ||
): Promise<AbsoluteUrl> { | ||
// On pourrait placer ces URL au niveau du ProConnect/InclusionConnect HTTP Client ? | ||
const uriByMode: Record<OAuthProvider, AbsoluteUrl> = { | ||
const uriByProvider: Record<OAuthProvider, AbsoluteUrl> = { | ||
InclusionConnect: this.#makeInclusionConnectAuthorizeUri(), | ||
ProConnect: this.#makeProConnectAuthorizeUri(), | ||
}; | ||
|
@@ -83,7 +82,7 @@ export class HttpOAuthGateway implements OAuthGateway { | |
scope: this.proConnectConfig.scope, | ||
}); | ||
|
||
return `${uriByMode[provider]}?${queryParams}`; | ||
return `${uriByProvider[provider]}?${queryParams}`; | ||
} | ||
|
||
async #getAccessTokenProConnect({ | ||
|
@@ -260,14 +259,6 @@ export class HttpOAuthGateway implements OAuthGateway { | |
} | ||
|
||
#makeInclusionConnectAuthorizeUri(): AbsoluteUrl { | ||
// the following is made in order to support both the old and the new InclusionConnect urls: | ||
// Base Url was : https://connect.inclusion.beta.gouv.fr/realms/inclusion-connect/protocol/openid-connect | ||
// OLD : "https://connect.inclusion.beta.gouv.fr/realms/inclusion-connect/protocol/openid-connect/auth" | ||
|
||
// Base Url will be : https://connect.inclusion.beta.gouv.fr/auth | ||
// NEW : "https://connect.inclusion.beta.gouv.fr/auth/authorize" | ||
// or : "https://recette.connect.inclusion.beta.gouv.fr/auth/authorize" | ||
|
||
const authorizeInPath = | ||
this.inclusionConnectConfig.providerBaseUri.includes( | ||
"connect.inclusion.beta.gouv.fr/auth", | ||
|
@@ -296,42 +287,3 @@ type InclusionConnectLoginUrlParams = { | |
type ProConnectLoginUrlParams = InclusionConnectLoginUrlParams & { | ||
acr_values: string; | ||
}; | ||
|
||
// -> inclusionConnect button calls startInclusionConnectLogin (immersion) | ||
// -> redirects to inclusionConnect (inclusion) | ||
// -> when logged in, redirects to afterLoginRedirection (immersion) | ||
// -> with code received we can get the access token by calling : inclusionConnectGetAccessToken (inclusion) | ||
// return is of type { | ||
// 'access_token': <ACCESS_TOKEN>, | ||
// 'token_type': 'Bearer', | ||
// 'expires_in': 60, | ||
// 'id_token': <ID_TOKEN> | ||
// } | ||
// -> id_token is a JWT. The payload contains the OAuth data of type : | ||
// nonce : la valeur transmise lors de la requête initiale qu'il faut vérifier. | ||
// sub : l'identifiant unique de l'utilisateur que le FS doit conserver au cas où l'utilisateur change son adresse e-mail un jour (ce qui n'est pas encore possible pour le moment). | ||
// given_name : le prénom de l'utilisateur. | ||
// family_name : son nom de famille. | ||
// email : so | ||
// // this token is for test purpose : | ||
|
||
// export const jwtGeneratedTokenFromFakeInclusionPayload = | ||
// "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6Im5vdW5jZSIsInN1YiI6Im15LXVzZXItaWQiLCJnaXZlbl9uYW1lIjoiSm9obiIsImZhbWlseV9uYW1lIjoiRG9lIiwiZW1haWwiOiJqb2huLmRvZUBpbmNsdXNpb24uY29tIn0.kHy9LewhgXGVPy9rwcRea6LufhvgBb4zpcXa_H0-fEHIQk6ZhMATHL3LR1bgYqAo4IBU-cg1HYEbiOYMVPd4kg"; | ||
|
||
// // JWT contains the following payload : | ||
|
||
// export const fakeInclusionPayload = { | ||
// nonce: "nounce", | ||
// sub: "my-user-id", | ||
// given_name: "John", | ||
// family_name: "Doe", | ||
// email: "[email protected]", | ||
// }; | ||
|
||
// export const defaultInclusionAccessTokenResponse: InclusionAccessTokenResponse = | ||
// { | ||
// token_type: "Bearer", | ||
// expires_in: 60, | ||
// access_token: "initial-access-token", | ||
// id_token: jwtGeneratedTokenFromFakeInclusionPayload, | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters