Skip to content

Commit

Permalink
auth: support "authorization" token for grpc-gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
hexfusion committed Jun 15, 2017
1 parent ee0c805 commit 0caab26
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions auth/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,12 @@ func (as *authStore) AuthInfoFromCtx(ctx context.Context) (*AuthInfo, error) {
return nil, nil
}

ts, tok := md["token"]
if !tok {
//TODO(mitake|hexfusion) review unifying key names
ts, ok := md["token"]
if !ok {
ts, ok = md["authorization"]
}
if !ok {
return nil, nil
}

Expand All @@ -1011,6 +1015,7 @@ func (as *authStore) AuthInfoFromCtx(ctx context.Context) (*AuthInfo, error) {
plog.Warningf("invalid auth token: %s", token)
return nil, ErrInvalidAuthToken
}

return authInfo, nil
}

Expand Down

0 comments on commit 0caab26

Please sign in to comment.