Package org.forgerock.openig.tools.am
Class AmService.Builder
- java.lang.Object
-
- org.forgerock.openig.tools.am.AmService.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder(Handler amHandler, Clock clock, String agentId, String cookieName, AmVersion version, UriService uriService, AuthenticationService authenticationService, AsyncRefreshableSupplier<SsoToken,AuthenticationException> tokenProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AmServicebuild()Returns a newAmServiceinstance.AmService.BuilderenableNotifications(boolean enabled)Enable or disable the notifications.AmService.BuildernotificationClientProvider(WebSocketClientProvider notificationClientProvider)Specifies theWebSocketClientProviderto use to manage notifications.AmService.BuildernotificationService(NotificationService notificationService)Bind aNotificationServiceinstance to this builder.AmService.BuildernotificationServiceConnectionAttempts(Integer initialConnectionAttempts)Specifies the number of Websocket connection attempts to try before failing the AmService creation.AmService.BuildernotificationServiceHeartbeat(Duration interval, ScheduledExecutorService executorService)Set up heartbeats sent to AM to keep the connection busy.AmService.BuildernotificationServiceProxyOptions(ProxyOptions proxyOptions)Specifies theProxyOptionsto use for the websocket connection.AmService.BuildernotificationServiceReconnectDelay(Duration delay)Specifies the delay to wait between connection re-establishments when web-socket connection is lost (or cannot be acquired at startup).AmService.BuildernotificationServiceTls(ClientTlsOptions tlsOptions)Specifies the TLS options to use for establishing a connection to the Web-socket endpoint.AmService.BuildersessionCache(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, Duration maximumTimeout, DisconnectionStrategy disconnectionStrategy)Specifies theCaffeinecache for theCacheSessionService.AmService.BuildersessionIdleRefresh(boolean enabled, Duration interval)Enable or disable the session idle refresh service and set the refresh interval.AmService.BuildersessionProperties(Set<String> sessionProperties)Set the session properties and return this builder.AmService.BuildersessionService(SessionService sessionService)Bind aSessionServiceinstance to this builder.
-
-
-
Constructor Detail
-
Builder
public Builder(Handler amHandler, Clock clock, String agentId, String cookieName, AmVersion version, UriService uriService, AuthenticationService authenticationService, AsyncRefreshableSupplier<SsoToken,AuthenticationException> tokenProvider)
-
-
Method Detail
-
enableNotifications
public AmService.Builder enableNotifications(boolean enabled)
Enable or disable the notifications.- Parameters:
enabled-trueif the notifications should be enabled orfalseotherwise.- Returns:
- this builder.
-
sessionIdleRefresh
public AmService.Builder sessionIdleRefresh(boolean enabled, Duration interval)
Enable or disable the session idle refresh service and set the refresh interval.- Parameters:
enabled-trueif the session idle refresh should be enabled orfalseotherwise.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 theCaffeinecache for theCacheSessionService. If the cache is set tonull, no cache will be used.- Parameters:
caffeine- TheCaffeinecache. If thecacheisnull, then the cache will be disabled.maximumTimeout- The maximum time to cache a session; can benull.disconnectionStrategy- The strategy to apply in case of notifications' disconnection.- Returns:
- this builder.
-
sessionService
public AmService.Builder sessionService(SessionService sessionService)
Bind aSessionServiceinstance 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.
-
notificationServiceReconnectDelay
public AmService.Builder notificationServiceReconnectDelay(Duration delay)
Specifies the delay to wait between connection re-establishments when web-socket connection is lost (or cannot be acquired at startup).- Parameters:
delay- reconnection delay used when notification service is disconnected- Returns:
- this builder.
-
notificationServiceHeartbeat
public AmService.Builder notificationServiceHeartbeat(Duration interval, ScheduledExecutorService executorService)
Set up heartbeats sent to AM to keep the connection busy. Specifies the interval between heartbeats sent to AM to keep the connection busy.- Parameters:
interval- the duration between heartbeats.Duration.UNLIMITEDorDuration.ZEROdisable the feature.executorService- theScheduledExecutorServiceto use to schedule heartbeat tasks- Returns:
- this builder.
-
notificationServiceConnectionAttempts
public AmService.Builder notificationServiceConnectionAttempts(Integer initialConnectionAttempts)
Specifies the number of Websocket connection attempts to try before failing the AmService creation.- Parameters:
initialConnectionAttempts- number of retries allowed to set up the first connection to the notification service- Returns:
- this builder.
-
notificationServiceTls
public AmService.Builder notificationServiceTls(ClientTlsOptions tlsOptions)
Specifies the TLS options to use for establishing a connection to the Web-socket endpoint.- Parameters:
tlsOptions- options to use when establishing secure connection to the WS endpoint- Returns:
- this builder.
-
notificationClientProvider
public AmService.Builder notificationClientProvider(WebSocketClientProvider notificationClientProvider)
Specifies theWebSocketClientProviderto use to manage notifications.- Parameters:
notificationClientProvider- service provider for service to be bound- Returns:
- this builder.
-
notificationServiceProxyOptions
public AmService.Builder notificationServiceProxyOptions(ProxyOptions proxyOptions)
Specifies theProxyOptionsto use for the websocket connection.- Parameters:
proxyOptions- theProxyOptionsto use for the websocket connection.- Returns:
- this builder.
-
notificationService
public AmService.Builder notificationService(NotificationService notificationService)
Bind aNotificationServiceinstance to this builder.- Parameters:
notificationService- service to be bound- Returns:
- this Builder
-
-