Package land.oras.auth
Class BearerTokenProvider
java.lang.Object
land.oras.auth.BearerTokenProvider
- All Implemented Interfaces:
AuthProvider
A provider for bearer token authentication
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
The token response -
Constructor Summary
ConstructorsConstructorDescriptionBearerTokenProvider
(AuthProvider provider) Create a new bearer token provider -
Method Summary
Modifier and TypeMethodDescription@Nullable String
getAuthHeader
(ContainerRef registry) Get the authentication header for this provider@Nullable BearerTokenProvider.TokenResponse
getToken()
Get the tokenrefreshToken
(ContainerRef containerRef, OrasHttpClient client, OrasHttpClient.ResponseWrapper<String> response) Retrieve
-
Constructor Details
-
BearerTokenProvider
Create a new bearer token provider- Parameters:
provider
- The provider for username and password
-
-
Method Details
-
refreshToken
public BearerTokenProvider refreshToken(ContainerRef containerRef, OrasHttpClient client, OrasHttpClient.ResponseWrapper<String> response) Retrieve- Parameters:
response
- The responseclient
- The original clientcontainerRef
- The container reference- Returns:
- The token
-
getToken
Get the token- Returns:
- The token
-
getAuthHeader
Description copied from interface:AuthProvider
Get the authentication header for this provider- Specified by:
getAuthHeader
in interfaceAuthProvider
- Parameters:
registry
- The registry- Returns:
- The authentication header or null if not applicable
-