initSigningMethod takes the current Algo value, validates it's a supported SigningMethod, then sets the SigningMethod field.
()
| 526 | // initSigningMethod takes the current Algo value, validates it's a supported SigningMethod, then sets the SigningMethod |
| 527 | // field. |
| 528 | func (a *AuthMeta) initSigningMethod() error { |
| 529 | // configurations using JWK URLs do not use signing methods. |
| 530 | if len(a.JWKUrls) != 0 || a.JWKUrl != "" { |
| 531 | return nil |
| 532 | } |
| 533 | |
| 534 | signingMethod, ok := supportedAlgorithms[a.Algo] |
| 535 | if !ok { |
| 536 | arr := make([]string, 0, len(supportedAlgorithms)) |
| 537 | for k := range supportedAlgorithms { |
| 538 | arr = append(arr, k) |
| 539 | } |
| 540 | |
| 541 | return errors.Errorf( |
| 542 | "invalid jwt algorithm: found %s, but supported options are: %s", |
| 543 | a.Algo, strings.Join(arr, ","), |
| 544 | ) |
| 545 | } |
| 546 | |
| 547 | a.SigningMethod = signingMethod |
| 548 | |
| 549 | return nil |
| 550 | } |
| 551 | |
| 552 | func (a *AuthMeta) InitHttpClient() { |
| 553 | a.httpClient = &http.Client{ |