Auth: Use claims.AuthInfo in requester (#91739)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
authnlib "github.com/grafana/authlib/authn"
|
||||
"github.com/grafana/authlib/claims"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
)
|
||||
@@ -52,6 +53,19 @@ type SignedInUser struct {
|
||||
FallbackType identity.IdentityType
|
||||
}
|
||||
|
||||
// Access implements claims.AuthInfo.
|
||||
func (u *SignedInUser) GetAccess() claims.AccessClaims {
|
||||
return &identity.IDClaimsWrapper{Source: u}
|
||||
}
|
||||
|
||||
// Identity implements claims.AuthInfo.
|
||||
func (u *SignedInUser) GetIdentity() claims.IdentityClaims {
|
||||
if u.IDTokenClaims != nil {
|
||||
return authnlib.NewIdentityClaims(*u.IDTokenClaims)
|
||||
}
|
||||
return &identity.IDClaimsWrapper{Source: u}
|
||||
}
|
||||
|
||||
// GetRawIdentifier implements Requester.
|
||||
func (u *SignedInUser) GetRawIdentifier() string {
|
||||
if u.UserUID == "" {
|
||||
|
||||
Reference in New Issue
Block a user