Documentation
¶
Overview ¶
Package profilemetadata owns non-sensitive profile data and pure selector rules. It has no dependency on authentication, credential stores, or command execution.
Index ¶
- Constants
- func ExactProfileSelectorForCorp(cfg *ProfilesConfig, corpID, selector string) string
- func IdentitySelector(corpID, userID string) string
- func LocalProfileSelectorIsSafe(cfg *ProfilesConfig, profile *Profile, name string) bool
- func Normalize(cfg *ProfilesConfig)
- func ParseIdentitySelector(selector string) (corpID, userID string, ok bool)
- func ParseUnresolvedProfileSelector(selector string) (string, bool)
- func ProfileIdentityKey(corpID, userID string) string
- func ProfileIndexByIdentity(cfg *ProfilesConfig, corpID, userID string) int
- func ProfileNameTakenByOtherIdentity(cfg *ProfilesConfig, name, corpID, userID string) bool
- func ProfileSelector(profile Profile) string
- func ProfileSelectorCandidates(profiles []*Profile) []string
- func ProfileSelectorReferenceExists(cfg *ProfilesConfig, selector string) bool
- func ResolveOrganizationCorpID(cfg *ProfilesConfig, selector string) (string, error)
- func SameProfileIdentity(leftCorpID, leftUserID, rightCorpID, rightUserID string) bool
- func StoredProfileSelector(cfg *ProfilesConfig, profile *Profile) string
- func UnresolvedProfileSelector(corpID string) string
- type Profile
- func FindExactProfile(cfg *ProfilesConfig, corpID, userID string) *Profile
- func ProfilesForCorpID(cfg *ProfilesConfig, corpID string) []*Profile
- func ResolveOrganizationDefault(cfg *ProfilesConfig, corpID, displaySelector string, profiles []*Profile) (*Profile, bool, error)
- func ResolveSelection(_ string, cfg *ProfilesConfig, selector string) (*Profile, bool, error)
- func UnresolvedProfileForCorp(cfg *ProfilesConfig, corpID string) *Profile
- func UnresolvedProfileForLocalName(cfg *ProfilesConfig, name string) *Profile
- type ProfileMetadata
- type ProfilesConfig
Constants ¶
const ( MaxVersion = 3 UnresolvedSelectorPrefix = "@legacy/" ProfileStatusActive = "active" )
Variables ¶
This section is empty.
Functions ¶
func ExactProfileSelectorForCorp ¶
func ExactProfileSelectorForCorp(cfg *ProfilesConfig, corpID, selector string) string
func IdentitySelector ¶
func LocalProfileSelectorIsSafe ¶
func LocalProfileSelectorIsSafe(cfg *ProfilesConfig, profile *Profile, name string) bool
func Normalize ¶
func Normalize(cfg *ProfilesConfig)
func ParseIdentitySelector ¶
ParseIdentitySelector splits corpId:userId composite selectors. Both trimmed segments must be non-empty: a missing colon or either empty segment is not a composite selector.
func ProfileIdentityKey ¶
func ProfileIndexByIdentity ¶
func ProfileIndexByIdentity(cfg *ProfilesConfig, corpID, userID string) int
func ProfileNameTakenByOtherIdentity ¶
func ProfileNameTakenByOtherIdentity(cfg *ProfilesConfig, name, corpID, userID string) bool
func ProfileSelector ¶
func ProfileSelectorReferenceExists ¶
func ProfileSelectorReferenceExists(cfg *ProfilesConfig, selector string) bool
func ResolveOrganizationCorpID ¶
func ResolveOrganizationCorpID(cfg *ProfilesConfig, selector string) (string, error)
func SameProfileIdentity ¶
func StoredProfileSelector ¶
func StoredProfileSelector(cfg *ProfilesConfig, profile *Profile) string
Types ¶
type Profile ¶
type Profile struct {
Name string `json:"name"`
CorpID string `json:"corpId"`
CorpName string `json:"corpName,omitempty"`
UserID string `json:"userId,omitempty"`
UserName string `json:"userName,omitempty"`
ClientID string `json:"clientId,omitempty"`
Status string `json:"status,omitempty"`
AuthorizedDomains []string `json:"authorizedDomains,omitempty"`
ExpiresAt string `json:"expiresAt,omitempty"`
RefreshExpAt string `json:"refreshExpAt,omitempty"`
LastLoginAt string `json:"lastLoginAt,omitempty"`
LastUsedAt string `json:"lastUsedAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
}
func FindExactProfile ¶
func FindExactProfile(cfg *ProfilesConfig, corpID, userID string) *Profile
func ProfilesForCorpID ¶
func ProfilesForCorpID(cfg *ProfilesConfig, corpID string) []*Profile
func ResolveSelection ¶
func UnresolvedProfileForCorp ¶
func UnresolvedProfileForCorp(cfg *ProfilesConfig, corpID string) *Profile
func UnresolvedProfileForLocalName ¶
func UnresolvedProfileForLocalName(cfg *ProfilesConfig, name string) *Profile
type ProfileMetadata ¶
ProfileMetadata is the minimal, non-sensitive identity projection exposed to telemetry callers. It intentionally excludes profile names, client IDs, organization names, token material, and credential status.
func ResolveReadOnly ¶
func ResolveReadOnly(configDir, selector string) (*ProfileMetadata, error)
ResolveReadOnly resolves one identity exclusively from the non-sensitive profiles.json metadata. It deliberately avoids auth locks, token stores, Keychain access, migrations, quarantine renames, and writes. A missing metadata file or an empty current profile returns (nil, nil).
func ResolveReadOnlyWithReader ¶
func ResolveReadOnlyWithReader(configDir, selector string, readFile func(string) ([]byte, error)) (*ProfileMetadata, error)
ResolveReadOnlyWithReader allows auth's existing filesystem seam to use the same reader and pure selection rules without depending on credential code.
type ProfilesConfig ¶
type ProfilesConfig struct {
Version int `json:"version"`
PrimaryProfile string `json:"primaryProfile,omitempty"`
CurrentProfile string `json:"currentProfile,omitempty"`
PreviousProfile string `json:"previousProfile,omitempty"`
OrgCurrentProfiles map[string]string `json:"orgCurrentProfiles,omitempty"`
Profiles []Profile `json:"profiles,omitempty"`
}