Auth: Use claims.AuthInfo in requester (#91739)

This commit is contained in:
Ryan McKinley
2024-08-09 19:46:56 +03:00
committed by GitHub
parent d52626be3f
commit 243c0935fc
19 changed files with 207 additions and 207 deletions
+14
View File
@@ -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 == "" {