Class MoodleAuthenticator

java.lang.Object
org.jdrupes.keycloak.moodleauth.MoodleAuthenticator
All Implemented Interfaces:
org.keycloak.authentication.Authenticator, org.keycloak.provider.Provider

public class MoodleAuthenticator extends Object implements org.keycloak.authentication.Authenticator
The Class MoodleAuthenticator.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    action(org.keycloak.authentication.AuthenticationFlowContext context)
    Called when the form has been submitted.
    void
    authenticate(org.keycloak.authentication.AuthenticationFlowContext context)
    Start the authentication by creating the form.
    void
    Not documented by keycloak.
    boolean
    configuredFor(org.keycloak.models.KeycloakSession session, org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
    Is this authenticator configured for this user.
    boolean
    User does not have to been identified, because this is a combined login/auto registration form.
    void
    setRequiredActions(org.keycloak.models.KeycloakSession session, org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
    Never called because MoodleAuthenticatorFactory.isUserSetupAllowed() returns false.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.keycloak.authentication.Authenticator

    areRequiredActionsEnabled, getRequiredActions
  • Constructor Details

  • Method Details

    • requiresUser

      public boolean requiresUser()
      User does not have to been identified, because this is a combined login/auto registration form.

      So return false;

      Specified by:
      requiresUser in interface org.keycloak.authentication.Authenticator
      Returns:
      false
    • configuredFor

      public boolean configuredFor(org.keycloak.models.KeycloakSession session, org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
      Is this authenticator configured for this user.
      Specified by:
      configuredFor in interface org.keycloak.authentication.Authenticator
      Parameters:
      session - the session
      realm - the realm
      user - the user
      Returns:
      true, if successful
    • setRequiredActions

      public void setRequiredActions(org.keycloak.models.KeycloakSession session, org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
      Never called because MoodleAuthenticatorFactory.isUserSetupAllowed() returns false.
      Specified by:
      setRequiredActions in interface org.keycloak.authentication.Authenticator
      Parameters:
      session - the session
      realm - the realm
      user - the user
    • close

      public void close()
      Not documented by keycloak.

      Probably supposed to release resources. Does nothing.

      Specified by:
      close in interface org.keycloak.provider.Provider
    • authenticate

      public void authenticate(org.keycloak.authentication.AuthenticationFlowContext context)
      Start the authentication by creating the form.
      Specified by:
      authenticate in interface org.keycloak.authentication.Authenticator
      Parameters:
      context - the context
    • action

      public void action(org.keycloak.authentication.AuthenticationFlowContext context)
      Called when the form has been submitted.

      Checks if the user/password combination is valid by trying to access the Moodle instance. If successful, creates the user if it doesn’t exist yet.

      Specified by:
      action in interface org.keycloak.authentication.Authenticator
      Parameters:
      context - the context