Skip to content

Commit

Permalink
Merge pull request #187 from rp8/master
Browse files Browse the repository at this point in the history
fixed the bug to compare client secrets when refreshing token
  • Loading branch information
LyricTian authored Jul 6, 2021
2 parents 68172d1 + d34e841 commit 002e44a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ _testmain.go
*.test
*.prof

coverage.txt

# OSX
*.DS_Store
*.db
Expand Down
4 changes: 4 additions & 0 deletions manage/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ func (m *Manager) RefreshAccessToken(ctx context.Context, tgr *oauth2.TokenGener
cli, err := m.GetClient(ctx, tgr.ClientID)
if err != nil {
return nil, err
} else if cliPass, ok := cli.(oauth2.ClientPasswordVerifier); ok {
if !cliPass.VerifyPassword(tgr.ClientSecret) {
return nil, errors.ErrInvalidClient
}
} else if tgr.ClientSecret != cli.GetSecret() {
return nil, errors.ErrInvalidClient
}
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (s *Server) GetAuthorizeToken(ctx context.Context, req *AuthorizeRequest) (
}
}

tgr := &oauth2.TokenGenerateRequest{
tgr = &oauth2.TokenGenerateRequest{
ClientID: req.ClientID,
UserID: req.UserID,
RedirectURI: req.RedirectURI,
Expand Down

0 comments on commit 002e44a

Please sign in to comment.