Skip to content

Commit

Permalink
Fix logout URL for France Connect V2
Browse files Browse the repository at this point in the history
Signed-off-by: Cédric Couralet <[email protected]>
  • Loading branch information
micedre committed Jan 4, 2022
1 parent 9ff1c9f commit eedfbed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/main/resources/france-connect.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ france-connect.production.v1.logout.url=https://app.franceconnect.gouv.fr/api/v1
france-connect.integration.v2.authorization.url=https://auth.integ01.dev-franceconnect.fr/api/v2/authorize
france-connect.integration.v2.token.url=https://auth.integ01.dev-franceconnect.fr/api/v2/token
france-connect.integration.v2.userinfo.url=https://auth.integ01.dev-franceconnect.fr/api/v2/userinfo
france-connect.integration.v2.logout.url=https://auth.integ01.dev-franceconnect.fr/api/v2/logout
france-connect.integration.v2.logout.url=https://auth.integ01.dev-franceconnect.fr/api/v2/session/end
france-connect.integration.v2.issuer.url=https://auth.integ01.dev-franceconnect.fr/api/v2
france-connect.integration.v2.jwks.url=https://auth.integ01.dev-franceconnect.fr/api/v2/jwks
france-connect.integration.v2.use.jwks.url=true

france-connect.production.v2.authorization.url=https://auth.franceconnect.gouv.fr/api/v2/authorize
france-connect.production.v2.token.url=https://auth.franceconnect.gouv.fr/api/v2/token
france-connect.production.v2.userinfo.url=https://auth.franceconnect.gouv.fr/api/v2/userinfo
france-connect.production.v2.logout.url=https://auth.franceconnect.gouv.fr/api/v2/logout
france-connect.production.v2.logout.url=https://auth.franceconnect.gouv.fr/api/v2/session/end
france-connect.production.v2.issuer.url=https://auth.franceconnect.gouv.fr/api/v2
france-connect.production.v2.jwks.url=https://auth.franceconnect.gouv.fr/api/v2/jwks
france-connect.production.v2.use.jwks.url=true
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
package fr.insee.keycloak.providers.franceconnect;

import fr.insee.keycloak.providers.common.EidasLevel;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
import org.junit.jupiter.api.Test;
import org.keycloak.models.RealmModel;

import static fr.insee.keycloak.providers.franceconnect.FCFixture.givenConfigForIntegrationV2AndEidasLevel2;
import static fr.insee.keycloak.providers.franceconnect.FCFixture.givenConfigWithSelectedEnvAndSelectedEidasLevel;
import static fr.insee.keycloak.providers.franceconnect.FranceConnectIdentityProviderFactory.FC_PROVIDER_MAPPERS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import fr.insee.keycloak.providers.common.EidasLevel;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
import org.junit.jupiter.api.Test;
import org.keycloak.models.RealmModel;

@DisplayNameGeneration(ReplaceUnderscores.class)
class FranceConnectIdentityProviderConfigTest {

@Test
void should_initialize_config_with_selected_eidas_level_from_admin_interface() {
var config = givenConfigWithSelectedEnvAndSelectedEidasLevel(
"integration_v1", "eidas1"
);
var config = givenConfigWithSelectedEnvAndSelectedEidasLevel("integration_v1", "eidas1");

assertThat(config.getEidasLevel()).isEqualTo(EidasLevel.EIDAS1);

config = givenConfigWithSelectedEnvAndSelectedEidasLevel(
"integration_v1", "eidas2"
);
config = givenConfigWithSelectedEnvAndSelectedEidasLevel("integration_v1", "eidas2");

assertThat(config.getEidasLevel()).isEqualTo(EidasLevel.EIDAS2);

config = givenConfigWithSelectedEnvAndSelectedEidasLevel(
"integration_v1", "eidas3"
);
config = givenConfigWithSelectedEnvAndSelectedEidasLevel("integration_v1", "eidas3");

assertThat(config.getEidasLevel()).isEqualTo(EidasLevel.EIDAS3);
}

@Test
void should_initialize_config_with_url_properties_corresponding_to_selected_environment_from_admin_interface() {
void
should_initialize_config_with_url_properties_corresponding_to_selected_environment_from_admin_interface() {
var config = givenConfigForIntegrationV2AndEidasLevel2();

assertThat(config.getAuthorizationUrl()).isNotNull().endsWith("/authorize");
assertThat(config.getTokenUrl()).isNotNull().endsWith("/token");
assertThat(config.getUserInfoUrl()).isNotNull().endsWith("/userinfo");
assertThat(config.getLogoutUrl()).isNotNull().endsWith("/logout");
assertThat(config.getLogoutUrl()).isNotNull().endsWith("/session/end");
assertThat(config.getIssuer()).isNotNull();
assertThat(config.isUseJwksUrl()).isTrue();
assertThat(config.getJwksUrl()).endsWith("/jwks");
}

@Test
void should_initialize_config_with_selected_ignoreAbsentStateParameterLogout_from_admin_interface() {
void
should_initialize_config_with_selected_ignoreAbsentStateParameterLogout_from_admin_interface() {
var config = givenConfigForIntegrationV2AndEidasLevel2();

assertThat(config.isIgnoreAbsentStateParameterLogout()).isFalse();
Expand Down

0 comments on commit eedfbed

Please sign in to comment.