Skip to content

Commit 999b1bd

Browse files
committed
chore: rename IdentityProvider to UserIdentity for clarity
Rename IdentityProvider types to UserIdentity to better reflect that these resources represent a user's identity within an external provider (e.g., GitHub, Google), not the identity provider itself. Changes: - Rename IdentityProvider → UserIdentity - Rename IdentityProviderStatus → UserIdentityStatus - Rename IdentityProviderList → UserIdentityList - Rename file: identityprovider_types.go → useridentity_types.go - Update resource permissions in iam-user-self-manage role: - identity.miloapis.com/identityproviders.* → useridentities.* - Add comprehensive documentation explaining: - What UserIdentity represents (user's linked identity, not the provider) - Use cases (UI display, federated identity visibility) - Important notes (read-only, no sensitive data exposed) - Update type registration in register.go - Regenerate deepcopy and OpenAPI definitions This change improves semantic clarity and addresses feedback that the original naming was confusing about whether it represented the provider service or the user's identity within that provider.
1 parent 379db53 commit 999b1bd

File tree

6 files changed

+166
-126
lines changed

6 files changed

+166
-126
lines changed

config/roles/iam-user-self-manage.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ spec:
1717
- identity.miloapis.com/sessions.list
1818
- identity.miloapis.com/sessions.get
1919
- identity.miloapis.com/sessions.delete
20+
- identity.miloapis.com/useridentities.list
21+
- identity.miloapis.com/useridentities.get
2022
- iam.miloapis.com/userinvitations.get
2123
- iam.miloapis.com/userinvitations.list

pkg/apis/identity/v1alpha1/identityprovider_types.go

Lines changed: 0 additions & 27 deletions
This file was deleted.

pkg/apis/identity/v1alpha1/register.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
3131
scheme.AddKnownTypes(SchemeGroupVersion,
3232
&Session{},
3333
&SessionList{},
34-
&IdentityProvider{},
35-
&IdentityProviderList{},
34+
&UserIdentity{},
35+
&UserIdentityList{},
3636
)
3737
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
3838
return nil
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// UserIdentity represents a user's linked identity within an external identity provider.
8+
//
9+
// This resource describes the connection between a Milo user and their account in an
10+
// external authentication provider (e.g., GitHub, Google, Microsoft). It is NOT the
11+
// identity provider itself, but rather the user's specific identity within that provider.
12+
//
13+
// Use cases:
14+
// - Display all authentication methods linked to a user account in the UI
15+
// - Show which external accounts a user has connected
16+
// - Provide visibility into federated identity mappings
17+
//
18+
// Important notes:
19+
// - This is a read-only resource for display purposes only
20+
// - Identity management (linking/unlinking providers) is handled by the external
21+
// authentication provider (e.g., Zitadel), not through this API
22+
// - No sensitive credentials or tokens are exposed through this resource
23+
//
24+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25+
type UserIdentity struct {
26+
metav1.TypeMeta `json:",inline"`
27+
metav1.ObjectMeta `json:"metadata,omitempty"`
28+
29+
Status UserIdentityStatus `json:"status,omitempty"`
30+
}
31+
32+
// UserIdentityStatus contains the details of a user's identity within an external provider.
33+
// All fields are read-only and populated by the authentication provider.
34+
type UserIdentityStatus struct {
35+
// UserUID is the unique identifier of the Milo user who owns this identity.
36+
UserUID string `json:"userUID"`
37+
38+
// ProviderID is the unique identifier of the external identity provider instance.
39+
// This is typically an internal ID from the authentication system.
40+
ProviderID string `json:"providerID"`
41+
42+
// ProviderName is the human-readable name of the identity provider.
43+
// Examples: "GitHub", "Google", "Microsoft", "GitLab"
44+
ProviderName string `json:"providerName"`
45+
46+
// Username is the user's username or identifier within the external identity provider.
47+
// This is the name the user is known by in the external system (e.g., GitHub username).
48+
Username string `json:"username"`
49+
}
50+
51+
// UserIdentityList is a list of UserIdentity resources.
52+
//
53+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
54+
type UserIdentityList struct {
55+
metav1.TypeMeta `json:",inline"`
56+
metav1.ListMeta `json:"metadata,omitempty"`
57+
Items []UserIdentity `json:"items"`
58+
}

pkg/apis/identity/v1alpha1/zz_generated.deepcopy.go

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)