Skip to content

Commit

Permalink
feat: custom saml idp
Browse files Browse the repository at this point in the history
  • Loading branch information
NithinKuruba committed Jan 2, 2025
1 parent 790e4bb commit cae0b8c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.bcgov.keycloak.broker.saml;

import org.jboss.logging.Logger;
import org.keycloak.broker.saml.SAMLIdentityProvider;
import org.keycloak.broker.saml.SAMLIdentityProviderConfig;
import org.keycloak.events.EventBuilder;
Expand All @@ -9,6 +10,8 @@

public class OverrideSAMLIdentityProvider extends SAMLIdentityProvider {

protected static final Logger logger = Logger.getLogger(OverrideSAMLIdentityProvider.class);

private final DestinationValidator destinationValidator;

public OverrideSAMLIdentityProvider(KeycloakSession session, SAMLIdentityProviderConfig config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import org.keycloak.broker.saml.SAMLIdentityProviderConfig;
import org.keycloak.broker.saml.SAMLIdentityProviderFactory;
import org.keycloak.saml.validators.DestinationValidator;
import org.keycloak.Config;

public class OverrideSAMLIdentityProviderFactory extends SAMLIdentityProviderFactory {

public static final String PROVIDER_ID = "saml-custom";

private DestinationValidator destinationValidator;

@Override
Expand All @@ -23,6 +25,17 @@ public OverrideSAMLIdentityProvider create(KeycloakSession session, IdentityProv

@Override
public String getName() {
return "Custom SAML Identity Provider";
return "SAML v2.0 - Custom";
}

@Override
public void init(Config.Scope config) {
super.init(config);
this.destinationValidator = DestinationValidator.forProtocolMap(config.getArray("knownProtocols"));
}

@Override
public SAMLIdentityProviderConfig createConfig() {
return new SAMLIdentityProviderConfig();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<dependencies>
<module name="org.keycloak.keycloak-core" export="true" />
<module name="org.keycloak.keycloak-saml-core-public" export="true" />
<module name="org.keycloak.keycloak-saml-core" export="true" />
<module name="org.keycloak.keycloak-server-spi" export="true" />
<module name="org.keycloak.keycloak-server-spi-private" export="true" />
<module name="org.keycloak.keycloak-model-infinispan" export="true" />
Expand Down

0 comments on commit cae0b8c

Please sign in to comment.