Class AuthenticationResult.Builder

java.lang.Object
org.nuclos.api.authentication.AuthenticationResult.Builder
Enclosing class:
AuthenticationResult

public static class AuthenticationResult.Builder extends Object
A builder for AuthenticationResult
  • Constructor Details

    • Builder

      protected Builder()
  • Method Details

    • withUsername

      public AuthenticationResult.Builder withUsername(String username)
      Either username or user id must be specified.
      Parameters:
      username - (could be null)
      Returns:
      this Builder instance (for chaining)
    • withUserId

      public AuthenticationResult.Builder withUserId(UID userId)
      Either username or user id must be specified.
      Parameters:
      userId - (could be null)
      Returns:
      this Builder instance (for chaining)
    • withMandatorId

      public AuthenticationResult.Builder withMandatorId(UID mandatorId)
      If mandators are in use, the new session will need a selected one, similar to the login with a web- or rich-client. Otherwise, permission checks could throw errors.
      Parameters:
      mandatorId - (could be null)
      Returns:
      this Builder instance (for chaining)
    • withLocale

      public AuthenticationResult.Builder withLocale(NuclosLocale locale)
      Default is NuclosLocale.DE_DE
      Parameters:
      locale - for the new session (not null)
      Returns:
      this Builder instance (for chaining)
    • withDataLanguage

      public AuthenticationResult.Builder withDataLanguage(NuclosLocale dataLanguage)
      Data language for the new session, if in use be the system.
      Parameters:
      dataLanguage - (could be null)
      Returns:
      this Builder instance (for chaining)
    • withServerUri

      public AuthenticationResult.Builder withServerUri(URI serverUri)
      Clients can reach the application server via this base URI. If not specified (null), the default settings are used. Maybe a reverse proxy exists between server and client and requires an adjustment. This is used to create referencing links between data.
      Parameters:
      serverUri - (could be null)
      Returns:
      this Builder instance (for chaining)
    • withLoginRequired

      public AuthenticationResult.Builder withLoginRequired(boolean loginRequired)
      Parameters:
      loginRequired - true if Nuclos should login the user. false (Default) drops the session after response.
      Returns:
      this Builder instance (for chaining)
      See Also:
    • withLifetime

      public AuthenticationResult.Builder withLifetime(long lifetime, TimeUnit unit)
      The default lifetime is AuthenticationResult.UNSET, which means that the system is handling the session lifetime only and a refresh is never called.
      Parameters:
      lifetime -
      unit - the unit that lifetime is expressed in
      Returns:
      this Builder instance (for chaining)
      See Also:
    • withAttribute

      public AuthenticationResult.Builder withAttribute(String attribute, String value)
      You can store important information here and access it later during a refresh.
      Parameters:
      attribute -
      value -
      Returns:
      this Builder instance (for chaining)
    • build

      public AuthenticationResult build()
      Returns:
      the AuthenticationResult with the requested parameters.