Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oAuth + AV batch + DELETE route + many fixes. #21

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
dd9adaa
chore: wip oauth2
Oct 2, 2024
d6bfd7a
In progress
Oct 2, 2024
38deb7d
fix: decode token
Oct 2, 2024
394a147
fix: decode token
Oct 2, 2024
ac7e343
In progress ....Auth2
Oct 2, 2024
a48edd7
fix: refactored oauth2
Oct 3, 2024
971fb06
feat: oauth2
Oct 3, 2024
7b6101e
chore: added env variables
Oct 3, 2024
d5f7e32
chore: refactored security module
Oct 3, 2024
685eb2d
feat: added tests for security module
Oct 3, 2024
0997e08
fix: clean code
Oct 3, 2024
069752b
oAuth2 fix tests
Oct 3, 2024
884c7d2
oAuth2 fix tests
Oct 3, 2024
96b3c62
Merge branch 'feat/oauth' of ssh://git.boost.open.global:443/cour_de_…
Oct 3, 2024
38afa53
oAuth2 fix tests
Oct 3, 2024
7d86d18
Merge branch 'feat/oauth' into 'develop'
s-diallo Oct 3, 2024
30398d8
Merge branch 'develop' into 'master'
s-diallo Oct 3, 2024
7807779
chore: merge with casslab de
Oct 3, 2024
d56c8da
chore: merge with casslab de
Oct 3, 2024
fc25d6e
Merge branch 'detached' into 'develop-open'
s-diallo Oct 3, 2024
8376281
fix: vars refacto
Oct 3, 2024
4fc93d3
docs: test file deleted
s-diallo Oct 3, 2024
a3ac60e
feat: Archive PDF after antivirus scanning with batch processing
s-diallo Nov 6, 2024
9c0efc3
Merge branch 'release-av' into 'develop-open'
s-diallo Nov 6, 2024
4ac00ee
fix: Bucket path fix
Nov 6, 2024
ac5f4f6
Merge branch 'release-av' into 'develop-open'
s-diallo Nov 6, 2024
3d092b6
style: lint
Nov 6, 2024
232f61c
fix: PDF key in S3
Nov 15, 2024
559b591
fix: set PDF original file name to PDF metadata on S3
Nov 18, 2024
ee6a79e
Merge branch 'fix/bucket-pdf-filename' into 'develop-open'
s-diallo Nov 18, 2024
22a9866
vulnerability: fix (eslint/plugin-kit & cross-spawn) highs vulnerabil…
Nov 18, 2024
93bbb35
Merge branch 'fix-vulnerability' into 'develop-open'
s-diallo Nov 18, 2024
3443880
Merge branch 'dev' into develop-open
SebCourvoisier Nov 21, 2024
b32b039
Merge pull request #20 from Cour-de-cassation/develop-open
SebCourvoisier Nov 21, 2024
e1efe03
Fix a syntax error (that was in the open branch)
SebCourvoisier Nov 21, 2024
40fc57f
Fix package-lock.json
SebCourvoisier Nov 21, 2024
9472911
Restore basicAuth, as it is required for the /doc routes...
SebCourvoisier Nov 21, 2024
474f8ad
Restore DELETE + basicAuth tests
SebCourvoisier Nov 21, 2024
d804813
Set proper S3_ARCHIVE_SCHEDULE (at 6pm)
SebCourvoisier Nov 21, 2024
f764592
Internalize oAuth
SebCourvoisier Nov 26, 2024
a05aeed
Better Postman tests
SebCourvoisier Nov 26, 2024
953e0fb
Envs and secrets cleanup (step 1/3)
SebCourvoisier Nov 26, 2024
c2cc255
Envs and secrets cleanup (step 2/3)
SebCourvoisier Nov 26, 2024
e6c0220
Envs and secrets cleanup (step 3/3)
SebCourvoisier Nov 26, 2024
0024b2c
Update setupEnvVars.ts
SebCourvoisier Nov 26, 2024
9cd2f40
Update Postman project
SebCourvoisier Nov 28, 2024
b13f4b0
Use idDecision instead of uuid
SebCourvoisier Dec 3, 2024
a77524b
Implement deletion (partially)
SebCourvoisier Dec 3, 2024
e1a2747
Mark decision for deletion. Add missing env vars declarations
SebCourvoisier Dec 4, 2024
9483f64
Make it prettier, make it better?
SebCourvoisier Dec 4, 2024
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
26 changes: 0 additions & 26 deletions .env.dev

This file was deleted.

31 changes: 19 additions & 12 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@

### Minio
S3_BUCKET_NAME_RAW=juritcom-test-bucket
S3_BUCKET_PDF_PATH=/
S3_BUCKET_METADATA_PATH=/
S3_URL=http://localhost:9000
S3_ACCESS_KEY=root
S3_SECRET_KEY=root1234
S3_BUCKET_NAME_PDF=juritcom-archive-pdf
S3_BUCKET_NAME_DELETION=juritcom-deletion-bucket
S3_BUCKET_NAME_NORMALIZED=juritcom-test-bucket-normalized
S3_URL=http://localhost:9000
S3_ACCESS_KEY=local_access_key
S3_SECRET_KEY=local_secret_key
S3_REGION=eu-west-paris-1
S3_BUCKET_NAME_NORMALIZED=juritcom-test-bucket

### DBSDER_API à adapter pour les valeurs
DBSDER_API_URL=http://localhost:9000
DBSDER_API_KEY=2512d1bc-1105-4221-ba0a-9adb15478bbc
DBSDER_API_KEY=xxx

### DOC à adapter les valeurs
DOC_LOGIN=test
DOC_PASSWORD=test1234
DOC_LOGIN=xxx
DOC_PASSWORD=xxx

### COMMISSIONING DATE
COMMISSIONING_DATE=20240809
OAUTH_PROVIDER_URL='http://localhost:3000'
OAUTH_CLIENT_ID='xxx'
OAUTH_CLIENT_SECRET='xxx'
OAUTH_TOKEN_URL='http://localhost:3000/token'

### App
PORT=3000
## PDF STORAGE
AV_PDF_PATH=./AV_PDF_PATH
## PDF FILENAME SEPARATOR
S3_PDF_FILE_NAME_SEPARATOR=_-_-_-_
## CRON TIME (to update)
S3_ARCHIVE_SCHEDULE='0 18 * * * *'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ web_modules/
.env.production.local
.env.local
docker.env
.env.dev

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down
99 changes: 0 additions & 99 deletions .open-gitlab-ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ Pour effectuer des tests Postman sur l'environnement de développement :

Un Swagger est disponible à l'url `/doc` ou via `/doc-json`

Il vous suffit d'utiliser les variables DOC_LOGIN et DOC_PASSWORD à votre disposition pour vous authentifier.
L'API utilise le protocole OAuth 2 avec un flow client credentials, et l'utilisation d'un jeton JWT valide est requise pour accéder aux différents endpoints.
7 changes: 7 additions & 0 deletions ansible/group_vars/all/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ api_port: "3000"
doc_login: "root"
s3_region: "eu-west-paris-1"
s3_bucket_name: "juritcom-bucket"
s3_bucket_name_pdf: "juritcom-bucket-pdf"
s3_bucket_name_deletion: "juritcom-bucket-deletion"
s3_bucket_name_normalized: "juritcom-bucket-normalized"
s3_url: "http://bucket-service.juritj.svc.cluster.local:9000"
dbsder_api_url: "http://{{ api_service }}.dbsder:3000"
no_color: "true"
normalization_batch_schedule: "* * * * *"
oauth_client_id: "juritcom"
oauth_provider_url: "http://localhost:{{ api_port }}"
oauth_token_url: "{{ oauth_provider_url }}/token"
s3_archive_schedule: "0 18 * * * *"
s3_pdf_file_name_separator: "_-_-_-_"
2 changes: 2 additions & 0 deletions ansible/group_vars/dev/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ s3_secret_key: "{{ vault_s3_secret_key }}"
dbsder_api_key: "{{ vault_dbsder_api_key }}"
doc_password: "{{ vault_doc_password }}"
minio_root_password: "{{ vault_minio_root_password }}"
av_pdf_path: "{{ vault_av_pdf_path }}"
oauth_client_secret: "{{ vault_oauth_client_secret}}"

commissioning_date: "2023-01-01"
master_node_name: "judilibre-dev"
42 changes: 25 additions & 17 deletions ansible/group_vars/dev/vault.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
$ANSIBLE_VAULT;1.1;AES256
33623264396532633166343836633762626661383539313733363638663333316638326561383766
6238303663633566303733353734376266343361346462620a333733653239643931626161636163
31313836646165356465326133663636373666653562623734616333646632303833653334333030
3933313038383464340a303839336133303661353234646138306335363338656538643239623966
38653262656439363166633164643966656665383735623361393737313938653733383965653161
38323530313930613930343065656630306534333839633037363262616364643965333365656630
66623932376661373536353630383066303164316134613230323362366166633562636634663038
63366330356363366138646565386233353338346636343635636437363435313636373236346264
65323663393835636566663164623839623863356565373462623463303930323738353038303530
32613934303439623165373134303933303431393139303835343561636661636365666466356464
37323630646436636139613934646431363831323335613363343365396132363833333065633831
38653839396430636130613231336266646566646438353437306231366431323332353536323739
63653661613266383466323064353439646361643266643263363630313134656565343362346264
34386266323665633365346336653333323761613962666436323363643539393232383832373536
34323034313265356638666233343338373138613262396334396235323733633165363533303738
33613564336565343261613761346633333564346636333234613438383463366564636235366361
3638
66333037373533663166663164356337616136376164386465323639626638363462323264653839
3265386337366364306362383465303531316362383133610a313634396631653662623030363566
31616133306233306633303638313866653061656162373162326232653164663861343534396434
3036353761303432320a666635313064666635636166653437336238306637626634363262653066
33303439316133613462656535643931373963306237643061393536333535336466333434366161
61633162633337343733616536306430396133373438366532333736313738353732303463646461
33623462626631393065393163313930323862626230373164386532373563643137363537363439
63346463653339346233363661346331323431373361343366336464666233663239316537313261
65393861366263373262366333333431373236313466396236643462346661353038653933613833
66353238323630333861353365303733663666386664626632326230393832623737353066363163
37653066333566396236336161323039306231633831636233636437356334313637663635666163
37393561323537393064366162663130386161313531316366646665303430346430653332663133
32663437613139343062336532356332306165313032386539333737623534666666333665646637
61656532333265376664333033333732333064373432623532656230633939653039306266313130
64313065363733323861363239366166386135393164383032356535383930363033663935346636
34343234323066616563313336386538613132373734383233346563326230643265626266376438
39326163323065383865633935383464626365666635373733616439626165306161366665356233
30666163633434373961303663343234666330333636323263336233343464333138666164393063
31363766343031303639366162623265393861363464343765613435386338366433636162633231
66646430393163613866326366313431643239313632626633393663643235336465373733356339
36363838323964663361326536633336653966363434353430313534376537316637303965333265
33353430386232303066306666303937333433656336303566383461356562303935393162636637
34326132393234316437386466383965356337383364343665643765346238633434636431333536
62653038623632613561633630656233386631313336613935636261383535303466326239653931
31626331663762333263393030616462346630643463356262373465646130653032
2 changes: 2 additions & 0 deletions ansible/group_vars/preprod/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ s3_access_key: "{{ vault_s3_access_key }}"
s3_secret_key: "{{ vault_s3_secret_key }}"
dbsder_api_key: "{{ vault_dbsder_api_key }}"
doc_password: "{{ vault_doc_password }}"
av_pdf_path: "{{ vault_av_pdf_path }}"
oauth_client_secret: "{{ vault_oauth_client_secret}}"

commissioning_date: "2023-01-01"
master_node_name: "jud7vcorc901"
40 changes: 25 additions & 15 deletions ansible/group_vars/preprod/vault.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
$ANSIBLE_VAULT;1.1;AES256
37336631653865373062616136323235316136663137363835363534376465626437303635623034
3962343236653836333462303732316366623336343336300a626539313731643361393034383832
38303837653239663637393037366466356337616336313466643064313664383332303930373132
3836613264653236340a636664636366313966393264666165653738396632343038393664363932
63633562303165366436653865323066636433393262386466363362313662383835346135666331
32663738643336633031343764623637666561636630333363626136396265306463616365613663
34653736643064313665386637346664326264386562323466306636336231326661376231643636
32623438646630353532363132323032313837626539656236643532353765383033333663343235
30336265653766633430333262323536396631326435643434643866633162613737333435653936
61333639643161323330336333626235353732623939666532663831626661663066303532333962
30326661383830343161313635656436643131646365303035396530613535623732303537306235
36363737616230306631623363633365336436663938653634353064663262336534303663616463
36623863343430643632316163356365623131646266336262633161326638613461663634643331
33646239666666623936643439366132333264646537366334646234636130306630633530306539
363033383235393534333534363435356464
30306532303461303830393535663138316634366535316135393733623031633236306131303539
3934656132626139386535313465643234346434363366380a623264333763663665396663353965
64666337633164616665353466343035313331323738336232633934323431653338356136316130
3032616363303439300a356365366334646637326232626439663763326162636233396337656132
38663962303330613636393432626233633662353536633464663038376232393132306537616161
36656262303837363135643931383966393335366134653632376236643862376537626536323832
65333762396637366631383463656330333635303366333234373766306439353831376435353465
39323265313063326132633266653965326532653434346331346337306236613337313061393466
31363734373331343132643635333735656336653637323232626433323936643332623838373934
38376163643463343539386664393731373863383565323435373232666562356261656539323363
38653139343837656265396234323165333861333533653931366565373434393932353763383433
36303931643630626531353766633437343066376464616635623034616236316661323336383964
33353630363963383738343037366361313963396230313162316234633430636435656263623166
33353334623736383031356636613662396463616632623365663764633930663832363066666337
61633932663735663962303835303265346664393830613536313934333761313361343039626235
32383761363936363335626164366565643032393937386537633165326461633335353362643832
33616534643439363230626637636661623161303366363233633239316263663238343930623439
30656236623639383865613865653833656631346637393838336234633538626333333332396236
36393637646530623334383532653033393938316664633939353930326639316266333832333831
63363134623937356437376632396636666131663165303766383064343731356238613038663436
37353137343637663030626333323633366366656436613831353962356134393063303739383031
65633135366334616332356161633732383834306638303466343966336566653134653931366131
31336365336362343934656331343737353366336537373439393730613734333637346538396661
38643636333533393863396132366363366134353036643838666534303963353538346264323334
33346237336137333030316230343464653637663136336564356462656461333562
2 changes: 2 additions & 0 deletions ansible/group_vars/prod/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ s3_access_key: "{{ vault_s3_access_key }}"
s3_secret_key: "{{ vault_s3_secret_key }}"
dbsder_api_key: "{{ vault_dbsder_api_key }}"
doc_password: "{{ vault_doc_password }}"
av_pdf_path: "{{ vault_av_pdf_path }}"
oauth_client_secret: "{{ vault_oauth_client_secret}}"

commissioning_date: "2023-12-15"
master_node_name: "jud7vcorc001"
40 changes: 25 additions & 15 deletions ansible/group_vars/prod/vault.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
$ANSIBLE_VAULT;1.1;AES256
63303632306636333138373831336262376466623062646162353035393863393464386436653635
3163333333326638613139303431633137643064666261320a616261656665393530353738626262
37363133333062623839323030343435646432303465336364366137356130393232393462306166
6165636534373031340a393666636266626236383435346134343630353333653135633838353234
35303064306139373232613839306166616362653036626439346164326162366663643762363331
65616533646631663639336261383562353336363331356530303535356230343432366665323036
33653963303163646466303864323137616462623662613666646433356539373164383235653032
39313565626338663038656534393064633338343735393362623932366163353165626631646364
32653735636538663531396539316361663035653364663635336134396463663736383661306137
34373534616331613734373936623437663034623862623330356232343264363332393634613762
34386133663732393334353834363764306133313833363535383033663537343163356635633539
64333466633361653137373666383631623431366538346539643637356261303837303238623938
30643564383266633432313234623163383933363032333035373133326133393931663562623735
65623465316664323437653936323939623836393963303338666164333435363764646131336133
656165303934376565653931313464663466
39353663326534653137613633663266656139633861633064656239353063336133656137636434
3163383965396339353561653832393761623362393431370a633439343739666336623937633037
62376531383862366137653637663362396134396438326531613639316238376561343236383030
3532306264373264310a366633396434376266393139613632303830303831373239326664366233
32353765316131373361323231396132336130323665396264663733376362336432316134343065
32633365356161613334326231616231323236346637626538376663393962346538373066643334
62383064373032343534366239316436353431636438356537616433353531663239623965323464
30613264393036363738646432656632626639666535303130616366363137356237363430613336
63366261616333313830623234333335366439626461626438626463376463363232613632383234
36666461653563616366323339343862346362626434346564316465653563636561376366363164
36656164643036613236373335356239666135396164333536336538636530623231633863316436
37663433636262646530313935613265363864303536383761383764643938613138343730343034
62333061666631336138386663363066643934356230653331326231616434353032633535663063
34346432653134653666373962373965623565326563626634613461333563626466663164616335
38333035366666663366313537373236393631306439653365336633316331623730626632326137
64383839353731623161343632643764623663313131303762323266666134643363376230373165
64376366326432663635373066353137643834376231653837323239656136343963396430623364
39616635623965313661633838313930383839323436353861333735643662383761313962366434
66333265633464396664336530363630613733316264363762636130333832656333623565323533
66636264393962366431323432383265336261366563373333353466386466623762343363396633
39653531373463306663663238393965636231623534333339666430653164313139393530663733
62663265373264653430386166343233636365336662656561323836663365376532386134396135
63313237373435353230643536356239646138313135316630313062363266346230323464376366
33346663323139333336363563666232373662363032343665343235343264666363646366343161
6665
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
DBSDER_API_URL: "{{ dbsder_api_url }}"
NO_COLOR: "{{ no_color }}"
PORT: "{{ api_port }}"
OAUTH_PROVIDER_URL: "{{ oauth_provider_url }}"
OAUTH_CLIENT_ID: "{{ oauth_client_id }}"
OAUTH_TOKEN_URL: "{{ oauth_token_url }}"

...
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@
S3_URL: "{{ s3_url }}"
S3_REGION: "{{ s3_region }}"
S3_BUCKET_NAME_RAW: "{{ s3_bucket_name }}"
S3_BUCKET_NAME_PDF: "{{ s3_bucket_name_pdf }}"
S3_BUCKET_NAME_DELETION: "{{ s3_bucket_name_deletion }}"
S3_BUCKET_NAME_NORMALIZED: "{{ s3_bucket_name_normalized }}"
S3_ARCHIVE_SCHEDULE: "{{ s3_archive_schedule }}"
S3_PDF_FILE_NAME_SEPARATOR: "{{ s3_pdf_file_name_separator }}"
...
3 changes: 2 additions & 1 deletion ansible/roles/deploy_juritcom/tasks/secret/secret_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
data:
DOC_PASSWORD: "{{ doc_password | b64encode }}"
DBSDER_API_KEY: "{{ dbsder_api_key | b64encode }}"

OAUTH_CLIENT_SECRET: "{{ oauth_client_secret | b64encode }}"
AV_PDF_PATH: "{{ av_pdf_path | b64encode }}"
...
Loading
Loading