Class BaseClient

All Implemented Interfaces:
Client
Direct Known Subclasses:
DirectClient, IndirectClient

public abstract class BaseClient extends InitializableObject implements Client
This class is the default implementation of an authentication client (whatever the mechanism).
Since:
1.4.0
Author:
Jerome Leleu
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
    • saveProfileInSession

      protected Boolean saveProfileInSession
  • Constructor Details

    • BaseClient

      public BaseClient()
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Client
      Get the name of the client.
      Specified by:
      getName in interface Client
      Returns:
      the name of the client
    • getCredentials

      public Optional<Credentials> getCredentials(CallContext ctx)
      Description copied from interface: Client
      Get the credentials from the context.
      Specified by:
      getCredentials in interface Client
      Parameters:
      ctx - the current context
      Returns:
      the credentials (optional)
    • validateCredentials

      public final Optional<Credentials> validateCredentials(CallContext ctx, Credentials credentials)
      Description copied from interface: Client
      Validate the credentials.
      Specified by:
      validateCredentials in interface Client
      Parameters:
      ctx - the current context
      credentials - the authentication credentials
      Returns:
      the credentials (optional)
    • internalValidateCredentials

      protected Optional<Credentials> internalValidateCredentials(CallContext ctx, Credentials credentials)
    • checkCredentials

      protected void checkCredentials(CallContext ctx, Credentials credentials)
      Check the credentials.
      Parameters:
      ctx - the context
      credentials - the credentials
    • getUserProfile

      public final Optional<UserProfile> getUserProfile(CallContext ctx, Credentials credentials)
      Description copied from interface: Client
      Get the user profile based on the credentials.
      Specified by:
      getUserProfile in interface Client
      Parameters:
      ctx - the context
      credentials - the authentication credentials
      Returns:
      the user profile (optional)
    • renewUserProfile

      public Optional<UserProfile> renewUserProfile(CallContext ctx, UserProfile profile)
      Description copied from interface: Client
      Renew the user profile.
      Specified by:
      renewUserProfile in interface Client
      Parameters:
      ctx - the current context
      profile - the user profile
      Returns:
      the renewed user profile (optional).
    • notifySessionRenewal

      public void notifySessionRenewal(CallContext ctx, String oldSessionId)
      Notify of the web session renewal.
      Parameters:
      ctx - the context
      oldSessionId - the old session identifier
    • setAuthorizationGenerators

      public void setAuthorizationGenerators(List<AuthorizationGenerator> authorizationGenerators)
    • setAuthorizationGenerators

      public void setAuthorizationGenerators(AuthorizationGenerator... authorizationGenerators)
    • setAuthorizationGenerator

      public void setAuthorizationGenerator(AuthorizationGenerator authorizationGenerator)
      Add an authorization generator.
      Parameters:
      authorizationGenerator - an authorizations generator
    • addAuthorizationGenerator

      public void addAuthorizationGenerator(AuthorizationGenerator authorizationGenerator)
    • addAuthorizationGenerators

      public void addAuthorizationGenerators(List<AuthorizationGenerator> authorizationGenerators)
    • setCredentialsExtractorIfUndefined

      protected void setCredentialsExtractorIfUndefined(CredentialsExtractor credentialsExtractor)
    • setAuthenticatorIfUndefined

      protected void setAuthenticatorIfUndefined(Authenticator authenticator)
    • setProfileCreatorIfUndefined

      protected void setProfileCreatorIfUndefined(ProfileCreator profileCreator)
    • setCustomProperties

      public void setCustomProperties(Map<String,Object> customProperties)
    • setProfileFactoryWhenNotAuthenticated

      public void setProfileFactoryWhenNotAuthenticated(ProfileFactory profileFactoryWhenNotAuthenticated)
    • isMultiProfile

      public boolean isMultiProfile(WebContext context, UserProfile profile)
    • getSaveProfileInSession

      public Boolean getSaveProfileInSession(WebContext context, UserProfile profile)