Skip to content

Conversation

@dongjun111111
Copy link

No description provided.

@LyricTian
Copy link
Member

你的这次代码提交没有生效,因为令牌的过期时间已经放入存储。应该这样设置,才能让令牌的过期时间生效:

// HandleTokenRequest token request handling
func (s *Server) HandleTokenRequest(w http.ResponseWriter, r *http.Request, duration time.Duration) (err error) {
	gt, tgr, verr := s.ValidationTokenRequest(r)
	if verr != nil {
		err = s.tokenError(w, verr)
		return
	}

	tgr.AccessTokenExp = duration

	ti, verr := s.GetAccessToken(gt, tgr)
	if verr != nil {
		err = s.tokenError(w, verr)
		return
	}

	err = s.token(w, s.GetTokenData(ti), nil)
	return
}

你再修改一下代码,重新提交一下吧。

@dongjun111111
Copy link
Author

@LyricTian 好的

@dongjun111111
Copy link
Author

@LyricTian 已经重新pr,麻烦检查一下

@LyricTian
Copy link
Member

  1. 代码没有格式化(gofmt),麻烦格式化一下。示例:w http.ResponseWriter, r *http.Request,duration time.Duration
  2. 注释名字不对,应该是HandleTokenRequestWithDuration。示例:// HandleTokenRequest token request handling with personal time.Duration
// HandleTokenRequest token request handling with personal time.Duration
func (s *Server) HandleTokenRequestWithDuration(w http.ResponseWriter, r *http.Request,duration time.Duration) (err error) {
	gt, tgr, verr := s.ValidationTokenRequest(r)
	if verr != nil {
		err = s.tokenError(w, verr)
		return
	}

	tgr.AccessTokenExp = duration

	ti, verr := s.GetAccessToken(gt, tgr)
	if verr != nil {
		err = s.tokenError(w, verr)
		return
	}

	err = s.token(w, s.GetTokenData(ti), nil)
	return
}

@dongjun111111
Copy link
Author

@LyricTian 不好意思,马上修正

@dongjun111111
Copy link
Author

@LyricTian 已修改,麻烦检查一下

@LyricTian LyricTian merged commit fe6b4e8 into go-oauth2:master Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants