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
@@ -217,6 +217,15 @@ func (u *SignedInUser) GetNamespacedID() (string, string) {
return parts[0], parts[1]
}
func (u *SignedInUser) IsAuthenticatedBy(providers ...string) bool {
for _, p := range providers {
if u.AuthenticatedBy == p {
return true
}
}
return false
}
// FIXME: remove this method once all services are using an interface
func (u *SignedInUser) IsNil() bool {
return u == nil