Skip to content

Commit

Permalink
Merge pull request #195 from godcongdev/master
Browse files Browse the repository at this point in the history
fix: github.com\go-oauth2\oauth2\[email protected]\server\server.go:243:6: no new variables on left side of :=
  • Loading branch information
LyricTian authored Jul 21, 2021
2 parents 83534bf + cb45f7a commit 3f26edb
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,6 @@ func (s *Server) GetAuthorizeToken(ctx context.Context, req *AuthorizeRequest) (

// check the client allows the authorized scope
if fn := s.ClientScopeHandler; fn != nil {
tgr := &oauth2.TokenGenerateRequest{
ClientID: req.ClientID,
UserID: req.UserID,
RedirectURI: req.RedirectURI,
Scope: req.Scope,
AccessTokenExp: req.AccessTokenExp,
Request: req.Request,
}

allowed, err := fn(tgr)
if err != nil {
return nil, err
Expand All @@ -240,16 +231,8 @@ func (s *Server) GetAuthorizeToken(ctx context.Context, req *AuthorizeRequest) (
}
}

tgr = &oauth2.TokenGenerateRequest{
ClientID: req.ClientID,
UserID: req.UserID,
RedirectURI: req.RedirectURI,
Scope: req.Scope,
AccessTokenExp: req.AccessTokenExp,
Request: req.Request,
CodeChallenge: req.CodeChallenge,
CodeChallengeMethod: req.CodeChallengeMethod,
}
tgr.CodeChallenge = req.CodeChallenge
tgr.CodeChallengeMethod = req.CodeChallengeMethod

return s.Manager.GenerateAuthToken(ctx, req.ResponseType, tgr)
}
Expand Down Expand Up @@ -390,7 +373,8 @@ func (s *Server) CheckGrantType(gt oauth2.GrantType) bool {
}

// GetAccessToken access token
func (s *Server) GetAccessToken(ctx context.Context, gt oauth2.GrantType, tgr *oauth2.TokenGenerateRequest) (oauth2.TokenInfo, error) {
func (s *Server) GetAccessToken(ctx context.Context, gt oauth2.GrantType, tgr *oauth2.TokenGenerateRequest) (oauth2.TokenInfo,
error) {
if allowed := s.CheckGrantType(gt); !allowed {
return nil, errors.ErrUnauthorizedClient
}
Expand Down

0 comments on commit 3f26edb

Please sign in to comment.