Class AmService.Builder

java.lang.Object
org.forgerock.openig.tools.am.AmService.Builder
Enclosing class:
AmService

public static final class AmService.Builder extends Object
Builder of AmService.
  • Constructor Details

    • Builder

      public Builder(Handler amHandler, Clock clock, String agentId, String cookieName, AmVersion version, UriService uriService, AsyncRefreshableSupplier<SsoToken,AuthenticationException> tokenProvider)
      Create a Builder instance with every mandatory parameters.
      Parameters:
      amHandler - the Handler to use to query AM
      clock - the clock to use
      agentId - the ID identifying this AMService instance as an agent
      cookieName - the AM session cookie name
      version - the AM version
      uriService - the URI service to use
      tokenProvider - an AM token provider
  • Method Details

    • sessionIdleRefresh

      public AmService.Builder sessionIdleRefresh(boolean enabled, Duration interval)
      Enable or disable the session idle refresh service and set the refresh interval.
      Parameters:
      enabled - true if the session idle refresh should be enabled or false otherwise.
      interval - The interval between session idle refresh requests, when session idle refresh is enabled.
      Returns:
      this builder.
    • sessionCache

      public AmService.Builder sessionCache(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, Duration maximumTimeout, DisconnectionStrategy disconnectionStrategy)
      Specifies the Caffeine cache for the CacheSessionService. If the cache is set to null, no cache will be used.
      Parameters:
      caffeine - The Caffeine cache. If the cache is null, then the cache will be disabled.
      maximumTimeout - The maximum time to cache a session; can be null.
      disconnectionStrategy - The strategy to apply in case of notifications' disconnection.
      Returns:
      this builder.
    • sessionService

      public AmService.Builder sessionService(SessionService sessionService)
      Bind a SessionService instance to this builder.
      Parameters:
      sessionService - service to be bound
      Returns:
      this Builder
    • sessionProperties

      public AmService.Builder sessionProperties(Set<String> sessionProperties)
      Set the session properties and return this builder.
      Parameters:
      sessionProperties - The session properties that will be requested from the sessionInfo endpoint of the session service.
      Returns:
      this builder.
    • notification

      public AmService.Builder notification(NotificationsConfig config)
      Specifies the notification configurations. If not used the notifications are considered disabled.
      Parameters:
      config - the notifications configurations
      Returns:
      this builder.
    • notificationService

      public AmService.Builder notificationService(NotificationService notificationService)
      Bind a NotificationService instance to this builder.
      Parameters:
      notificationService - service to be bound
      Returns:
      this Builder
    • build

      public AmService build()
      Returns a new AmService instance.
      Returns:
      a new AmService instance.