Documentation
¶
Overview ¶
Package scimtoken is the domain model for per-tenant SCIM 2.0 provisioning bearer tokens (RFC-009). Only the peppered hash is persisted; the plaintext is shown once at creation.
Index ¶
- Variables
- type Repository
- type ScimToken
- func (t *ScimToken) CreatedAt() time.Time
- func (t *ScimToken) CreatedBy() *shared.ID
- func (t *ScimToken) ID() shared.ID
- func (t *ScimToken) IsActive() bool
- func (t *ScimToken) LastUsedAt() *time.Time
- func (t *ScimToken) Name() string
- func (t *ScimToken) Prefix() string
- func (t *ScimToken) Revoke()
- func (t *ScimToken) SetCreatedBy(id shared.ID)
- func (t *ScimToken) Status() Status
- func (t *ScimToken) TenantID() shared.ID
- func (t *ScimToken) TokenHash() string
- func (t *ScimToken) TouchLastUsed(at time.Time)
- type Status
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("scim token not found")
ErrNotFound is returned when no token matches the lookup.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface {
Create(ctx context.Context, token *ScimToken) error
// GetByHash returns the token with the given peppered hash (used on the
// authentication path). Returns ErrNotFound when absent.
GetByHash(ctx context.Context, tokenHash string) (*ScimToken, error)
GetByID(ctx context.Context, tenantID, id shared.ID) (*ScimToken, error)
ListByTenant(ctx context.Context, tenantID shared.ID) ([]*ScimToken, error)
Update(ctx context.Context, token *ScimToken) error
// TouchLastUsed records a use time WITHOUT touching status, and only for a
// still-active token. This avoids a last-used write on the auth path
// clobbering a concurrent revoke (which would resurrect the token).
TouchLastUsed(ctx context.Context, id shared.ID, at time.Time) error
}
Repository persists SCIM tokens.
type ScimToken ¶
type ScimToken struct {
// contains filtered or unexported fields
}
ScimToken is a per-tenant SCIM bearer token.
func Reconstruct ¶
func Reconstruct(id, tenantID shared.ID, name, tokenHash, prefix string, status Status, createdBy *shared.ID, createdAt time.Time, lastUsedAt *time.Time) *ScimToken
Reconstruct rebuilds a token from persistence.
func (*ScimToken) LastUsedAt ¶
func (*ScimToken) SetCreatedBy ¶
SetCreatedBy records the admin who minted the token.
func (*ScimToken) TouchLastUsed ¶
TouchLastUsed records a successful authentication time.