AuthN: Add IsAuthenticatedBy to identity interface and replace checks (#85262)

Add IsAuthenticatedBy to identity interface and replace checks
This commit is contained in:
Karl Persson
2024-03-27 15:22:13 +01:00
committed by GitHub
parent cd912367b3
commit 152cb47692
6 changed files with 23 additions and 3 deletions
+9
View File
@@ -197,6 +197,15 @@ func (i *Identity) HasUniqueId() bool {
return namespace == NamespaceUser || namespace == NamespaceServiceAccount || namespace == NamespaceAPIKey
}
func (i *Identity) IsAuthenticatedBy(providers ...string) bool {
for _, p := range providers {
if i.AuthenticatedBy == p {
return true
}
}
return false
}
func (i *Identity) IsNil() bool {
return i == nil
}