fix: make GenerateJWTProfileToken public (#82)

This commit is contained in:
Livio Amstutz 2021-02-03 13:04:06 +01:00 committed by GitHub
parent ba01bdf1ef
commit fa92a20615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,14 +49,14 @@ func JWTProfileExchange(ctx context.Context, jwtProfileRequest *tokenexchange.JW
//JWTProfileExchange handles the oauth2 jwt profile exchange //JWTProfileExchange handles the oauth2 jwt profile exchange
func JWTProfileAssertionExchange(ctx context.Context, assertion *oidc.JWTProfileAssertion, scopes oidc.Scopes, rp RelayingParty) (*oauth2.Token, error) { func JWTProfileAssertionExchange(ctx context.Context, assertion *oidc.JWTProfileAssertion, scopes oidc.Scopes, rp RelayingParty) (*oauth2.Token, error) {
token, err := generateJWTProfileToken(assertion) token, err := GenerateJWTProfileToken(assertion)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return JWTProfileExchange(ctx, tokenexchange.NewJWTProfileRequest(token, scopes...), rp) return JWTProfileExchange(ctx, tokenexchange.NewJWTProfileRequest(token, scopes...), rp)
} }
func generateJWTProfileToken(assertion *oidc.JWTProfileAssertion) (string, error) { func GenerateJWTProfileToken(assertion *oidc.JWTProfileAssertion) (string, error) {
privateKey, err := bytesToPrivateKey(assertion.PrivateKey) privateKey, err := bytesToPrivateKey(assertion.PrivateKey)
if err != nil { if err != nil {
return "", err return "", err