Authn: Add function to resolve identity from org and namespace id (#84555)

* Add function to get the namespaced id

* Add function to resolve an identity through authn.Service from org and namespace id

* Switch to resolve identity for re-authenticate in another org
This commit is contained in:
Karl Persson
2024-03-15 15:08:15 +01:00
committed by GitHub
parent ced09883d3
commit d4e802dd47
9 changed files with 101 additions and 30 deletions
+12 -10
View File
@@ -87,6 +87,18 @@ type Identity struct {
IDToken string
}
func (i *Identity) GetID() string {
return i.ID
}
func (i *Identity) GetNamespacedID() (namespace string, identifier string) {
split := strings.Split(i.GetID(), ":")
if len(split) != 2 {
return "", ""
}
return split[0], split[1]
}
func (i *Identity) GetAuthenticatedBy() string {
return i.AuthenticatedBy
}
@@ -122,16 +134,6 @@ func (i *Identity) GetLogin() string {
return i.Login
}
func (i *Identity) GetNamespacedID() (namespace string, identifier string) {
split := strings.Split(i.ID, ":")
if len(split) != 2 {
return "", ""
}
return split[0], split[1]
}
// GetOrgID implements identity.Requester.
func (i *Identity) GetOrgID() int64 {
return i.OrgID