Skip to content

Commit

Permalink
feat(GraphQL): add support for all RSA and HMAC algorithms supported …
Browse files Browse the repository at this point in the history
…by github.com/dgrijalva/jwt-go/v4

Signed-off-by: dan-j <[email protected]>
  • Loading branch information
dan-j committed Oct 17, 2020
1 parent 1153bc9 commit 741d35d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion graphql/authorization/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,15 @@ func Parse(schema string) (*AuthMeta, error) {

err := json.Unmarshal([]byte(authInfo[len(AuthMetaHeader):]), &meta)
if err == nil {
if err := meta.validate(); err != nil {
return nil, err
}

if algoErr := meta.initSigningMethod(); algoErr != nil {
return nil, algoErr
}

return &meta, meta.validate()
return &meta, nil
}

fmt.Println("Falling back to parsing `Dgraph.Authorization` in old format." +
Expand Down Expand Up @@ -508,6 +512,11 @@ func (a *AuthMeta) initSigningMethod() error {
a.Lock()
defer a.Unlock()

// configurations using JWK URLs do not use signing methods.
if a.jwkURL() != "" {
return nil
}

signingMethod, ok := supportedAlgorithms[a.Algo]
if !ok {
arr := make([]string, 0, len(supportedAlgorithms))
Expand Down

0 comments on commit 741d35d

Please sign in to comment.