MCPcopy
hub / github.com/dgraph-io/dgraph / initSigningMethod

Method initSigningMethod

graphql/authorization/auth.go:528–550  ·  view source on GitHub ↗

initSigningMethod takes the current Algo value, validates it's a supported SigningMethod, then sets the SigningMethod field.

()

Source from the content-addressed store, hash-verified

526// initSigningMethod takes the current Algo value, validates it's a supported SigningMethod, then sets the SigningMethod
527// field.
528func (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
552func (a *AuthMeta) InitHttpClient() {
553 a.httpClient = &http.Client{

Callers 1

ParseFunction · 0.95

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected