Documentation
¶
Index ¶
- Variables
- func MapTenantRole(role string) string
- type AccessTokenRepository
- type AssignmentRepository
- func (r *AssignmentRepository) CheckExists(roleID string, scope authz.Scope, scopeContextID *string) (bool, error)
- func (r *AssignmentRepository) Grant(assignment *authz.Assignment) error
- func (r *AssignmentRepository) ListByRole(roleID string, scope authz.Scope, scopeContextID *string) ([]string, error)
- func (r *AssignmentRepository) ListForUser(userID string) ([]*authz.Assignment, error)
- func (r *AssignmentRepository) Revoke(userID, roleID string, scope authz.Scope, scopeContextID *string) error
- type AuthorizationCodeRepository
- func (r *AuthorizationCodeRepository) Create(code *oauth2.AuthorizationCode) error
- func (r *AuthorizationCodeRepository) Delete(code string) error
- func (r *AuthorizationCodeRepository) DeleteExpired() error
- func (r *AuthorizationCodeRepository) GetByCode(codeStr string) (*oauth2.AuthorizationCode, error)
- func (r *AuthorizationCodeRepository) MarkAsUsed(code string) error
- type ClientRepository
- func (r *ClientRepository) Create(client *oauth2.Client) error
- func (r *ClientRepository) Delete(id string) error
- func (r *ClientRepository) GetByClientID(clientID string) (*oauth2.Client, error)
- func (r *ClientRepository) GetByID(id string) (*oauth2.Client, error)
- func (r *ClientRepository) ListByOwner(ownerID string) ([]*oauth2.Client, error)
- func (r *ClientRepository) Update(client *oauth2.Client) error
- type Config
- type DB
- type KeyRepository
- type ProjectRepository
- func (r *ProjectRepository) Create(project *authz.Project) error
- func (r *ProjectRepository) Delete(id string) error
- func (r *ProjectRepository) GetByID(id string) (*authz.Project, error)
- func (r *ProjectRepository) GetByName(name string) (*authz.Project, error)
- func (r *ProjectRepository) ListByOwner(ownerID string) ([]*authz.Project, error)
- func (r *ProjectRepository) ListByUser(userID string) ([]*authz.Project, error)
- func (r *ProjectRepository) Update(project *authz.Project) error
- type RefreshTokenRepository
- type RoleRepository
- func (r *RoleRepository) Create(role *authz.Role) error
- func (r *RoleRepository) Delete(id string) error
- func (r *RoleRepository) GetByID(id string) (*authz.Role, error)
- func (r *RoleRepository) GetByName(name string, scope authz.Scope) (*authz.Role, error)
- func (r *RoleRepository) List(scope *authz.Scope) ([]*authz.Role, error)
- func (r *RoleRepository) Update(role *authz.Role) error
- type SessionRepository
- func (r *SessionRepository) Create(sess *session.Session) error
- func (r *SessionRepository) Delete(sessionID string) error
- func (r *SessionRepository) DeleteByUserID(userID string) error
- func (r *SessionRepository) DeleteExpired() error
- func (r *SessionRepository) Get(sessionID string) (*session.Session, error)
- func (r *SessionRepository) Update(sess *session.Session) error
- type TenantRepository
- func (r *TenantRepository) Create(ctx context.Context, t *tenant.Tenant) error
- func (r *TenantRepository) Delete(ctx context.Context, id string) error
- func (r *TenantRepository) GetByID(ctx context.Context, id string) (*tenant.Tenant, error)
- func (r *TenantRepository) GetByName(ctx context.Context, name string) (*tenant.Tenant, error)
- func (r *TenantRepository) List(ctx context.Context, limit, offset int) ([]*tenant.Tenant, error)
- func (r *TenantRepository) Update(ctx context.Context, t *tenant.Tenant) error
- type TenantRoleRepository
- func (r *TenantRoleRepository) AssignRole(ctx context.Context, role *tenant.TenantUserRole) error
- func (r *TenantRoleRepository) GetTenantUsers(ctx context.Context, tenantID string) ([]*tenant.TenantUserRole, error)
- func (r *TenantRoleRepository) GetUserRoles(ctx context.Context, tenantID, userID string) ([]*tenant.TenantUserRole, error)
- func (r *TenantRoleRepository) RevokeRole(ctx context.Context, tenantID, userID, role string) error
- type UserRepository
- func (r *UserRepository) AddCredentials(credentials *identity.Credentials) error
- func (r *UserRepository) Create(user *identity.User) error
- func (r *UserRepository) Delete(id string) error
- func (r *UserRepository) GetByEmail(tenantID *string, email string) (*identity.User, error)
- func (r *UserRepository) GetByID(id string) (*identity.User, error)
- func (r *UserRepository) GetCredentials(userID string) (*identity.Credentials, error)
- func (r *UserRepository) Update(user *identity.User) error
- func (r *UserRepository) UpdateLockout(userID string, failedAttempts int, lockedUntil *time.Time) error
- func (r *UserRepository) UpdatePassword(userID string, passwordHash string) error
Constants ¶
This section is empty.
Variables ¶
var InitialSchema string
Functions ¶
func MapTenantRole ¶
MapTenantRole maps internal tenant role names to seeded RBAC role IDs
Types ¶
type AccessTokenRepository ¶
type AccessTokenRepository struct {
// contains filtered or unexported fields
}
AccessTokenRepository implements oauth2.AccessTokenRepository
func NewAccessTokenRepository ¶
func NewAccessTokenRepository(db *DB) *AccessTokenRepository
NewAccessTokenRepository creates a new access token repository
func (*AccessTokenRepository) Create ¶
func (r *AccessTokenRepository) Create(token *oauth2.AccessToken) error
Create creates a new access token
func (*AccessTokenRepository) DeleteExpired ¶
func (r *AccessTokenRepository) DeleteExpired() error
DeleteExpired deletes all expired access tokens
func (*AccessTokenRepository) GetByTokenHash ¶
func (r *AccessTokenRepository) GetByTokenHash(tokenHash string) (*oauth2.AccessToken, error)
GetByTokenHash retrieves an access token
func (*AccessTokenRepository) Revoke ¶
func (r *AccessTokenRepository) Revoke(tokenHash string) error
Revoke revokes an access token
type AssignmentRepository ¶
type AssignmentRepository struct {
// contains filtered or unexported fields
}
AssignmentRepository implements authz.AssignmentRepository
func NewAssignmentRepository ¶
func NewAssignmentRepository(db *DB) *AssignmentRepository
NewAssignmentRepository creates a new assignment repository
func (*AssignmentRepository) CheckExists ¶
func (r *AssignmentRepository) CheckExists(roleID string, scope authz.Scope, scopeContextID *string) (bool, error)
CheckExists checks if a specific assignment exists
func (*AssignmentRepository) Grant ¶
func (r *AssignmentRepository) Grant(assignment *authz.Assignment) error
Grant assigns a role to a user
func (*AssignmentRepository) ListByRole ¶
func (r *AssignmentRepository) ListByRole(roleID string, scope authz.Scope, scopeContextID *string) ([]string, error)
ListByRole retrieves all users assigned a specific role at a scope
func (*AssignmentRepository) ListForUser ¶
func (r *AssignmentRepository) ListForUser(userID string) ([]*authz.Assignment, error)
ListForUser retrieves all assignments for a user
type AuthorizationCodeRepository ¶
type AuthorizationCodeRepository struct {
// contains filtered or unexported fields
}
AuthorizationCodeRepository implements oauth2.AuthorizationCodeRepository
func NewAuthorizationCodeRepository ¶
func NewAuthorizationCodeRepository(db *DB) *AuthorizationCodeRepository
NewAuthorizationCodeRepository creates a new authorization code repository
func (*AuthorizationCodeRepository) Create ¶
func (r *AuthorizationCodeRepository) Create(code *oauth2.AuthorizationCode) error
Create creates a new authorization code
func (*AuthorizationCodeRepository) Delete ¶
func (r *AuthorizationCodeRepository) Delete(code string) error
Delete deletes an authorization code
func (*AuthorizationCodeRepository) DeleteExpired ¶
func (r *AuthorizationCodeRepository) DeleteExpired() error
DeleteExpired deletes all expired authorization codes
func (*AuthorizationCodeRepository) GetByCode ¶
func (r *AuthorizationCodeRepository) GetByCode(codeStr string) (*oauth2.AuthorizationCode, error)
GetByCode retrieves an authorization code
func (*AuthorizationCodeRepository) MarkAsUsed ¶
func (r *AuthorizationCodeRepository) MarkAsUsed(code string) error
MarkAsUsed marks the code as used
type ClientRepository ¶
type ClientRepository struct {
// contains filtered or unexported fields
}
ClientRepository implements oauth2.ClientRepository
func NewClientRepository ¶
func NewClientRepository(db *DB) *ClientRepository
NewClientRepository creates a new client repository
func (*ClientRepository) Create ¶
func (r *ClientRepository) Create(client *oauth2.Client) error
Create creates a new OAuth2 client
func (*ClientRepository) Delete ¶
func (r *ClientRepository) Delete(id string) error
Delete soft-deletes a client
func (*ClientRepository) GetByClientID ¶
func (r *ClientRepository) GetByClientID(clientID string) (*oauth2.Client, error)
GetByClientID retrieves a client by client_id
func (*ClientRepository) GetByID ¶
func (r *ClientRepository) GetByID(id string) (*oauth2.Client, error)
GetByID retrieves a client by internal ID
func (*ClientRepository) ListByOwner ¶
func (r *ClientRepository) ListByOwner(ownerID string) ([]*oauth2.Client, error)
ListByOwner retrieves all clients for an owner
type Config ¶
type Config struct {
Host string
Port string
User string
Password string
Database string
SSLMode string
MaxOpenConns int
MaxIdleConns int
}
Config holds database configuration
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the PostgreSQL connection pool
type KeyRepository ¶
type KeyRepository struct {
// contains filtered or unexported fields
}
KeyRepository implements oauth2.KeyRepository
func NewKeyRepository ¶
func NewKeyRepository(db *DB) *KeyRepository
NewKeyRepository creates a new key repository
func (*KeyRepository) GetActiveKey ¶
GetActiveKey retrieves the most recent valid key
func (*KeyRepository) ListValidKeys ¶
ListValidKeys retrieves all valid keys
type ProjectRepository ¶
type ProjectRepository struct {
// contains filtered or unexported fields
}
ProjectRepository implements authz.ProjectRepository
func NewProjectRepository ¶
func NewProjectRepository(db *DB) *ProjectRepository
NewProjectRepository creates a new project repository
func (*ProjectRepository) Create ¶
func (r *ProjectRepository) Create(project *authz.Project) error
Create creates a new project
func (*ProjectRepository) Delete ¶
func (r *ProjectRepository) Delete(id string) error
Delete soft-deletes a project
func (*ProjectRepository) GetByID ¶
func (r *ProjectRepository) GetByID(id string) (*authz.Project, error)
GetByID retrieves a project by ID
func (*ProjectRepository) GetByName ¶
func (r *ProjectRepository) GetByName(name string) (*authz.Project, error)
GetByName retrieves a project by name
func (*ProjectRepository) ListByOwner ¶
func (r *ProjectRepository) ListByOwner(ownerID string) ([]*authz.Project, error)
ListByOwner retrieves all projects owned by a user
func (*ProjectRepository) ListByUser ¶
func (r *ProjectRepository) ListByUser(userID string) ([]*authz.Project, error)
ListByUser retrieves all projects a user has access to
type RefreshTokenRepository ¶
type RefreshTokenRepository struct {
// contains filtered or unexported fields
}
RefreshTokenRepository implements oauth2.RefreshTokenRepository
func NewRefreshTokenRepository ¶
func NewRefreshTokenRepository(db *DB) *RefreshTokenRepository
NewRefreshTokenRepository creates a new refresh token repository
func (*RefreshTokenRepository) Create ¶
func (r *RefreshTokenRepository) Create(token *oauth2.RefreshToken) error
Create creates a new refresh token
func (*RefreshTokenRepository) DeleteExpired ¶
func (r *RefreshTokenRepository) DeleteExpired() error
DeleteExpired deletes all expired refresh tokens
func (*RefreshTokenRepository) GetByTokenHash ¶
func (r *RefreshTokenRepository) GetByTokenHash(tokenHash string) (*oauth2.RefreshToken, error)
GetByTokenHash retrieves a refresh token
func (*RefreshTokenRepository) Revoke ¶
func (r *RefreshTokenRepository) Revoke(tokenHash string) error
Revoke revokes a refresh token
type RoleRepository ¶
type RoleRepository struct {
// contains filtered or unexported fields
}
RoleRepository implements authz.RoleRepository
func NewRoleRepository ¶
func NewRoleRepository(db *DB) *RoleRepository
NewRoleRepository creates a new role repository
func (*RoleRepository) Create ¶
func (r *RoleRepository) Create(role *authz.Role) error
Create creates a new role
func (*RoleRepository) Delete ¶
func (r *RoleRepository) Delete(id string) error
Delete deletes a role
func (*RoleRepository) GetByID ¶
func (r *RoleRepository) GetByID(id string) (*authz.Role, error)
GetByID retrieves a role by ID
type SessionRepository ¶
type SessionRepository struct {
// contains filtered or unexported fields
}
SessionRepository implements session.Repository
func NewSessionRepository ¶
func NewSessionRepository(db *DB) *SessionRepository
NewSessionRepository creates a new session repository
func (*SessionRepository) Create ¶
func (r *SessionRepository) Create(sess *session.Session) error
Create creates a new session
func (*SessionRepository) Delete ¶
func (r *SessionRepository) Delete(sessionID string) error
Delete deletes a session
func (*SessionRepository) DeleteByUserID ¶
func (r *SessionRepository) DeleteByUserID(userID string) error
DeleteByUserID deletes all sessions for a user
func (*SessionRepository) DeleteExpired ¶
func (r *SessionRepository) DeleteExpired() error
DeleteExpired deletes all expired sessions
type TenantRepository ¶
type TenantRepository struct {
// contains filtered or unexported fields
}
TenantRepository implements tenant.Repository
func NewTenantRepository ¶
func NewTenantRepository(db *DB) *TenantRepository
NewTenantRepository creates a new tenant repository
func (*TenantRepository) Delete ¶
func (r *TenantRepository) Delete(ctx context.Context, id string) error
Delete soft-deletes a tenant
type TenantRoleRepository ¶
type TenantRoleRepository struct {
// contains filtered or unexported fields
}
TenantRoleRepository implements tenant.RoleRepository
func NewTenantRoleRepository ¶
func NewTenantRoleRepository(db *DB) *TenantRoleRepository
NewTenantRoleRepository creates a new tenant role repository
func (*TenantRoleRepository) AssignRole ¶
func (r *TenantRoleRepository) AssignRole(ctx context.Context, role *tenant.TenantUserRole) error
AssignRole assigns a role to a user in a tenant
func (*TenantRoleRepository) GetTenantUsers ¶
func (r *TenantRoleRepository) GetTenantUsers(ctx context.Context, tenantID string) ([]*tenant.TenantUserRole, error)
GetTenantUsers retrieves all users with roles in a tenant
func (*TenantRoleRepository) GetUserRoles ¶
func (r *TenantRoleRepository) GetUserRoles(ctx context.Context, tenantID, userID string) ([]*tenant.TenantUserRole, error)
GetUserRoles retrieves all roles a user has in a tenant
func (*TenantRoleRepository) RevokeRole ¶
func (r *TenantRoleRepository) RevokeRole(ctx context.Context, tenantID, userID, role string) error
RevokeRole revokes a role from a user in a tenant
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository implements identity.UserRepository
func NewUserRepository ¶
func NewUserRepository(db *DB) *UserRepository
NewUserRepository creates a new user repository
func (*UserRepository) AddCredentials ¶
func (r *UserRepository) AddCredentials(credentials *identity.Credentials) error
AddCredentials adds credentials for a user
func (*UserRepository) Create ¶
func (r *UserRepository) Create(user *identity.User) error
Create creates a new user identity
func (*UserRepository) Delete ¶
func (r *UserRepository) Delete(id string) error
Delete soft-deletes a user
func (*UserRepository) GetByEmail ¶
GetByEmail retrieves a user by email within a tenant (or no tenant for Platform Admins)
func (*UserRepository) GetByID ¶
func (r *UserRepository) GetByID(id string) (*identity.User, error)
GetByID retrieves a user by ID
func (*UserRepository) GetCredentials ¶
func (r *UserRepository) GetCredentials(userID string) (*identity.Credentials, error)
GetCredentials retrieves user credentials
func (*UserRepository) Update ¶
func (r *UserRepository) Update(user *identity.User) error
Update updates user information
func (*UserRepository) UpdateLockout ¶
func (r *UserRepository) UpdateLockout(userID string, failedAttempts int, lockedUntil *time.Time) error
UpdateLockout updates user lockout status
func (*UserRepository) UpdatePassword ¶
func (r *UserRepository) UpdatePassword(userID string, passwordHash string) error
UpdatePassword updates user password