[keycloak-user] Seamless login

Julien Pivotto roidelapluie at inuits.eu
Thu Aug 2 04:02:59 EDT 2018


See https://github.com/ohioit/keycloak-link-idp-with-user to achieve this (needs some updates for KC4 -- see attachment)


-- 
 (o-    Julien Pivotto
 //\    Open-Source Consultant
 V_/_   Inuits - https://www.inuits.eu
-------------- next part --------------
commit d1906ee1d074dc9341531e54bd97b229e855b175
Author: Julien Pivotto <roidelapluie at inuits.eu>
Date:   Wed Aug 1 21:02:22 2018 +0200

    Switch to new keycloak
    
    Signed-off-by: Julien Pivotto <roidelapluie at inuits.eu>

diff --git a/pom.xml b/pom.xml
index 8b5c477..f29b723 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,14 +17,14 @@
     <properties>
-        <keycloak.version>1.9.0.Final</keycloak.version>
+        <keycloak.version>4.1.0.Final</keycloak.version>
         <outputDirectory>${project.build.directory}</outputDirectory>
     </properties>
 
@@ -41,6 +41,12 @@
             <scope>provided</scope>
             <version>${keycloak.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.keycloak</groupId>
+            <artifactId>keycloak-server-spi-private</artifactId>
+            <scope>provided</scope>
+            <version>${keycloak.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.jboss.logging</groupId>
             <artifactId>jboss-logging</artifactId>
diff --git a/src/main/java/edu/ohio/ais/keycloak/authentication/LinkIdpLoginAuthenticator.java b/src/main/java/edu/ohio/ais/keycloak/authentication/LinkIdpLoginAuthenticator.java
index f9726c5..5c24f78 100644
--- a/src/main/java/edu/ohio/ais/keycloak/authentication/LinkIdpLoginAuthenticator.java
+++ b/src/main/java/edu/ohio/ais/keycloak/authentication/LinkIdpLoginAuthenticator.java
@@ -35,11 +35,11 @@ import org.keycloak.services.ServicesLogger;
  * @author Ilya Kogan
  */
 public class LinkIdpLoginAuthenticator implements Authenticator {
-    protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
+    protected static ServicesLogger logger = ServicesLogger.LOGGER;
 
     public void authenticate(AuthenticationFlowContext context) {
         logger.debug("Auto-linking IdP login to federated identity.");
-        UserModel existingUser = AbstractIdpAuthenticator.getExistingUser(context.getSession(), context.getRealm(), context.getClientSession());
+        UserModel existingUser = AbstractIdpAuthenticator.getExistingUser(context.getSession(), context.getRealm(), context.getAuthenticationSession());
 
         if(existingUser != null) {
             context.setUser(existingUser);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20180802/8bba6266/attachment.bin 


More information about the keycloak-user mailing list