org.keycloak.examples.federation.properties

## Class BasePropertiesFederationProvider

- java.lang.Object
- - org.keycloak.examples.federation.properties.BasePropertiesFederationProvider

- All Implemented Interfaces:
    UserFederationProvider, Provider
  Direct Known Subclasses:
    ClasspathPropertiesFederationProvider, FilePropertiesFederationProvider

      public abstract class BasePropertiesFederationProvider
      extends Object
      implements UserFederationProvider

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.UserFederationProvider

      `UserFederationProvider.EditMode`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected UserFederationProviderModel` | `model`
    `protected Properties` | `properties`
    `protected KeycloakSession` | `session`
    `protected static Set<String>` | `supportedCredentialTypes`

    - ### Fields inherited from interface org.keycloak.models.UserFederationProvider

      `EMAIL, FIRST_NAME, LAST_NAME, USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasePropertiesFederationProvider(KeycloakSession session, UserFederationProviderModel model, Properties properties)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `UserFederationProviderModel` | `getModel()`
    `Properties` | `getProperties()`
    `KeycloakSession` | `getSession()`
    `Set<String>` | `getSupportedCredentialTypes(UserModel user)` hardcoded to only return PASSWORD
    `UserModel` | `getUserByEmail(RealmModel realm, String email)` Required to import into local storage any user found.
    `UserModel` | `getUserByUsername(RealmModel realm, String username)` Required to import into local storage any user found.
    `boolean` | `isValid(UserModel local)` See if the user is still in the properties file
    `void` | `preRemove(RealmModel realm)` called whenever a Realm is removed
    `void` | `preRemove(RealmModel realm, RoleModel role)` called before a role is removed.
    `List<UserModel>` | `searchByAttributes(Map<String,String> attributes, RealmModel realm, int maxResults)` We only search for Usernames as that is all that is stored in the properties file.
    `boolean` | `validCredentials(RealmModel realm, UserModel user, List<UserCredentialModel> input)` Validate credentials for this user.
    `boolean` | `validCredentials(RealmModel realm, UserModel user, UserCredentialModel... input)`

    - ### Methods inherited from class java.lang.Object

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

    - ### Methods inherited from interface org.keycloak.models.UserFederationProvider

      `proxy, register, removeUser, synchronizeRegistrations`

- - ### Field Detail

    - #### supportedCredentialTypes

          protected static final Set<String> supportedCredentialTypes

    - #### session

          protected KeycloakSession session

    - #### properties

          protected Properties properties

    - #### model

          protected UserFederationProviderModel model

  - ### Constructor Detail

    - #### BasePropertiesFederationProvider

          public BasePropertiesFederationProvider(KeycloakSession session,
                                          UserFederationProviderModel model,
                                          Properties properties)

  - ### Method Detail

    - #### getSession

          public KeycloakSession getSession()

    - #### getProperties

          public Properties getProperties()

    - #### getModel

          public UserFederationProviderModel getModel()

    - #### getUserByUsername

          public UserModel getUserByUsername(RealmModel realm,
                                    String username)

      Description copied from interface: `UserFederationProvider`
      Required to import into local storage any user found.
      Specified by:
        `getUserByUsername` in interface `UserFederationProvider`
      Returns:

    - #### getUserByEmail

          public UserModel getUserByEmail(RealmModel realm,
                                 String email)

      Description copied from interface: `UserFederationProvider`
      Required to import into local storage any user found.
      Specified by:
        `getUserByEmail` in interface `UserFederationProvider`
      Returns:

    - #### searchByAttributes

          public List<UserModel> searchByAttributes(Map<String,String> attributes,
                                           RealmModel realm,
                                           int maxResults)

      We only search for Usernames as that is all that is stored in the properties file. Not that if the user does exist in the properties file, we only import it if the user hasn't been imported already.
      Specified by:
        `searchByAttributes` in interface `UserFederationProvider`
      Parameters:
        `attributes` -
        `realm` -
        `maxResults` -
      Returns:

    - #### preRemove

          public void preRemove(RealmModel realm)

      Description copied from interface: `UserFederationProvider`
      called whenever a Realm is removed
      Specified by:
        `preRemove` in interface `UserFederationProvider`

    - #### preRemove

          public void preRemove(RealmModel realm,
                       RoleModel role)

      Description copied from interface: `UserFederationProvider`
      called before a role is removed.
      Specified by:
        `preRemove` in interface `UserFederationProvider`

    - #### isValid

          public boolean isValid(UserModel local)

      See if the user is still in the properties file
      Specified by:
        `isValid` in interface `UserFederationProvider`
      Parameters:
        `local` -
      Returns:

    - #### getSupportedCredentialTypes

          public Set<String> getSupportedCredentialTypes(UserModel user)

      hardcoded to only return PASSWORD
      Specified by:
        `getSupportedCredentialTypes` in interface `UserFederationProvider`
      Parameters:
        `user` -
      Returns:

    - #### validCredentials

          public boolean validCredentials(RealmModel realm,
                                 UserModel user,
                                 List<UserCredentialModel> input)

      Description copied from interface: `UserFederationProvider`
      Validate credentials for this user. This method will only be called with credential parameters supported by this provider
      Specified by:
        `validCredentials` in interface `UserFederationProvider`
      Returns:

    - #### validCredentials

          public boolean validCredentials(RealmModel realm,
                                 UserModel user,
                                 UserCredentialModel... input)

      Specified by:
        `validCredentials` in interface `UserFederationProvider`

    - #### close

          public void close()

      Specified by:
        `close` in interface `UserFederationProvider`
      Specified by:
        `close` in interface `Provider`

Copyright © 2014. All Rights Reserved.