Skip to content

Commit 5768f83

Browse files
committed
Update logic to read private key from the given filePath
1 parent 3f2604b commit 5768f83

File tree

2 files changed

+121
-136
lines changed

2 files changed

+121
-136
lines changed

internal/auth/auth.go

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,6 @@ func GetAccessTokenFromClientPrivateJWT(args PrivateKeyJwtTokenSource) (Result,
270270
return Result{}, err
271271
}
272272

273-
fmt.Println(resp.AccessToken)
274-
275273
return Result{
276274
AccessToken: resp.AccessToken,
277275
ExpiresAt: resp.Expiry,
@@ -284,7 +282,7 @@ type PrivateKeyJwtTokenSource struct {
284282
Uri string
285283
ClientID string
286284
ClientAssertionSigningAlg string
287-
ClientAssertionSigningKey string
285+
ClientAssertionPrivateKey string
288286
Audience string
289287
}
290288

@@ -302,10 +300,11 @@ func (p PrivateKeyJwtTokenSource) Token() (*oauth2.Token, error) {
302300

303301
assertion, err := CreateClientAssertion(
304302
alg,
305-
p.ClientAssertionSigningKey,
303+
p.ClientAssertionPrivateKey,
306304
p.ClientID,
307305
baseURL.JoinPath("/").String(),
308306
)
307+
309308
if err != nil {
310309
return nil, fmt.Errorf("failed to create client assertion: %w", err)
311310
}
@@ -336,20 +335,8 @@ func DetermineSigningAlgorithm(alg string) (jwa.SignatureAlgorithm, error) {
336335
return jwa.RS256, nil
337336
case "RS384":
338337
return jwa.RS384, nil
339-
case "RS512":
340-
return jwa.RS512, nil
341338
case "PS256":
342339
return jwa.PS256, nil
343-
case "PS384":
344-
return jwa.PS384, nil
345-
case "PS512":
346-
return jwa.PS512, nil
347-
case "ES256":
348-
return jwa.ES256, nil
349-
case "ES384":
350-
return jwa.ES384, nil
351-
case "ES512":
352-
return jwa.ES512, nil
353340
default:
354341
return "", fmt.Errorf("unsupported client assertion algorithm %q", alg)
355342
}

0 commit comments

Comments
 (0)