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
AnAuthorizationProviderthat always returns the same credentials.
-
-
Field Summary
-
Fields inherited from interface org.kohsuke.github.authorization.AuthorizationProvider
ANONYMOUS
-
-
Constructor Summary
Constructors Constructor Description ImmutableAuthorizationProvider(String authorization)ImmutableAuthorizationProvider constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static AuthorizationProviderfromAppInstallationToken(String appInstallationToken)Builds and returns aAuthorizationProviderfrom a given App Installation Tokenstatic AuthorizationProviderfromJwtToken(String jwtToken)Builds and returns aAuthorizationProviderfrom a given jwtTokenstatic AuthorizationProviderfromLoginAndPassword(String login, String password)Deprecated.Login with password credentials are no longer supported by GitHubstatic AuthorizationProviderfromOauthToken(String oauthAccessToken)Builds and returns aAuthorizationProviderfrom a given oauthAccessTokenstatic AuthorizationProviderfromOauthToken(String oauthAccessToken, String login)Builds and returns aAuthorizationProviderfrom a given oauthAccessTokenStringgetEncodedAuthorization()Returns the credentials to be used with a given request.
-
-
-
Constructor Detail
-
ImmutableAuthorizationProvider
public ImmutableAuthorizationProvider(String authorization)
ImmutableAuthorizationProvider constructor- Parameters:
authorization- the authorization string
-
-
Method Detail
-
fromOauthToken
public static AuthorizationProvider fromOauthToken(String oauthAccessToken)
Builds and returns aAuthorizationProviderfrom a given oauthAccessToken- Parameters:
oauthAccessToken- The token- Returns:
- a correctly configured
AuthorizationProviderthat will always return the same provided oauthAccessToken
-
fromOauthToken
public static AuthorizationProvider fromOauthToken(String oauthAccessToken, String login)
Builds and returns aAuthorizationProviderfrom a given oauthAccessToken- Parameters:
oauthAccessToken- The tokenlogin- The login for this token- Returns:
- a correctly configured
AuthorizationProviderthat will always return the same provided oauthAccessToken
-
fromAppInstallationToken
public static AuthorizationProvider fromAppInstallationToken(String appInstallationToken)
Builds and returns aAuthorizationProviderfrom 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 aAuthorizationProviderfrom a given jwtToken- Parameters:
jwtToken- The JWT token- Returns:
- a correctly configured
AuthorizationProviderthat 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 aAuthorizationProviderfrom 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
AuthorizationProviderthat will always return the credentials for the same user and password combo
-
getEncodedAuthorization
public String getEncodedAuthorization()
Description copied from interface:AuthorizationProviderReturns 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:
getEncodedAuthorizationin interfaceAuthorizationProvider- Returns:
- encoded authorization string, can be null
-
-