Package org.kohsuke.github.authorization
Class ImmutableAuthorizationProvider
- java.lang.Object
-
- org.kohsuke.github.authorization.ImmutableAuthorizationProvider
-
- All Implemented Interfaces:
AuthorizationProvider
public class ImmutableAuthorizationProvider extends Object implements AuthorizationProvider
AAuthorizationProvider
that always returns the same credentials
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.kohsuke.github.authorization.AuthorizationProvider
AuthorizationProvider.AnonymousAuthorizationProvider
-
-
Field Summary
-
Fields inherited from interface org.kohsuke.github.authorization.AuthorizationProvider
ANONYMOUS
-
-
Constructor Summary
Constructors Constructor Description ImmutableAuthorizationProvider(String authorization)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static 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
fromLoginAndPassword(String login, String password)
Deprecated.Login with password credentials are no longer supported by GitHubstatic 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 oauthAccessTokenString
getEncodedAuthorization()
Returns the credentials to be used with a given request.
-
-
-
Constructor Detail
-
ImmutableAuthorizationProvider
public ImmutableAuthorizationProvider(String authorization)
-
-
Method Detail
-
fromOauthToken
public static AuthorizationProvider fromOauthToken(String oauthAccessToken)
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
public static AuthorizationProvider fromOauthToken(String oauthAccessToken, String login)
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
public static AuthorizationProvider fromAppInstallationToken(String appInstallationToken)
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
public static AuthorizationProvider fromJwtToken(String jwtToken)
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
-
fromLoginAndPassword
@Deprecated public static AuthorizationProvider fromLoginAndPassword(String login, String password)
Deprecated.Login with password credentials are no longer supported by GitHubBuilds and returns aAuthorizationProvider
from the given user/password pair- Parameters:
login
- The login for the user, usually the same as the usernamepassword
- The password for the associated user- Returns:
- a correctly configured
AuthorizationProvider
that will always return the credentials for the same user and password combo
-
getEncodedAuthorization
public String 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
-
-