org.keycloak.examples.providers.authentication

## Class PropertiesAuthenticationProvider

- java.lang.Object
- - org.keycloak.examples.providers.authentication.PropertiesAuthenticationProvider

- All Implemented Interfaces:
    AuthenticationProvider, Provider

      public class PropertiesAuthenticationProvider
      extends Object
      implements AuthenticationProvider

  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertiesAuthenticationProvider(Properties properties)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `List<String>` | `getAvailableOptions()` Get names of all available configuration options of current provider
    `String` | `getName()`
    `AuthUser` | `getUser(RealmModel realm, Map<String,String> configuration, String username)` Get user by given username or email.
    `String` | `registerUser(RealmModel realm, Map<String,String> configuration, String username)` Try to register user with this authentication provider
    `boolean` | `updateCredential(RealmModel realm, Map<String,String> configuration, String username, String password)` Update credential
    `AuthProviderStatus` | `validatePassword(RealmModel realm, Map<String,String> configuration, String username, String password)` Standard Authentication flow

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

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

- - ### Constructor Detail

    - #### PropertiesAuthenticationProvider

          public PropertiesAuthenticationProvider(Properties properties)

  - ### Method Detail

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `AuthenticationProvider`

    - #### getAvailableOptions

          public List<String> getAvailableOptions()

      Description copied from interface: `AuthenticationProvider`
      Get names of all available configuration options of current provider
      Specified by:
        `getAvailableOptions` in interface `AuthenticationProvider`
      Returns:
        options or empty list if no options available

    - #### getUser

          public AuthUser getUser(RealmModel realm,
                         Map<String,String> configuration,
                         String username)
                           throws AuthenticationProviderException

      Description copied from interface: `AuthenticationProvider`
      Get user by given username or email. Return user instance or null if user doesn't exists in this authentication provider
      Specified by:
        `getUser` in interface `AuthenticationProvider`
        `username` - or email
      Returns:
        found user or null if user with given username doesn't exists
      Throws:
        `AuthenticationProviderException`

    - #### registerUser

          public String registerUser(RealmModel realm,
                            Map<String,String> configuration,
                            String username)
                              throws AuthenticationProviderException

      Description copied from interface: `AuthenticationProvider`
      Try to register user with this authentication provider
      Specified by:
        `registerUser` in interface `AuthenticationProvider`
      Returns:
        ID of newly created user (For example ID from LDAP)
      Throws:
        `AuthenticationProviderException` - if user creation couldn't happen

    - #### validatePassword

          public AuthProviderStatus validatePassword(RealmModel realm,
                                            Map<String,String> configuration,
                                            String username,
                                            String password)
                                              throws AuthenticationProviderException

      Description copied from interface: `AuthenticationProvider`
      Standard Authentication flow
      Specified by:
        `validatePassword` in interface `AuthenticationProvider`
      Returns:
        result of authentication, which might eventually encapsulate info about authenticated user and provider which successfully authenticated
      Throws:
        `AuthenticationProviderException`

    - #### updateCredential

          public boolean updateCredential(RealmModel realm,
                                 Map<String,String> configuration,
                                 String username,
                                 String password)
                                   throws AuthenticationProviderException

      Description copied from interface: `AuthenticationProvider`
      Update credential
      Specified by:
        `updateCredential` in interface `AuthenticationProvider`
      Returns:
        true if credential has been successfully updated
      Throws:
        `AuthenticationProviderException`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

Copyright © 2014. All Rights Reserved.