2023-01-20 13:11:06 -05:00
|
|
|
package jwt
|
2021-03-31 15:40:44 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type JWTService interface {
|
2024-03-28 10:25:26 -06:00
|
|
|
Verify(ctx context.Context, strToken string) (map[string]any, error)
|
2021-03-31 15:40:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type FakeJWTService struct {
|
2024-03-28 10:25:26 -06:00
|
|
|
VerifyProvider func(context.Context, string) (map[string]any, error)
|
2021-03-31 15:40:44 +00:00
|
|
|
}
|
|
|
|
|
|
2024-03-28 10:25:26 -06:00
|
|
|
func (s *FakeJWTService) Verify(ctx context.Context, token string) (map[string]any, error) {
|
2021-03-31 15:40:44 +00:00
|
|
|
return s.VerifyProvider(ctx, token)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewFakeJWTService() *FakeJWTService {
|
|
|
|
|
return &FakeJWTService{
|
2024-03-28 10:25:26 -06:00
|
|
|
VerifyProvider: func(ctx context.Context, token string) (map[string]any, error) {
|
|
|
|
|
return map[string]any{}, nil
|
2021-03-31 15:40:44 +00:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|