@dsivd/prestations-ng 18.3.1 → 18.3.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,45 @@
6
6
 
7
7
  ---
8
8
 
9
+ ## [18.3.2]
10
+
11
+ ### Added
12
+
13
+ - [IAM_ACV_MIGRATION_OIDC.md](IAM_ACV_MIGRATION_OIDC.md)
14
+
15
+ - Migration guide to protect IAM applications wiht OIDC instead of IAM headers (deprecated)
16
+
17
+ - [oidc-not-authenticated-interceptor.ts](projects/prestations-ng/src/oidc/oidc-not-authenticated-interceptor.ts)
18
+
19
+ - HTTP interceptor that redirect to login when using ng serve if the current application is behind IAM with OIDC
20
+
21
+ - [oidc-injection-token.ts](projects/prestations-ng/src/oidc/oidc-injection-token.ts)
22
+
23
+ - Enables the OidcNotAuthenticatedInterceptor
24
+
25
+ - [foehn-global-upload-progress-bar.component.ts](projects/prestations-ng/src/foehn-upload/foehn-upload-progress-bar/foehn-global-upload-progress-bar.component.ts)
26
+
27
+ - Added a global progress bar displaying upload progress of pending files
28
+
29
+ - [global-upload-progress.service.ts](projects/prestations-ng/src/foehn-upload/foehn-upload-progress-bar/global-upload-progress.service.ts)
30
+
31
+ - Added a global upload progress service to manage global progress bar
32
+
33
+ - [foehn-page.component.ts](projects/prestations-ng/src/foehn-page/foehn-page.component.ts)
34
+ - added a global progress bar to manage pending files upload
35
+
36
+ ## [18.3.1]
37
+
38
+ ### Added
39
+
40
+ - [foehn-breadcrumb.component.ts](projects/prestations-ng/src/foehn-breadcrumb/breadcrumb.ts)
41
+ - added optional property `urlTarget?: '_blank' | '_self' | '_parent' | '_top';`
42
+
43
+ ### Updated
44
+
45
+ - [foehn-breadcrumb.component.ts](projects/prestations-ng/src/foehn-breadcrumb/foehn-breadcrumb.component.ts)
46
+ - uses optional `urlTarget` property for external links
47
+
9
48
  ## [18.3.0] - should be aligned with prestations-be 18.3.x
10
49
 
11
50
  ### Added
@@ -0,0 +1,116 @@
1
+ # IAM ACV OIDC MIGRATION GUIDE
2
+
3
+ Back offices that are behind IAM ACV should migrate to OIDC, IAM headers are now deprecated.
4
+
5
+ ## ADMIN
6
+
7
+ - You have to request a new VIP for your application (<env>-<deployunit>.etat-de-vaud.ch)
8
+ - i.e. for eldoradobo (R260219_00034) : https://int-eldoradobo.etat-de-vaud.ch/
9
+ - On IAM side, you have to request a client id / secret on every environment to be used in your configuration
10
+
11
+ ## FRONTEND
12
+
13
+ - Enable the interceptor that is used for dev server by providing the following injection token in your app.module.ts : `{ provide: OIDC_ENABLED, useValue: 'true' }`
14
+ - Update your proxy.conf.json to add `/oauth2`, `/login`, `/logout` :
15
+
16
+ ```json
17
+ [
18
+ {
19
+ "context": ["/api", "/oauth2", "/login", "/logout"],
20
+ "target": "http://localhost:20900",
21
+ "secure": false
22
+ }
23
+ ]
24
+ ```
25
+
26
+ - update your angular.json
27
+
28
+ ```json
29
+ "baseHref": "/",
30
+ ```
31
+
32
+ ## BACKEND
33
+
34
+ - remove the server.servlet.context-path (your application should respond on "/")
35
+ - Replace this import : `cyberadminbe.config.CyberAdminBeSecurityConfig` with this one `backofficebe.config.IamAcvOidcSecurityConfiguration`
36
+ - add the following dependency :
37
+
38
+ ```xml
39
+ <dependency>
40
+ <groupId>org.springframework.boot</groupId>
41
+ <artifactId>spring-boot-starter-oauth2-client</artifactId>
42
+ </dependency>
43
+ ```
44
+
45
+ - update your application.properties with
46
+
47
+ ```properties
48
+ # OIDC common properties
49
+ spring.security.oauth2.client.registration.acv.client-name=SSO ACV
50
+ spring.security.oauth2.client.registration.acv.authorization-grant-type=authorization_code
51
+ spring.security.oauth2.client.registration.acv.scope=openid,profile,email
52
+ ```
53
+
54
+ - update your CO/environment.properties + UT/environment.properties with
55
+
56
+ ```properties
57
+ spring.security.oauth2.client.registration.acv.client-id=mock-client-id
58
+ spring.security.oauth2.client.registration.acv.client-secret=anySecret
59
+ spring.security.oauth2.client.provider.acv.issuer-uri=http://localhost:8080/acv
60
+ ```
61
+
62
+ - Expose the actuators on a different port, by updating your application.properties
63
+
64
+ ```properties
65
+ # With OIDC we have to expose actuators without any security to be called by spring boot admin
66
+ # so the are exposed on another port
67
+ management.server.port=${port.divers:8086}
68
+ # expose liveness/readiness probes on the same port as the application (/livez / readyz)
69
+ management.endpoint.health.probes.add-additional-paths=true
70
+ # send actuator access log to /dev/stdout
71
+ management.server.tomcat.accesslog.enabled=true
72
+ management.server.tomcat.accesslog.directory=/dev
73
+ management.server.tomcat.accesslog.prefix=stdout
74
+ management.server.tomcat.accesslog.suffix=
75
+ ```
76
+
77
+ ### TESTING
78
+
79
+ To be able to use @SpringBootTest, you have to :
80
+
81
+ - add the following dependency :
82
+
83
+ ```xml
84
+ <dependency>
85
+ <groupId>org.springframework.security</groupId>
86
+ <artifactId>spring-security-test</artifactId>
87
+ <scope>test</scope>
88
+ </dependency>
89
+ ```
90
+
91
+ - provide the token in your mock request, you can replace this helper :
92
+
93
+ ```java
94
+ static MockHttpServletRequestBuilder enrichWithAuthHeaders(MockHttpServletRequestBuilder builder) {
95
+ return builder.header("iam-userid", "sar8h6")
96
+ .header("iam-firstname", "Bruce")
97
+ .header("iam-lastname", "Wayne")
98
+ .header("iam-application", "app")
99
+ .header("iam-roles", "app-user");
100
+ }
101
+ ```
102
+
103
+ with methods from `ch.vd.cyber.backofficebe.utils.MVCTestUtils`:
104
+
105
+ - `enrichWithOidcTokenAsUser` : simulates that a request is done by an IAM user, with a valid OIDC token and the role "user"
106
+ - `enrichWithOidcTokenAsRole` : same as previous, but you can set another role than "user"
107
+ - `enrichWithAuthHeadersForEsgateAsUser` : simulates that a request is done by a techincal user through esgate and the role "user"
108
+ - `enrichWithAuthHeadersForEsgate` : same as previous, but you can set another role than "user"
109
+
110
+ ## RUNNING YOUR APP
111
+
112
+ - You can run a mock OIDC server with this command :
113
+
114
+ ```shell
115
+ podman run -p 8080:8080 --rm docker-registry.etat-de-vaud.ch/tools/mock-oidc:latest
116
+ ```