Skip to content

Commit

Permalink
Merge pull request #52 from dtop/master
Browse files Browse the repository at this point in the history
TokenInfo in GenerateBasic
  • Loading branch information
LyricTian authored Jun 20, 2017
2 parents 38556ca + 2278502 commit 2d34ab7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
7 changes: 4 additions & 3 deletions generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import "time"
type (
// GenerateBasic provide the basis of the generated token data
GenerateBasic struct {
Client ClientInfo
UserID string
CreateAt time.Time
Client ClientInfo
UserID string
CreateAt time.Time
TokenInfo TokenInfo
}

// AuthorizeGenerate generate the authorization code interface
Expand Down
21 changes: 12 additions & 9 deletions manage/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ func (m *Manager) GenerateAuthToken(rt oauth2.ResponseType, tgr *oauth2.TokenGen
ti = ti.New()

td := &oauth2.GenerateBasic{
Client: cli,
UserID: tgr.UserID,
CreateAt: time.Now(),
Client: cli,
UserID: tgr.UserID,
CreateAt: time.Now(),
TokenInfo: ti,
}
switch rt {
case oauth2.Code:
Expand Down Expand Up @@ -292,9 +293,10 @@ func (m *Manager) GenerateAccessToken(gt oauth2.GrantType, tgr *oauth2.TokenGene
_, ierr := m.injector.Invoke(func(ti oauth2.TokenInfo, gen oauth2.AccessGenerate, stor oauth2.TokenStore) {
ti = ti.New()
td := &oauth2.GenerateBasic{
Client: cli,
UserID: tgr.UserID,
CreateAt: time.Now(),
Client: cli,
UserID: tgr.UserID,
CreateAt: time.Now(),
TokenInfo: ti,
}
gcfg := m.grantConfig(gt)

Expand Down Expand Up @@ -354,9 +356,10 @@ func (m *Manager) RefreshAccessToken(tgr *oauth2.TokenGenerateRequest) (accessTo
oldAccess, oldRefresh := ti.GetAccess(), ti.GetRefresh()
_, ierr := m.injector.Invoke(func(stor oauth2.TokenStore, gen oauth2.AccessGenerate) {
td := &oauth2.GenerateBasic{
Client: cli,
UserID: ti.GetUserID(),
CreateAt: time.Now(),
Client: cli,
UserID: ti.GetUserID(),
CreateAt: time.Now(),
TokenInfo: ti,
}

rcfg := DefaultRefreshTokenCfg
Expand Down

0 comments on commit 2d34ab7

Please sign in to comment.