@@ -35,6 +35,16 @@ export class AppComponent implements OnInit, AfterViewInit {
3535 const authContainer = document . getElementById ( 'header-auth' )
3636 if ( ! authContainer ) return
3737
38+ let client_id
39+ if (
40+ encodeURIComponent ( window . location . href ) . includes ( 'qlf-' ) ||
41+ encodeURIComponent ( window . location . href ) . includes ( 'mut-dev' )
42+ ) {
43+ client_id = 'cartes-gouv-dev'
44+ } else {
45+ client_id = 'cartes-gouv-public'
46+ }
47+
3848 const renderLoggedOut = ( ) => {
3949 document . querySelectorAll ( '.login-btn' ) . forEach ( ( btn ) => {
4050 btn . addEventListener ( 'click' , ( ) => {
@@ -80,7 +90,7 @@ export class AppComponent implements OnInit, AfterViewInit {
8090 </li>
8191 <li>
8292 <div>
83- <a href="https://sso.geopf.fr/realms/geoplateforme/protocol/openid-connect/logout?post_logout_redirect_uri=${ currentUrl } &client_id=cartes-gouv-public "
93+ <a href="https://sso.geopf.fr/realms/geoplateforme/protocol/openid-connect/logout?post_logout_redirect_uri=${ currentUrl } &client_id=${ client_id } "
8494 class="fr-icon-logout-box-r-line fr-icon--sm custom-center-btn fr-btn fr-btn--tertiary fr-btn--sm fr-mt-3v fr-mx-2w">
8595 Se déconnecter
8696 </a>
@@ -107,7 +117,7 @@ export class AppComponent implements OnInit, AfterViewInit {
107117 const keycloak = new Keycloak ( {
108118 url : 'https://sso.geopf.fr' ,
109119 realm : 'geoplateforme' ,
110- clientId : 'cartes-gouv-public' ,
120+ clientId : client_id ,
111121 } )
112122
113123 // "Authorization Code" flow avec PKCE (type de client Keycloak : Public).
@@ -117,7 +127,7 @@ export class AppComponent implements OnInit, AfterViewInit {
117127 flow : 'standard' ,
118128 pkceMethod : 'S256' ,
119129 checkLoginIframe : false ,
120- silentCheckSsoRedirectUri : `${ window . location . origin } /silent-check-sso.html` ,
130+ silentCheckSsoRedirectUri : `${ window . location . origin } /assets/ silent-check-sso.html` ,
121131 } )
122132 . then ( async ( authenticated ) => {
123133 if ( ! authenticated ) {
0 commit comments