DetermineSigningAlgorithm returns the appropriate JWA signature algorithm based on the string representation.
(alg string)
| 330 | |
| 331 | // DetermineSigningAlgorithm returns the appropriate JWA signature algorithm based on the string representation. |
| 332 | func DetermineSigningAlgorithm(alg string) (jwa.SignatureAlgorithm, error) { |
| 333 | switch alg { |
| 334 | case "RS256": |
| 335 | return jwa.RS256, nil |
| 336 | case "RS384": |
| 337 | return jwa.RS384, nil |
| 338 | case "PS256": |
| 339 | return jwa.PS256, nil |
| 340 | default: |
| 341 | return "", fmt.Errorf("unsupported client assertion algorithm %q", alg) |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | // CreateClientAssertion creates a JWT token for client authentication with the specified lifetime. |
| 346 | func CreateClientAssertion(alg jwa.SignatureAlgorithm, signingKey, clientID, audience string) (string, error) { |