Auth: Use claims.AuthInfo in requester (#91739)
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
authnlib "github.com/grafana/authlib/authn"
|
||||
"github.com/grafana/authlib/claims"
|
||||
)
|
||||
|
||||
var _ Requester = &StaticRequester{}
|
||||
@@ -35,6 +36,19 @@ type StaticRequester struct {
|
||||
CacheKey string
|
||||
}
|
||||
|
||||
// Access implements Requester.
|
||||
func (u *StaticRequester) GetAccess() claims.AccessClaims {
|
||||
return &IDClaimsWrapper{Source: u}
|
||||
}
|
||||
|
||||
// Identity implements Requester.
|
||||
func (u *StaticRequester) GetIdentity() claims.IdentityClaims {
|
||||
if u.IDTokenClaims != nil {
|
||||
return authnlib.NewIdentityClaims(*u.IDTokenClaims)
|
||||
}
|
||||
return &IDClaimsWrapper{Source: u}
|
||||
}
|
||||
|
||||
// GetRawIdentifier implements Requester.
|
||||
func (u *StaticRequester) GetUID() string {
|
||||
return fmt.Sprintf("%s:%s", u.Type, u.UserUID)
|
||||
|
||||
Reference in New Issue
Block a user