All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.castle.client.model.AuthenticateFailoverStrategy Maven / Gradle / Ivy

Go to download

Castle adds real-time monitoring of your authentication stack, instantly notifying you and your users on potential account hijacks.

There is a newer version: 2.4.2
Show newest version
package io.castle.client.model;

import io.castle.client.api.CastleApi;

/**
 * Stores settings for either using an AuthenticationAction or throwing a TimeoutException,
 * if a Castle API authenticate call fails.
 * 

* If a {@link CastleApi#authenticate} call fails during an authentication attempt, the failover strategy specifies * which {@link AuthenticateAction} should be used. * Alternatively, a TimeoutException instance could be configured. */ public class AuthenticateFailoverStrategy { private final AuthenticateAction defaultAction; private final boolean throwTimeoutException; private AuthenticateFailoverStrategy(AuthenticateAction defaultAction, boolean throwTimeoutException) { this.defaultAction = defaultAction; this.throwTimeoutException = throwTimeoutException; } /** * Sets the default authenticationAction for failed requests. * * @param action the authenticateAction that will be used as a default for failed requests */ public AuthenticateFailoverStrategy(AuthenticateAction action) { this(action, false); } /** * Creates an authenticationStrategy whose policy is to throw a timeoutException. */ public AuthenticateFailoverStrategy() { this(null, true); } /** * Gets the authenticateAction that this strategy uses for failover. * * @return the authenticateAction configured as default; null if there is no default AuthenticateAction */ public AuthenticateAction getDefaultAction() { return defaultAction; } /** * Checks whether the failover strategy is configured to throw a timeoutException. * * @return true if the failover strategy is set to throw a timeoutException, false otherwise */ public boolean isThrowTimeoutException() { return throwTimeoutException; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy