Module org.kohsuke.github.api
Package org.kohsuke.github.authorization
Class ImmutableAuthorizationProvider
java.lang.Object
org.kohsuke.github.authorization.ImmutableAuthorizationProvider
- All Implemented Interfaces:
AuthorizationProvider
An
AuthorizationProvider
that always returns the same credentials.-
Field Summary
Fields inherited from interface org.kohsuke.github.authorization.AuthorizationProvider
ANONYMOUS
-
Constructor Summary
ConstructorDescriptionImmutableAuthorizationProvider
(String authorization) ImmutableAuthorizationProvider constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthorizationProvider
fromAppInstallationToken
(String appInstallationToken) Builds and returns aAuthorizationProvider
from a given App Installation Tokenstatic AuthorizationProvider
fromJwtToken
(String jwtToken) Builds and returns aAuthorizationProvider
from a given jwtTokenstatic AuthorizationProvider
fromOauthToken
(String oauthAccessToken) Builds and returns aAuthorizationProvider
from a given oauthAccessTokenstatic AuthorizationProvider
fromOauthToken
(String oauthAccessToken, String login) Builds and returns aAuthorizationProvider
from a given oauthAccessTokenReturns the credentials to be used with a given request.
-
Constructor Details
-
ImmutableAuthorizationProvider
ImmutableAuthorizationProvider constructor- Parameters:
authorization
- the authorization string
-
-
Method Details
-
fromOauthToken
Builds and returns aAuthorizationProvider
from a given oauthAccessToken- Parameters:
oauthAccessToken
- The token- Returns:
- a correctly configured
AuthorizationProvider
that will always return the same provided oauthAccessToken
-
fromOauthToken
Builds and returns aAuthorizationProvider
from a given oauthAccessToken- Parameters:
oauthAccessToken
- The tokenlogin
- The login for this token- Returns:
- a correctly configured
AuthorizationProvider
that will always return the same provided oauthAccessToken
-
fromAppInstallationToken
Builds and returns aAuthorizationProvider
from a given App Installation Token- Parameters:
appInstallationToken
- A string containing the GitHub App installation token- Returns:
- the configured Builder from given GitHub App installation token.
-
fromJwtToken
Builds and returns aAuthorizationProvider
from a given jwtToken- Parameters:
jwtToken
- The JWT token- Returns:
- a correctly configured
AuthorizationProvider
that will always return the same provided jwtToken
-
getEncodedAuthorization
Description copied from interface:AuthorizationProvider
Returns the credentials to be used with a given request. As an example, a authorization provider for a bearer token will return something like:@Override public String getEncodedAuthorization() { return "Bearer myBearerToken"; }
- Specified by:
getEncodedAuthorization
in interfaceAuthorizationProvider
- Returns:
- encoded authorization string, can be null
-