Skip to content

Commit

Permalink
feat: updated model with new attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
NithinKuruba committed Apr 5, 2024
1 parent 436df1f commit fe09768
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.github.bcgov.keycloak.broker.oidc;

import java.util.List;
import java.util.HashMap;

import org.keycloak.broker.oidc.OIDCIdentityProvider;
import org.keycloak.broker.oidc.OIDCIdentityProviderConfig;
import org.keycloak.broker.oidc.OIDCIdentityProviderFactory;
import org.keycloak.models.IdentityProviderModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.provider.ProviderConfigProperty;
import org.keycloak.provider.ProviderConfigurationBuilder;

/** @author <a href="mailto:junmin@button.is">Junmin Ahn</a> */
public class OverrideOIDCIdentityProviderFactory extends OIDCIdentityProviderFactory {
Expand All @@ -22,18 +20,15 @@ public String getName() {

@Override
public OIDCIdentityProvider create(KeycloakSession session, IdentityProviderModel model) {
boolean legacyLogoutRedirectUriSupported = Boolean
.parseBoolean(model.getConfig().get("legacyLogoutRedirectUriSupported"));
model.setConfig(new HashMap<>(model.getConfig()));
model.getConfig().put("legacyLogoutRedirectUriSupported", String.valueOf(legacyLogoutRedirectUriSupported));
return new OverrideOIDCIdentityProvider(session, new OIDCIdentityProviderConfig(model));
}

@Override
public String getId() {
return PROVIDER_ID;
}

public List<ProviderConfigProperty> getConfigProperties() {
return ProviderConfigurationBuilder.create().property()
.name("legacyLogoutRedirectUriSupported").label("Legacy Logout Redirect URI")
.helpText("Does the external IDP support legacy logout redirect URI (redirect_uri)?")
.type(ProviderConfigProperty.BOOLEAN_TYPE).add().build();
}
}

0 comments on commit fe09768

Please sign in to comment.