Last active
July 2, 2025 14:26
-
-
Save Elektordi/5ad622d5ebba3a6ba5eaaf8d43d2b7cf to your computer and use it in GitHub Desktop.
Keycloak login using IDP only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"authenticators": [ | |
{ | |
"name": "Identity Provider Selector", | |
"fileName": "login-idp.js", | |
"description": "(Guillaume Genty, 2025)" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#import "template.ftl" as layout> | |
<@layout.registrationLayout displayMessage=!messagesPerField.existsError('username'); section> | |
<#if section = "header"> | |
${msg("loginAccountTitle")} | |
<#elseif section = "socialProviders" > | |
<#if realm.password && social?? && social.providers?has_content> | |
<div id="kc-social-providers" class="${properties.kcFormSocialAccountSectionClass!}"> | |
<ul class="${properties.kcFormSocialAccountListClass!}"> | |
<#list social.providers as p> | |
<a data-once-link data-disabled-class="${properties.kcFormSocialAccountListButtonDisabledClass!}" id="social-${p.alias}" | |
class="${properties.kcFormSocialAccountListButtonClass!}" | |
type="button" href="${p.loginUrl}"> | |
<#if p.iconClasses?has_content> | |
<i class="${properties.kcCommonLogoIdP!} ${p.iconClasses!}" aria-hidden="true"></i> | |
<span class="${properties.kcFormSocialAccountNameClass!} kc-social-icon-text">${p.displayName!}</span> | |
<#else> | |
<span class="${properties.kcFormSocialAccountNameClass!}">${p.displayName!}</span> | |
</#if> | |
</a> | |
</#list> | |
</ul> | |
</div> | |
</#if> | |
</#if> | |
</@layout.registrationLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bindings: script, realm, user, session, authenticationSession, httpRequest, LOG | |
function authenticate(context) { | |
var challenge = context.form().createForm("login-idp.ftl"); | |
context.challenge(challenge); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment