Class JWTTokenProvider
- java.lang.Object
-
- org.kohsuke.github.extras.authorization.JWTTokenProvider
-
- All Implemented Interfaces:
AuthorizationProvider
public class JWTTokenProvider extends Object implements AuthorizationProvider
A authorization provider that gives valid JWT tokens. These tokens are then used to create a time-based token to authenticate as an application. This token provider does not provide any kind of caching, and will always request a new token to the API.
-
-
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 JWTTokenProvider(String applicationId, File keyFile)JWTTokenProvider(String applicationId, String keyString)JWTTokenProvider(String applicationId, Path keyPath)JWTTokenProvider(String applicationId, PrivateKey privateKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetEncodedAuthorization()Returns the credentials to be used with a given request.
-
-
-
Constructor Detail
-
JWTTokenProvider
public JWTTokenProvider(String applicationId, File keyFile) throws GeneralSecurityException, IOException
- Throws:
GeneralSecurityExceptionIOException
-
JWTTokenProvider
public JWTTokenProvider(String applicationId, Path keyPath) throws GeneralSecurityException, IOException
- Throws:
GeneralSecurityExceptionIOException
-
JWTTokenProvider
public JWTTokenProvider(String applicationId, String keyString) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
JWTTokenProvider
public JWTTokenProvider(String applicationId, PrivateKey privateKey)
-
-
Method Detail
-
getEncodedAuthorization
public String getEncodedAuthorization() throws IOException
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
- Throws:
IOException- on any error that prevents the provider from getting a valid authorization
-
-