[authn]: add GetIDClaims() to Requester (#91387)
* authn: add GetIDClaims() to Requester Co-Authored-By: Gabriel MABILLE <gamab@users.noreply.github.com> * authn: update StaticRequester Co-Authored-By: Gabriel MABILLE <gamab@users.noreply.github.com> * update auth/idtest/mock Co-Authored-By: Gabriel MABILLE <gamab@users.noreply.github.com> * Fix test Co-authored-by: Claudiu Dragalina-Paraipan <claudiu.dragalina@grafana.com> --------- Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> Co-authored-by: gamab <gabriel.mabille@grafana.com>
This commit is contained in:
co-authored by
Gabriel MABILLE
Claudiu Dragalina-Paraipan
gamab
parent
a940bb87be
commit
e2435f92f1
@@ -3,6 +3,8 @@ package idtest
|
||||
import (
|
||||
"context"
|
||||
|
||||
authnlib "github.com/grafana/authlib/authn"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
"github.com/grafana/grafana/pkg/services/auth"
|
||||
)
|
||||
@@ -10,15 +12,15 @@ import (
|
||||
var _ auth.IDService = (*MockService)(nil)
|
||||
|
||||
type MockService struct {
|
||||
SignIdentityFn func(ctx context.Context, identity identity.Requester) (string, error)
|
||||
SignIdentityFn func(ctx context.Context, identity identity.Requester) (string, *authnlib.Claims[authnlib.IDTokenClaims], error)
|
||||
RemoveIDTokenFn func(ctx context.Context, identity identity.Requester) error
|
||||
}
|
||||
|
||||
func (m *MockService) SignIdentity(ctx context.Context, identity identity.Requester) (string, error) {
|
||||
func (m *MockService) SignIdentity(ctx context.Context, identity identity.Requester) (string, *authnlib.Claims[authnlib.IDTokenClaims], error) {
|
||||
if m.SignIdentityFn != nil {
|
||||
return m.SignIdentityFn(ctx, identity)
|
||||
}
|
||||
return "", nil
|
||||
return "", nil, nil
|
||||
}
|
||||
|
||||
func (m *MockService) RemoveIDToken(ctx context.Context, identity identity.Requester) error {
|
||||
|
||||
Reference in New Issue
Block a user