-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(GraphQl): Allow case insensitive auth header for graphql subscriptions. #6141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @jatindevdg, @MichaelJCompton, and @pawanrawal)
graphql/web/http.go, line 145 at r1 (raw file):
name := authorization.GetHeader() var val string var ok = false
The default value is false for boolean.
var ok bool
graphql/web/http.go, line 146 at r1 (raw file):
var val string var ok = false for k := range payload {
Fetch the value as well instead of getting if from the map again.
for k,v := range payload ...
graphql/web/http.go, line 153 at r1 (raw file):
} if ok {
Reduce indentation
if !ok {
return
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @arijitAD, @MichaelJCompton, and @pawanrawal)
graphql/web/http.go, line 145 at r1 (raw file):
Previously, arijitAD (Arijit Das) wrote…
The default value is false for boolean.
var ok bool
changed.
graphql/web/http.go, line 146 at r1 (raw file):
Previously, arijitAD (Arijit Das) wrote…
Fetch the value as well instead of getting if from the map again.
for k,v := range payload ...
changed.
graphql/web/http.go, line 153 at r1 (raw file):
Previously, arijitAD (Arijit Das) wrote…
Reduce indentation
if !ok {
return
}
changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:lgtm
Reviewed 2 of 2 files at r2.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @arijitAD, @jatindevdg, and @MichaelJCompton)
graphql/web/http.go, line 144 at r2 (raw file):
var ok bool for key, val = range payload { if strings.EqualFold(key, name) {
nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @arijitAD, @jatindevdg, and @MichaelJCompton)
graphql/web/http.go, line 31 at r2 (raw file):
"strconv" "strings" "time"
Sort the imports.
Golang local packages followed by other packages.
Check other files for reference.
graphql/web/http.go, line 147 at r2 (raw file):
ok = true break }
This will clean up the code.
You don't have to declare ok
,key
,value
seperately.
if !strings.EqualFold(key, name) {
continue
}
md := metadata.New(map[string]string{
"authorizationJwt": val.(string),
})
ctx = metadata.NewIncomingContext(ctx, md)
customClaims, err = authorization.ExtractCustomClaims(ctx)
if err != nil {
return nil, err
}
break;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 files reviewed, 6 unresolved discussions (waiting on @arijitAD, @jatindevdg, @MichaelJCompton, and @pawanrawal)
graphql/web/http.go, line 31 at r2 (raw file):
Previously, arijitAD (Arijit Das) wrote…
Sort the imports.
Golang local packages followed by other packages.
Check other files for reference.
done.
graphql/web/http.go, line 147 at r2 (raw file):
Previously, arijitAD (Arijit Das) wrote…
This will clean up the code.
You don't have to declareok
,key
,value
seperately.if !strings.EqualFold(key, name) {
continue
}
md := metadata.New(map[string]string{
"authorizationJwt": val.(string),
})
ctx = metadata.NewIncomingContext(ctx, md)
customClaims, err = authorization.ExtractCustomClaims(ctx)
if err != nil {
return nil, err
}
break;
changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Reviewable status: 1 of 2 files reviewed, 6 unresolved discussions (waiting on @arijitAD, @jatindevdg, @MichaelJCompton, and @pawanrawal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 files reviewed, 6 unresolved discussions (waiting on @arijitAD, @jatindevdg, @MichaelJCompton, and @pawanrawal)
This PR allows case insensitive auth header for graphql subscriptions.
This change is