Package com.guinetik.rr.auth
Class NoAuthStrategy
- java.lang.Object
-
- com.guinetik.rr.auth.NoAuthStrategy
-
- All Implemented Interfaces:
AuthStrategy
public class NoAuthStrategy extends Object implements AuthStrategy
Authentication strategy that performs no authentication.This is the default strategy used when no authentication is configured. It does not add any authentication headers to requests.
Usage
// Explicitly create no-auth strategy AuthStrategy auth = AuthStrategyFactory.createNoAuth(); // Or simply don't set an auth strategy (default behavior) RocketRestConfig config = RocketRestConfig.builder("https://public-api.example.com") .build(); // Uses NoAuthStrategy by default- Since:
- 1.0.0
- Author:
- guinetik <guinetik@gmail.com>
- See Also:
AuthStrategy,AuthStrategyFactory.createNoAuth()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.guinetik.rr.auth.AuthStrategy
AuthStrategy.AuthType
-
-
Constructor Summary
Constructors Constructor Description NoAuthStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RocketHeadersapplyAuthHeaders(RocketHeaders headers)Applies authentication headers to an existing HttpHeader object.AuthStrategy.AuthTypegetType()Returns the auth type of this strategy.booleanneedsTokenRefresh()Indicates whether this strategy needs a token refresh.booleanrefreshCredentials()Handles refreshing the authentication credentials for strategies that support it.
-
-
-
Method Detail
-
getType
public AuthStrategy.AuthType getType()
Description copied from interface:AuthStrategyReturns the auth type of this strategy.- Specified by:
getTypein interfaceAuthStrategy- Returns:
- the authentication type
-
applyAuthHeaders
public RocketHeaders applyAuthHeaders(RocketHeaders headers)
Description copied from interface:AuthStrategyApplies authentication headers to an existing HttpHeader object.- Specified by:
applyAuthHeadersin interfaceAuthStrategy- Parameters:
headers- the current HttpHeader to update- Returns:
- the updated HttpHeader
-
needsTokenRefresh
public boolean needsTokenRefresh()
Description copied from interface:AuthStrategyIndicates whether this strategy needs a token refresh.- Specified by:
needsTokenRefreshin interfaceAuthStrategy- Returns:
- true if token refresh is required
-
refreshCredentials
public boolean refreshCredentials()
Description copied from interface:AuthStrategyHandles refreshing the authentication credentials for strategies that support it.- Specified by:
refreshCredentialsin interfaceAuthStrategy- Returns:
- true if the credentials were successfully refreshed
-
-