Class ImmutableAuthorizationProvider

java.lang.Object
org.kohsuke.github.authorization.ImmutableAuthorizationProvider
All Implemented Interfaces:
AuthorizationProvider

public class ImmutableAuthorizationProvider extends Object implements AuthorizationProvider
An AuthorizationProvider that always returns the same credentials.
  • Constructor Details

    • ImmutableAuthorizationProvider

      public ImmutableAuthorizationProvider(String authorization)
      ImmutableAuthorizationProvider constructor
      Parameters:
      authorization - the authorization string
  • Method Details

    • fromOauthToken

      public static AuthorizationProvider fromOauthToken(String oauthAccessToken)
      Builds and returns a AuthorizationProvider 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 a AuthorizationProvider from a given oauthAccessToken
      Parameters:
      oauthAccessToken - The token
      login - 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 a AuthorizationProvider 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 a AuthorizationProvider from a given jwtToken
      Parameters:
      jwtToken - The JWT token
      Returns:
      a correctly configured AuthorizationProvider that will always return the same provided jwtToken
    • 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 interface AuthorizationProvider
      Returns:
      encoded authorization string, can be null