Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
c077d6d
feat: SSO module implementation
Oct 21, 2024
6202039
fix: lint and clear
Oct 22, 2024
a017912
clear: insertUser deletion
Oct 22, 2024
99c6b02
clear: back to initial config
Oct 22, 2024
8ecf60e
fix: CASSLAB-123, CASSLAB-125 and SSO readme refacto
Dec 16, 2024
d5c593a
fix: CASSLAB-125 => delete bearerTokenHandler
Dec 16, 2024
f9723aa
doc: readme update
Dec 16, 2024
7e5505b
Fix/update user db by user sso
Jan 22, 2025
7f4cc24
Merge branch 'fix/update-userDB-by-userSSO' into 'develop-open-sso'
Jan 22, 2025
afc3907
Merge branch 'dev' into finalise-sso
Feb 18, 2025
0b0b14c
add keycloack config
Feb 18, 2025
1076918
remove sder-core package
Feb 19, 2025
a620f38
mock SSO for tests
Feb 19, 2025
e6deefc
move sso package to backend
Feb 19, 2025
7aad421
fix local docker backend
Feb 20, 2025
104a7bb
deploy on dev
Feb 20, 2025
bbe46a7
setup env var
Feb 20, 2025
db99268
fix vault ?
Feb 20, 2025
a07283a
try to fix configmap
Feb 20, 2025
afd9e26
configmap are string:string
Feb 20, 2025
3cc16f7
partially fix tests
Feb 21, 2025
e4a4e6b
doc
Feb 21, 2025
2ad7ed2
update yarn lock
Feb 21, 2025
9e931b2
adding keyclaock idp and config
Bouba-cassation Feb 28, 2025
6bb7ebd
adding keyclaock idp and config
Bouba-cassation Feb 28, 2025
03aa48e
fix realm
Mar 4, 2025
2515359
add all roles to clientScopeMappings
Mar 5, 2025
0e652fe
configurind hearder nginx
Bouba-cassation Mar 6, 2025
d9ffd79
adding ingress match
Bouba-cassation Mar 6, 2025
2cbe27f
test header
Bouba-cassation Mar 7, 2025
85abb5d
revert after testing many possibility
Bouba-cassation Mar 7, 2025
4bf9746
adding keycloak as service in kubernetes
Bouba-cassation Mar 11, 2025
828dfd0
adding k9s file in deploy main
Bouba-cassation Mar 11, 2025
f4fbf5e
rename keycloack file
Bouba-cassation Mar 11, 2025
37034c2
rename keycloack file
Bouba-cassation Mar 11, 2025
6080fc1
rename keycloack file
Bouba-cassation Mar 11, 2025
657c655
rename keycloack file
Bouba-cassation Mar 11, 2025
0a92156
resolving errro in task kub
Bouba-cassation Mar 11, 2025
df7c02c
resolving errro in task kub
Bouba-cassation Mar 11, 2025
6104be7
configuring a local kub kc
Bouba-cassation Mar 11, 2025
e2890e7
configuring a local kub kc
Bouba-cassation Mar 11, 2025
8a0a2d2
configuring a local kub kc
Bouba-cassation Mar 11, 2025
3ba6937
configuring a local kub kc
Bouba-cassation Mar 11, 2025
86b10ef
adding middleware
Bouba-cassation Mar 12, 2025
567cd24
removing middleware
Bouba-cassation Mar 12, 2025
c3b3b72
removing middleware
Bouba-cassation Mar 12, 2025
142543c
removing middleware
Bouba-cassation Mar 12, 2025
427756b
removing middleware
Bouba-cassation Mar 12, 2025
53c6fed
removing middleware
Bouba-cassation Mar 12, 2025
b68dbb5
revert in good version
Bouba-cassation Mar 12, 2025
bee1589
revert in good version
Bouba-cassation Mar 12, 2025
6b9dd79
change sso_sp_assertion_consumer_service_location
Bouba-cassation Mar 12, 2025
9e46bba
new idp from keyclaok
Bouba-cassation Mar 13, 2025
3c1ac4d
resolving erreur
Bouba-cassation Mar 13, 2025
f241582
resolving erreur
Bouba-cassation Mar 13, 2025
872623c
adding in vault sso dev value
Bouba-cassation Mar 14, 2025
81b1f6d
adding in vault sso dev value
Bouba-cassation Mar 14, 2025
8ed84ee
config for preprod
Bouba-cassation Apr 11, 2025
68cc748
testing before getting bucket s3
Bouba-cassation Apr 14, 2025
0b23c4b
adding conf preprod
Bouba-cassation Apr 14, 2025
ac6d810
adding conf dev
Bouba-cassation Apr 14, 2025
8787bd0
adding fake file idp for backend running
Bouba-cassation Apr 15, 2025
fee6cdd
adding fake file idp for backend running
Bouba-cassation Apr 15, 2025
e871754
adding fake file idp for backend running
Bouba-cassation Apr 15, 2025
8a2b1f1
adding fake file idp for backend running
Bouba-cassation Apr 15, 2025
ce5591d
pushing finalise-sso branch in preprod
Bouba-cassation Apr 15, 2025
fa797db
preparation pour charger les fichiers senssible depuis u bucket pour …
Bouba-cassation Apr 16, 2025
58b36b4
add pull sso files from s3
ilias-115 Apr 16, 2025
65de118
fix inventory
ilias-115 Apr 16, 2025
121db97
add PVC
ilias-115 Apr 16, 2025
eae0a38
local path only support ReadWriteOnce
ilias-115 Apr 16, 2025
8578671
rule error
ilias-115 Apr 16, 2025
ab8d68b
only deploy
ilias-115 Apr 16, 2025
c73f5c1
build back
ilias-115 Apr 16, 2025
e1d0072
update path
ilias-115 Apr 16, 2025
5a7957b
update path again
ilias-115 Apr 16, 2025
2537adb
adapt path sso
ilias-115 Apr 16, 2025
0751063
debug
ilias-115 Apr 16, 2025
50db596
chmod on volume
ilias-115 Apr 16, 2025
aaee554
debug
ilias-115 Apr 16, 2025
fd32b17
debug
ilias-115 Apr 16, 2025
e71af72
debug
ilias-115 Apr 16, 2025
1d0ca78
debug
ilias-115 Apr 16, 2025
d9cfff1
debig
ilias-115 Apr 16, 2025
0d7fde8
it works, little clean
ilias-115 Apr 16, 2025
8a5ff09
adding config file for recette sso
Bouba-cassation Apr 17, 2025
5100bf7
addapting vault sso
Bouba-cassation Apr 28, 2025
17206e6
cleaning
May 12, 2025
fad80e6
remove some variable from vault
May 12, 2025
af4e19f
strange entity id ?
May 12, 2025
fcef463
try to fix roles
May 13, 2025
8580a07
fix variables by env
May 13, 2025
278d79a
trim and lowercase user mail at creation
May 14, 2025
db88e0d
change auto provisionning logic
May 14, 2025
91bc08c
remove fullname sso attribute
May 14, 2025
57b38b9
try to improve logout
May 14, 2025
d8b0c0a
:construction:
May 14, 2025
2a46985
try to logout
May 15, 2025
f8596d0
harmonizing group_vars
Bouba-cassation May 15, 2025
b5acf1c
pusshing on prod to get label sso sp file
Bouba-cassation May 26, 2025
bd869e1
pusshing on prod to get label sso sp file
Bouba-cassation May 26, 2025
4bd7c6b
pusshing on prod to get label sso sp file
Bouba-cassation May 26, 2025
9845e9f
change bucket access ids
ilias-115 May 27, 2025
600a0a1
pusshing on prod to get label sso sp file
Bouba-cassation May 27, 2025
af95be2
pushing preprod
Bouba-cassation May 28, 2025
2d2edcb
Merge branch 'dev' into finalise-sso
Jun 20, 2025
927d505
fix logout URL
Jun 24, 2025
769e8ce
adding sso_sp_entity_id for preprod
Bouba-cassation Jul 15, 2025
d7f25fc
pushing in prod
Bouba-cassation Jul 15, 2025
78917c9
adding sso prod good link
Bouba-cassation Jul 15, 2025
fc426a7
adding sso prod good link
Bouba-cassation Jul 15, 2025
37ffe09
Merge branch 'master' into finalise-sso
Sep 3, 2025
19171cb
change keycloak port
Sep 3, 2025
5dc52c5
doc
Sep 3, 2025
7fd3078
useless env var
Sep 3, 2025
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
32 changes: 31 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@ DBSDER_API_KEY=3d8767ff-ed2a-47bd-91c2-f5ebac712f2c
NLP_PSEUDONYMISATION_API_URL=http://localhost:8081 # to docker use host.docker.internal over localhost

NLP_PSEUDONYMISATION_API_ENABLED=false # true to use nlp-api
JWT_PRIVATE_KEY=myPrivateKey
# PROD to use DB:
RUN_MODE=LOCAL

# SSO VARIABLES
COOKIE_PRIVATE_KEY=myPrivateKey
# Service Provider (SP)
SSO_SP_ENTITY_ID=label
SSO_SP_ASSERTION_CONSUMER_SERVICE_LOCATION=http://localhost:55430/label/api/sso/acs
# Identity Provider (IdP)
SSO_IDP_METADATA=sso_files/keycloak-metadata-idp.xml
SSO_IDP_SINGLE_SIGN_ON_SERVICE_LOCATION=http://localhost:8080/realms/label/protocol/saml
SSO_IDP_SINGLE_LOGOUT_SERVICE_LOCATION=http://localhost:8080/realms/label/protocol/saml
SSO_CERTIFICAT=sso_files/keycloak-cert.pem
SSO_SP_PRIVATE_KEY=sso_files/keycloak-private.key
# Les valeurs possibles du SSO_NAME_ID_FORMAT sont le IDP metadata.xml
SSO_NAME_ID_FORMAT=urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
SSO_SIGNATURE_ALGORITHM="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
# Authentication
# 604800=7*24*60*60
SESSION_DURATION=604800
# FRONT END
SSO_FRONT_SUCCESS_CONNEXION_ANNOTATOR_URL=http://localhost:55432/label/annotation
SSO_FRONT_SUCCESS_CONNEXION_ADMIN_SCRUTATOR_URL=http://localhost:55432/label/admin/main/summary
SSO_FRONT_SUCCESS_CONNEXION_PUBLICATOR_URL=http://localhost:55432/label/publishable-documents
# ATTRIBUTS KEYS
SSO_ATTRIBUTE_NAME=lastName
SSO_ATTRIBUTE_FIRSTNAME=firstName
SSO_ATTRIBUTE_MAIL=email
SSO_ATTRIBUTE_ROLE=Role
# APPLICATION NAME
SSO_APP_NAME=LABEL
# APPLICATION ROLES
SSO_APP_ROLES=admin,annotator,publicator,scrutator
14 changes: 11 additions & 3 deletions Dockerfile.label-backend
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@ RUN yarn config set proxy $http_proxy; \

WORKDIR /home/node/

# Install git for sder and sder-core package
RUN apk add git

# Copy context files
COPY ./package.json ./
COPY packages/generic/core/package.json ./packages/generic/core/
COPY packages/generic/backend/package.json ./packages/generic/backend/
COPY packages/courDeCassation/package.json ./packages/courDeCassation/

# Voir comment améliorer car pour la re7 et la prod les seront ajoutées depuis un bucket dans l'image
# Si en dev, on copie les fichiers comme ça on enleve le changement de droit
# COPY sso_files/ ./packages/courDeCassation/sso_files/
# RUN if [ "$NODE_ENV" = "development" ]; then \
# COPY sso_files/ ./packages/courDeCassation/sso_files/; \
# fi

COPY sso_files/ ./packages/courDeCassation/sso_files/
RUN chmod -R 777 ./packages/courDeCassation/sso_files
RUN chmod -R 777 ./packages/courDeCassation/sso_files/

COPY . .

# Do not bring client dependencies to backend prod
Expand Down
16 changes: 16 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
## Configuration

You can lauch the backend with or withour docker. To configure these methods you must have an env file :

- `.env`

Copy and rename `.env.example`.

Label depends on 2 other services from the Cour de cassation : dbsder-api and nlp-pseudonymisation-api. You can lauch these services locally to simulate operation close to production or you can disable theses services from env files. In this case these 2 services are emulated by Label with the storage folder. To do so, follow the `Add documents you want to annotate` step in the [reuser guide](docs/reuserGuide.md) or just rename the `storage-example` folder to `storage`.
To manage local authentication label uses keycloak.

You should take a look at [juridependencies](https://github.com/Cour-de-cassation/juridependencies) to install theses services.

Expand Down Expand Up @@ -87,3 +89,17 @@ docker compose exec labelbk sh -c "cd packages/courDeCassation; sh scripts/runLo
```sh
scripts/runScriptLocally.sh "myScript.js --myArgument"
```

### SSO configuration

Follow the [installation guide](packages/generic/sso/README.md).

> The LABEL application leverages the SSO module as a dependency for its integration with the Single Sign-On (SSO) system. The details of this integration are documented in the [README](packages/generic/sso/README.md) of the SSO module.

The backend exposes the following URLs to interact with the SSO:

1. /api/sso/login: Endpoint to initiate the login process via SSO.
2. /api/sso/acs: Endpoint for processing SAML assertions following a successful authentication.
3. /api/sso/logout: Endpoint to disconnect the user from the SSO.

**_The attributes returned by the SSO, as well as the roles used by the application, are specified in the configuration file._**
3 changes: 0 additions & 3 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ Here are the current roadmaps:
- Fix security issues and update dependencies
- Improve reusability
- Improve test coverage
- Connect label to the ministry's SSO/LDAP
- Use dbsder api and dbsder-api-type instead of `sder` repository
- Rethinking the use of the pelta design system
- Use mongoose


## Functionnal roadmap

This software will follow the [official calendar of french justice open data](https://www.justice.gouv.fr/documentation/open-data-decisions-justice) which follows [an official decree](https://www.legifrance.gouv.fr/loda/id/JORFTEXT000043426865/).
13 changes: 13 additions & 0 deletions ansible/group_vars/all/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,16 @@ dbsder_api_url: "http://api-service.dbsder:3000" # url not tested
label_db_name: "labelDb"
label_client_url: "https://label.cour-de-cassation.justice.fr:55432" # strange url
label_kube_namespace: "label"
session_duration: "604800"

# SSO
sso_name_id_format: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
sso_signature_algorithm: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
sso_app_name: "LABEL"
sso_app_roles: "admin,annotator,publicator,scrutator"

sso_bucket: "sso-files"
s3_type: "s3"
s3_provider: "Minio"
s3_endpoint: "http://bucket-service.juritj.svc.cluster.local:9000"
rclone_app_id: "rclone"
28 changes: 24 additions & 4 deletions ansible/group_vars/dev/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
git_branch: dev

sder_mongodb_url: "{{ vault_sder_mongodb_url }}"
label_mongodb_url: "{{ vault_label_mongodb_url }}"
dbsder_api_key: "{{ vault_dbsder_api_key }}"
jwt_private_key: "{{ vault_jwt_private_key }}"
label_mongodb_url: "{{ vault_label_mongodb_url }}"
dbsder_api_key: "{{ vault_dbsder_api_key }}"
cookie_private_key: "{{ vault_cookie_private_key }}"
sso_sp_assertion_consumer_service_location: "{{ vault_sso_sp_assertion_consumer_service_location }}"
sso_sp_entity_id: "{{ vault_sso_sp_entity_id }}"
sso_idp_single_sign_on_service_location: "{{ vault_sso_idp_single_sign_on_service_location }}"
sso_idp_single_logout_service_location: "{{ vault_sso_idp_single_logout_service_location }}"
sso_front_success_connexion_annotator_url: "{{ vault_sso_front_success_connexion_annotator_url }}"
sso_front_success_connexion_admin_scrutator_url: "{{ vault_sso_front_success_connexion_admin_scrutator_url }}"
sso_front_success_connexion_publicator_url: "{{ vault_sso_front_success_connexion_publicator_url }}"

sso_idp_metadata: "sso_files/keycloak-metadata-idp-dev.xml"
sso_certificat: "sso_files/keycloak-cert.pem"
sso_sp_private_key: "sso_files/keycloak-private.key"

# On ajoutera cette parti dans le all quand on aura les mêmes attributs partout (keyclaock et ldapMJ)
sso_attribute_name: "lastName"
sso_attribute_firstname: "firstname"
sso_attribute_mail: "email"
sso_attribute_role: "Role"


s3_access_key: "{{ vault_s3_access_key }}"
s3_secret_key: "{{ vault_s3_secret_key }}"
75 changes: 60 additions & 15 deletions ansible/group_vars/dev/vault.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,61 @@
$ANSIBLE_VAULT;1.1;AES256
66643134396430343834663432376438623436313864316233383962663735393936623738653062
6432333835333531653565383935623135626130663235340a303530636461666236396261656537
65363832633664633932386366323566653661343535623933653934613433663136323535643836
6231666439313437390a313932393739393862613234373832383939353739666534356465663333
35313938343064366138373333323630663661356335633263663563656132356235343166386365
62656438303161343064343235333034656166326565383231323162326237653537653531396231
65346634666565373433383230333734343531386631613833626331303437613464313063383962
39623030356239333331313631626238643739336163373235643839306264353463646239353536
35623637663462306663386365366339386139613235326337616666623434306266623164653839
32396262393133333664653863393238353066633632646230616330663662663761323464313237
35666663366533386437363461393230356162376533616265636336373265376632656634376462
65363538373137356636336463366430303761356364303737643865646237313439623065613262
39656337313738396530356166623038363132343135666566653139623564313763653837306531
66613033366233616432613239376166313733663236323335363833333032303162353639653131
646330653531393233346266396536616338
64313037313065396237393832636439643036373839616339336663333631323439333932393662
3430373432613934306139356430363566643531393537650a393437343433376432633533363135
62333762656464643835343737363232353931386432386530656138303562313533336236663234
3231373939656566650a333464643538333038376436656238333863613062643363323632323735
66396539623536386162346230356130616339356336633163636265313539353133626537363463
30346135646561656565336461666239656335636536366331636438643530313433343864373666
65613864333864616262316238643034363362383637393137383966323262306530356363303135
34333233633033656138343362366465396433623432633631633563666536636333363831303931
35616139396234373462653433383363653833353363353238383136366439366564313535323566
36316239653064373837376135646338393865616137633334653233383034663264336231313634
65366262396537386438386562306262623630326465333532326234626437663232326265636533
33666133643965393935383763356231653036333234633332666261666633353135376136313332
61383231326633326334316638336238383936366339383836326238386564633331363063666663
66393237323335303533623330613532653836343037653636373565636166376466316536306137
37613133396466333463326635643961363865656438383234376136346161383234313937303962
39636261666464616230626331356135653834333864643161333831643738386639363933303064
33383733333563343839343438376365373963323230666164653965333237343461383039336564
34626463643935373564386436343535343437373361306263393862646137623561353363653364
37663538616436306564313666666666336131616132623963326530623639636561653038326334
34366461383938303863623264646364613365346363356661616432373633386464656130306230
37393832313631333338616331383934613136613638306232353738313338623361613766356636
33373139343837633463616334356330666462383131656132326530333135363534343335643933
62633362316433316163663532306464613932396237366532383235396666653361663262323835
30363233626163643331646131363065613837336233636136653030616430313134656335333438
33336533626531326137336566323839663565326134333236663339343863636432353461636663
36383936383862663661373265656133333165653338646362336166663864393736646538653530
33643431386632333830613635376532353533636131373139646139303631383134623039306263
38396236613436643130383666616131346437623135633263316663336238376431363933633961
66356337366261383165306130636238633461623037646638366236336261363839653334643139
30336337643230376563353830313931633661633236383362343434366632373639313632356131
36396331643266323537613431333734323737343461383263386665356662643663343434643530
37303962326432623338336438373234623866376538333730343330633963643166363732353966
61646634616632373162643932643232653763313862646364313237336230366630373139353438
66633734313130346633326531396364346530376430623132333663626631323737626136633433
39393931376433366532626165356166636265663962363032666364326332366563346231356462
39373436346535663532306464333762373338643836383063633135313432623532363630373333
33366138363836623939336633353965323135613330336466653232613639333339343834396262
61366335383730363734396263383431663532626365656165303135343931326463643166646638
39393733393332313466623463303165663861666137376334323835646264663434663831303663
39366631613964666435356331353866316363336434313334663239633230343061373864303832
34616466356535363339646433656232336530663463306533636433373330336431303738636363
39306339613138653362336338396338343135623463623239613066336263393137356163646632
37656331396562653434643261333630383838373133313738633664313663323137373933363565
62313966376163396666303463616334383939343161366335613835346265643830643564363237
30333835303032626333343265333834373638636537656163653534356663323864393537356636
66393237356565363163383639323534306563316662343532653663613739313934643766326135
38653933333534666536623266383832663566623930333636323261663039623865306430303138
65356665666261333830306336303938313133333962623934363338316639623435326665653566
39303830383033393739353666636138333932653364343837616230613532306632303562386133
61303730616534376563363466326334613866643332373139386537323535366635633333393232
38393939636439653939363437626361663562383161656166393666343731313638346337313261
31306263383563623935343236336566343637363331393562353761323962373464313364306361
37663831643530376363306635313562653762346436616261373634633737373135633039656565
66383033303031623633663933633035633636616263383237383466333435363965393739316636
36326437653339613738333937363161343865376166396539346432633836613230323762363462
34373639376461336137383438393931323930316139346163626531303564613536396263643936
32353637386366623139383637313637356565373039326233343362386433363463653864663564
32396262616131616261393835633238393637376632653762333030613538343664613335643039
66636234656532393166346138653865343739643530336263353130623161663835626463326539
34326237333133316433
25 changes: 23 additions & 2 deletions ansible/group_vars/preprod/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
git_branch: re7

sder_mongodb_url: "{{ vault_sder_mongodb_url }}"
label_mongodb_url: "{{ vault_label_mongodb_url }}"
dbsder_api_key: "{{ vault_dbsder_api_key }}"
jwt_private_key: "{{ vault_jwt_private_key }}"

cookie_private_key: "{{ vault_cookie_private_key }}"
sso_sp_assertion_consumer_service_location: "{{ vault_sso_sp_assertion_consumer_service_location }}"
sso_sp_entity_id: "{{ vault_sso_sp_entity_id }}"
sso_idp_single_sign_on_service_location: "{{ vault_sso_idp_single_sign_on_service_location }}"
sso_idp_single_logout_service_location: "{{ vault_sso_idp_single_logout_service_location }}"
sso_front_success_connexion_annotator_url: "{{ vault_sso_front_success_connexion_annotator_url }}"
sso_front_success_connexion_admin_scrutator_url: "{{ vault_sso_front_success_connexion_admin_scrutator_url }}"
sso_front_success_connexion_publicator_url: "{{ vault_sso_front_success_connexion_publicator_url }}"

sso_idp_metadata: "sso-files/recette_idp_mj.xml"
sso_certificat: "sso-files/recette-certificate.pem"
sso_sp_private_key: "sso-files/recette-private.key"

# a enlever quand on adaptera le keycloack
sso_attribute_name: "nom"
sso_attribute_firstname: "prenom"
sso_attribute_mail: "mail"
sso_attribute_role: "roles"


s3_access_key: "{{ vault_s3_access_key }}"
s3_secret_key: "{{ vault_s3_secret_key }}"
Loading