-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
Hi,
As I understand, for now this library don't support GithubApps authorization?
If so, I want to discuss the best way for implementation.
In my code I used trait GithubAuth
with method def getAuthHeader():String
. GithubClient
taken instance of GithubAuth
and call this function for token. In case of PAT it's return token from constructor, in case of private key it's looks like:
class GithubKeyAuth(privateKeyContent: String, appId: String) extends GithubAuth {
implicit val clock: Clock = Clock.systemUTC
// build PrivateKey instance from string
private val privateKey = GithubKeyAuth.getPrivateKey(privateKeyContent)
// generate valid JWT token using PrivateKey
override def getAuthHeader(): String = {
"Bearer " + Jwt.encode(JwtClaim({
s"""{"iss":$appId}"""
}).issuedNow.expiresIn(10), privateKey, JwtAlgorithm.RS256)
}
}
WDYT?
Metadata
Metadata
Assignees
Labels
No labels