mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 12:14:08 -06:00
6f62d970e3
* merge JSON search logic * document public methods * improve test coverage * use separate JWT setting struct * correct use of cfg.JWTAuth * add group tests * fix DynMap typing * add settings to default ini * add groups option to devenv path * fix test * lint * revert jwt-proxy change * remove redundant check * fix parallel test
30 lines
609 B
Go
30 lines
609 B
Go
package jwt
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana/pkg/util"
|
|
)
|
|
|
|
type JWTClaims util.DynMap
|
|
|
|
type JWTService interface {
|
|
Verify(ctx context.Context, strToken string) (JWTClaims, error)
|
|
}
|
|
|
|
type FakeJWTService struct {
|
|
VerifyProvider func(context.Context, string) (JWTClaims, error)
|
|
}
|
|
|
|
func (s *FakeJWTService) Verify(ctx context.Context, token string) (JWTClaims, error) {
|
|
return s.VerifyProvider(ctx, token)
|
|
}
|
|
|
|
func NewFakeJWTService() *FakeJWTService {
|
|
return &FakeJWTService{
|
|
VerifyProvider: func(ctx context.Context, token string) (JWTClaims, error) {
|
|
return JWTClaims{}, nil
|
|
},
|
|
}
|
|
}
|