Skip to content

Commit

Permalink
✅(e2e) change accounts to facilitate SIRET and add e2e test
Browse files Browse the repository at this point in the history
We also add registration ID info to the /me endpoint, via serializers
  • Loading branch information
Laurent Bossavit authored and Laurent Bossavit committed Dec 23, 2024
1 parent 922cd20 commit d763409
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to

## [Unreleased]

### Added

- 🧑‍💻(oidc) add ability to pull registration ID (e.g. SIRET) from OIDC #577

### Fixed

- 🧑‍💻(user) fix the User.language infinite migration #611
Expand Down
4 changes: 2 additions & 2 deletions docker/auth/realm.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"realmRoles": ["user"]
},
{
"username": "marie",
"username": "jean.marie",
"email": "[email protected]",
"firstName": "Marie",
"lastName": "Devarzy",
Expand All @@ -70,7 +70,7 @@
"credentials": [
{
"type": "password",
"value": "people"
"value": "password-e2e-jean.marie"
}
],
"realmRoles": ["user"]
Expand Down
4 changes: 2 additions & 2 deletions src/backend/core/api/client/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class UserOrganizationSerializer(serializers.ModelSerializer):

class Meta:
model = models.Organization
fields = ["id", "name"]
read_only_fields = ["id", "name"]
fields = ["id", "name", "registration_id_list"]
read_only_fields = ["id", "name", "registration_id_list"]


class UserSerializer(DynamicFieldsModelSerializer):
Expand Down
2 changes: 2 additions & 0 deletions src/backend/people/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ class Development(Base):
# this is a dev credentials for mail provisioning API
MAIL_PROVISIONING_API_CREDENTIALS = "bGFfcmVnaWU6cGFzc3dvcmQ="

OIDC_ORGANIZATION_REGISTRATION_ID_FIELD = "siret"

def __init__(self):
"""In dev, force installs needed for Swagger API."""
# pylint: disable=invalid-name
Expand Down
16 changes: 16 additions & 0 deletions src/frontend/apps/e2e/__tests__/app-desk/siret.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, test } from '@playwright/test';

import { keyCloakSignIn } from './common';

test.beforeEach(async ({ page, browserName }) => {
await page.goto('/');
await keyCloakSignIn(page, browserName, 'marie');
});

test.describe('OIDC interop with SIRET', () => {
test('it checks the SIRET is displayed in /me endpoint', async ({ page, browserName }) => {
const response = await page.request.get('http://localhost:8071/api/v1.0/users/me/');
expect(response.ok()).toBeTruthy();
expect(await response.json()).toMatchObject({organization: {registration_id_list:["21580304000017"]}});
});
});
1 change: 1 addition & 0 deletions src/helm/env.d/dev/values.desk.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ backend:
OIDC_OP_TOKEN_ENDPOINT: https://fca.integ01.dev-agentconnect.fr/api/v2/token
OIDC_OP_USER_ENDPOINT: https://fca.integ01.dev-agentconnect.fr/api/v2/userinfo
OIDC_OP_LOGOUT_ENDPOINT: https://fca.integ01.dev-agentconnect.fr/api/v2/session/end
OIDC_ORGANIZATION_REGISTRATION_ID_FIELD: "siret"
OIDC_RP_CLIENT_ID:
secretKeyRef:
name: backend
Expand Down

0 comments on commit d763409

Please sign in to comment.