Package land.oras.auth
Class BearerTokenProvider
java.lang.Object
land.oras.auth.BearerTokenProvider
- All Implemented Interfaces:
AuthProvider
A provider for bearer token authentication
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new bearer token providerBearerTokenProvider(String token) Create a new bearer token provider -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetAuthHeader(ContainerRef registry) Get the authentication header for this providerGet the authentication scheme for this providergetIdentity(ContainerRef registry) Get an opaque identity marker for the credentials this provider resolves for the given registry.@Nullable HttpClient.TokenResponsegetToken()Get the tokenvoidsetToken(HttpClient.TokenResponse token) Set the token
-
Constructor Details
-
BearerTokenProvider
public BearerTokenProvider()Create a new bearer token provider -
BearerTokenProvider
Create a new bearer token provider- Parameters:
token- The token
-
-
Method Details
-
getToken
Get the token- Returns:
- The token
-
setToken
Set the token- Parameters:
token- The token
-
getAuthHeader
Description copied from interface:AuthProviderGet the authentication header for this provider- Specified by:
getAuthHeaderin interfaceAuthProvider- Parameters:
registry- The registry- Returns:
- The authentication header or null if not applicable
-
getAuthScheme
Description copied from interface:AuthProviderGet the authentication scheme for this provider- Specified by:
getAuthSchemein interfaceAuthProvider- Returns:
- The authentication scheme
-
getIdentity
Description copied from interface:AuthProviderGet an opaque identity marker for the credentials this provider resolves for the given registry. This marker is used to keyTokenCacheentries alongside the requestedScopes- Specified by:
getIdentityin interfaceAuthProvider- Parameters:
registry- The registry- Returns:
- A non-null identity marker
-