Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions back/apps/core-fca-low/src/config/oidc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default {
idp_id: ["idp_id"],
idp_acr: ["idp_acr"],
roles: ["roles"],
organization_label: ["organization_label"],
groups: ["groups"],
custom: ["custom"],

Expand Down
5 changes: 5 additions & 0 deletions back/apps/core-fca-low/src/dto/identity-for-sp.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
IsDefined,
IsEnum,
IsObject,
IsOptional,
IsString,
MaxLength,
MinLength,
Expand Down Expand Up @@ -34,6 +35,10 @@ export class IdentityForSpDto extends IdentityFromIdpDto {
@IsString()
idp_acr: string;

@IsString()
@IsOptional()
organization_label?: string;

@IsEnum(
[
"dirigeant",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ describe("IdentitySanitizer", () => {
(cachedOrganizationService.computeRoles as jest.Mock).mockReturnValue([
"agent_public",
]);
(
cachedOrganizationService.getCachedOrganizationBySiret as jest.Mock
).mockReturnValue({
libelle: "Organization Label",
});

const identityForSp = await identitySanitizer.transformIdentity(
identityFromIdp as IdentityFromIdpDto,
Expand All @@ -197,6 +202,7 @@ describe("IdentitySanitizer", () => {
cachedOrganizationService.getCachedOrganizationBySiret,
).toHaveBeenCalledWith("12345678900007");
expect(identityForSp.roles).toEqual(["agent_public"]);
expect(identityForSp.organization_label).toEqual("Organization Label");
});

it("should handle error when getCachedOrganizationBySiret throws", async () => {
Expand Down
1 change: 1 addition & 0 deletions back/apps/core-fca-low/src/services/identity.sanitizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class IdentitySanitizer {
await this.cachedOrganizationService.getCachedOrganizationBySiret(
identityForSp.siret,
);
identityForSp.organization_label = cachedOrganization.libelle;
const roles =
this.cachedOrganizationService.computeRoles(cachedOrganization);
identityForSp.roles = roles;
Expand Down
4 changes: 2 additions & 2 deletions back/apps/mock-identity-provider-fca-low/src/user-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ const defaultUser = {
website: "http://example.com",
zoneinfo: "Europe/Berlin",
// ProConnect claims
siret: "13002526500013",
siret: "21920023500014",
// Deprecated ProConnect claims
belonging_population: "agent",
"chorusdt:matricule": "USER_AGC",
"chorusdt:societe": "CHT",
organizational_unit: "comptabilite",
siren: "130025265",
siren: "219200235",
uid: "1",
usual_name: "Doe",
};
Expand Down
2 changes: 1 addition & 1 deletion back/apps/mock-service-provider-fca-low/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PC_CLIENT_SECRET = decrypt(
);
const PC_PROVIDER = process.env.IdentityProviderAdapterEnv_DISCOVERY_URL;
const PC_SCOPES =
"openid uid given_name usual_name email siren siret organizational_unit belonging_population phone chorusdt idp_id idp_acr custom roles";
"openid uid given_name usual_name email siren siret organizational_unit belonging_population phone chorusdt idp_id idp_acr custom roles organization_label";
const LOGIN_HINT = "";
const PC_ID_TOKEN_SIGNED_RESPONSE_ALG =
process.env.IdentityProviderAdapterEnv_ID_TOKEN_SIGNED_RESPONSE_ALG;
Expand Down
91 changes: 0 additions & 91 deletions back/libs/api-entreprise/src/mocks/13002526500013.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ db.scopes.update(
{ scope: "roles", fd: "IDENTITY", label: "", __v: 0 },
{ upsert: true },
);
db.scopes.update(
{ scope: "organization_label" },
{ scope: "organization_label", fd: "IDENTITY", label: "", __v: 0 },
{ upsert: true },
);

// -- Scopes - Desk
print("Initializing Desk scopes...");
Expand Down
3 changes: 3 additions & 0 deletions docker/volumes/mongo-fca-low/scripts/db-states/_default/sp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const fsa = {
'groups',
'custom',
'roles',
'organization_label'
],
introspection_signed_response_alg: null,
introspection_encrypted_response_alg: null,
Expand Down Expand Up @@ -80,6 +81,7 @@ const fsa = {
'idp_acr',
'custom',
'roles',
'organization_label'
],
introspection_signed_response_alg: null,
introspection_encrypted_response_alg: null,
Expand Down Expand Up @@ -124,6 +126,7 @@ const fsa = {
'idp_acr',
'custom',
'roles',
'organization_label'
],
introspection_signed_response_alg: null,
introspection_encrypted_response_alg: null,
Expand Down
6 changes: 4 additions & 2 deletions quality/cypress/fixtures/fca-low/scopes.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"idp_id",
"idp_acr",
"custom",
"roles"
"roles",
"organization_label"
]
},
{
Expand All @@ -35,7 +36,8 @@
"idp_id",
"idp_acr",
"custom",
"roles"
"roles",
"organization_label"
]
},
{
Expand Down
6 changes: 4 additions & 2 deletions quality/cypress/support/common/helpers/user-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface User {
uid: string;
usual_name: string;
roles: string[];
organization_label: string;
}

export function getDefaultUser(): User {
Expand All @@ -25,10 +26,11 @@ export function getDefaultUser(): User {
given_name: "John",
organizational_unit: "comptabilite",
phone_number: "+49 000 000000",
siren: "130025265",
siret: "13002526500013",
siren: "219200235",
siret: "21920023500014",
uid: "1",
usual_name: "Doe",
roles: ["agent_public"],
organization_label: "Commune de clamart - Mairie",
};
}
4 changes: 2 additions & 2 deletions quality/cypress/support/usager/steps/contact-support-steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Then(
organizational_unit: "comptabilite",
phone_number: "+49 000 000000",
phone_number_verified: false,
siren: "130025265",
siret: "13002526500013",
siren: "219200235",
siret: "21920023500014",
sub: "1",
uid: "1",
usual_name: "Doe",
Expand Down