@@ -61,33 +61,33 @@ func (b *InMemoryPersistence) SaveAuthorization(a *Authorization) error {
61
61
}
62
62
63
63
// GetAuthorizationByCode takes a code and look it up
64
- func (b * InMemoryPersistence ) GetAuthorizationByCode (code string ) (* Authorization , error ) {
64
+ func (b * InMemoryPersistence ) GetAuthorizationByCode (c * Client , code string ) (* Authorization , error ) {
65
65
for _ , a := range b .authorizations {
66
- if a .Code == code {
66
+ if a .Client == c && a . Code == code {
67
67
return a , nil
68
68
}
69
69
}
70
70
71
71
return nil , ErrNotFound
72
72
}
73
73
74
- // GetAuthorizationByAccessToken takes an access token and returns the authorization
74
+ // GetAuthorizationByRefreshToken takes an access token and returns the authorization
75
75
// it represents, if exists.
76
- func (b * InMemoryPersistence ) GetAuthorizationByAccessToken ( accessToken string ) (* Authorization , error ) {
76
+ func (b * InMemoryPersistence ) GetAuthorizationByRefreshToken ( c * Client , refreshToken string ) (* Authorization , error ) {
77
77
for _ , a := range b .authorizations {
78
- if a .AccessToken == accessToken {
78
+ if a .Client == c && a . RefreshToken == refreshToken {
79
79
return a , nil
80
80
}
81
81
}
82
82
83
83
return nil , ErrNotFound
84
84
}
85
85
86
- // GetAuthorizationByRefreshToken takes an access token and returns the authorization
86
+ // GetAuthorizationByAccessToken takes an access token and returns the authorization
87
87
// it represents, if exists.
88
- func (b * InMemoryPersistence ) GetAuthorizationByRefreshToken ( refreshToken string ) (* Authorization , error ) {
88
+ func (b * InMemoryPersistence ) GetAuthorizationByAccessToken ( accessToken string ) (* Authorization , error ) {
89
89
for _ , a := range b .authorizations {
90
- if a .RefreshToken == refreshToken {
90
+ if a .AccessToken == accessToken {
91
91
return a , nil
92
92
}
93
93
}
0 commit comments