public class ApplicationKey
extends java.lang.Object
implements java.util.function.Supplier<java.lang.String>
Handles logic for reading a private (signing) key, signing a JWT token, and caching that token until it has expired, as described in authenticating as a GitHub App
Uses Java Supplier pattern to allow re-generation of tokens as needed
| Constructor and Description |
|---|
ApplicationKey(java.lang.String githubAppId,
java.util.function.Supplier<java.lang.String> privateKeySupplier) |
ApplicationKey(java.lang.String githubAppId,
java.util.function.Supplier<java.lang.String> privateKeySupplier,
int cacheExpirationMinutes) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
get() |
public ApplicationKey(java.lang.String githubAppId,
java.util.function.Supplier<java.lang.String> privateKeySupplier)
githubAppId - Unique identifier provided by GitHub for the AppprivateKeySupplier - Supplier which allows lookup of the private (signing) key issued by GitHub for creating JWT tokens
used in web requestspublic ApplicationKey(java.lang.String githubAppId,
java.util.function.Supplier<java.lang.String> privateKeySupplier,
int cacheExpirationMinutes)
githubAppId - Unique identifier provided by GitHub for the AppprivateKeySupplier - Supplier which allows lookup of the private (signing) key issued by GitHub for creating JWT tokens
used in web requestscacheExpirationMinutes - Number of minutes to cache generated JWT tokens for authentication with GitHub, maximum 10public java.lang.String get()
throws KeyLoadingException
get in interface java.util.function.Supplier<java.lang.String>KeyLoadingException - If the is an error reading the signing key prior to use