Documentation
¶
Overview ¶
Package identity provides Principal and TenantContext types and nil-safe constructors for threading authenticated identity through the Cortex platform.
This is a thin helper package that re-exports the domain port types via type aliases and provides constructors. The full identity domain model (Organization, Workspace, Project, User, ServiceAccount, Agent, OAuth verifier, API key, claims mapper) is introduced in W11/W12.
REQ-FOUND-001: these types compile and unit-test in isolation. No caller adopts them in W1.
Index ¶
- Variables
- type ClaimsMapper
- type IssuedToken
- type MemoryTokenStore
- func (s *MemoryTokenStore) Issue(_ context.Context, in TokenIssue) (IssuedToken, error)
- func (s *MemoryTokenStore) Revoke(_ context.Context, id string) error
- func (s *MemoryTokenStore) Rotate(ctx context.Context, id string) (IssuedToken, error)
- func (s *MemoryTokenStore) Verify(_ context.Context, secret, requiredScope string) (Principal, error)
- type OAuthConfig
- type OAuthVerifier
- type Principal
- type TenantContext
- type TokenIssue
- type TokenRecord
- type TokenStore
- type TokenVerifier
- type UserCreate
- type UserRecord
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ClaimsMapper ¶
type ClaimsMapper struct{}
ClaimsMapper converts verified issuer claims into an immutable Principal. Client/request fields are intentionally not accepted by this port.
type IssuedToken ¶
type IssuedToken struct {
Secret string
Record TokenRecord
}
type MemoryTokenStore ¶
type MemoryTokenStore struct {
// contains filtered or unexported fields
}
func NewMemoryTokenStore ¶
func NewMemoryTokenStore(key []byte) *MemoryTokenStore
func (*MemoryTokenStore) Issue ¶
func (s *MemoryTokenStore) Issue(_ context.Context, in TokenIssue) (IssuedToken, error)
func (*MemoryTokenStore) Revoke ¶
func (s *MemoryTokenStore) Revoke(_ context.Context, id string) error
func (*MemoryTokenStore) Rotate ¶
func (s *MemoryTokenStore) Rotate(ctx context.Context, id string) (IssuedToken, error)
type OAuthConfig ¶
type OAuthVerifier ¶
type OAuthVerifier struct {
// contains filtered or unexported fields
}
func NewOAuthVerifier ¶
func NewOAuthVerifier(cfg OAuthConfig) *OAuthVerifier
type Principal ¶
Principal is a type alias for domain.Principal, re-exported so callers in the identity/authz layers reference identity.Principal without importing domain directly in every file.
func NewPrincipal ¶
func NewPrincipal(subject, principalType, orgID string, workspaceIDs, roles, scopes []string, authMethod, grantDigest string) Principal
NewPrincipal constructs a fully-populated Principal.
Nil slice arguments are normalized to empty (non-nil) slices so downstream range loops and len() calls are always safe without nil checks.
type TenantContext ¶
type TenantContext = domain.TenantContext
TenantContext is a type alias for domain.TenantContext.
func NewTenantContext ¶
func NewTenantContext(tenantID, workspaceID, ownerSubject string) TenantContext
NewTenantContext constructs a TenantContext value.
It never panics on empty strings — in local mode all fields are empty, representing the synthetic/nil-tenant invariant (REQ-FOUND-001).
type TokenIssue ¶
type TokenRecord ¶
type TokenStore ¶
type TokenVerifier ¶
type UserCreate ¶
type UserCreate struct {
Email string
DisplayName string
Roles []string
Workspaces []string
Projects []string
Scopes []string
ClassificationClearance []string
}
UserCreate contains administrator-controlled identity data. Authority is resolved from these persisted grants, never copied from ordinary requests.