@@ -68,7 +68,7 @@ type FakeIDP struct {
68
68
// "Authorized Redirect URLs". This can be used to emulate that.
69
69
hookValidRedirectURL func (redirectURL string ) error
70
70
hookUserInfo func (email string ) (jwt.MapClaims , error )
71
- hookExtra func (email string ) map [string ]interface {}
71
+ hookMutateToken func (token map [string ]interface {})
72
72
fakeCoderd func (req * http.Request ) (* http.Response , error )
73
73
hookOnRefresh func (email string ) error
74
74
// Custom authentication for the client. This is useful if you want
@@ -115,9 +115,9 @@ func WithRefresh(hook func(email string) error) func(*FakeIDP) {
115
115
116
116
// WithExtra returns extra fields that be accessed on the returned Oauth Token.
117
117
// These extra fields can override the default fields (id_token, access_token, etc).
118
- func WithExtra ( extra func (email string ) map [string ]interface {}) func (* FakeIDP ) {
118
+ func WithMutateToken ( mutateToken func (token map [string ]interface {}) ) func (* FakeIDP ) {
119
119
return func (f * FakeIDP ) {
120
- f .hookExtra = extra
120
+ f .hookMutateToken = mutateToken
121
121
}
122
122
}
123
123
@@ -630,10 +630,8 @@ func (f *FakeIDP) httpHandler(t testing.TB) http.Handler {
630
630
"expires_in" : int64 ((time .Minute * 5 ).Seconds ()),
631
631
"id_token" : f .encodeClaims (t , claims ),
632
632
}
633
- if f .hookExtra != nil {
634
- for k , v := range f .hookExtra (email ) {
635
- token [k ] = v
636
- }
633
+ if f .hookMutateToken != nil {
634
+ f .hookMutateToken (token )
637
635
}
638
636
// Store the claims for the next refresh
639
637
f .refreshIDTokenClaims .Store (refreshToken , claims )
0 commit comments