Documentation
¶
Index ¶
- Constants
- Variables
- type Principal
- type Role
- type Service
- func (s *Service) AuthenticatePassword(ctx context.Context, username, password string) (*Session, *Principal, error)
- func (s *Service) AuthenticateSession(ctx context.Context, sessionID string) (*Principal, error)
- func (s *Service) AuthenticateToken(ctx context.Context, rawToken string) (*Principal, error)
- func (s *Service) Bootstrap(ctx context.Context) error
- func (s *Service) CreateToken(ctx context.Context, userID, name string) (*Token, string, error)
- func (s *Service) DeleteRole(ctx context.Context, roleID string) error
- func (s *Service) DeleteUser(ctx context.Context, userID string) error
- func (s *Service) GetUser(ctx context.Context, userID string) (*StoredUser, error)
- func (s *Service) ListRoles(ctx context.Context) ([]Role, error)
- func (s *Service) ListTokens(ctx context.Context) ([]Token, error)
- func (s *Service) ListTokensByUser(ctx context.Context, userID string) ([]Token, error)
- func (s *Service) ListUsers(ctx context.Context) ([]StoredUser, error)
- func (s *Service) LogoutSession(ctx context.Context, sessionID string) error
- func (s *Service) RevokeToken(ctx context.Context, tokenID string) error
- func (s *Service) RevokeTokenForUser(ctx context.Context, userID, tokenID string) error
- func (s *Service) SetupInitialUser(ctx context.Context, username, password string) (*Session, *Principal, error)
- func (s *Service) SetupRequired(ctx context.Context) (bool, error)
- func (s *Service) UpsertRole(ctx context.Context, role Role) (*Role, error)
- func (s *Service) UpsertUser(ctx context.Context, user StoredUser, password string, roleIDs []string) (*StoredUser, error)
- type Session
- type Store
- type StoredToken
- type StoredUser
- type Token
- type User
Constants ¶
View Source
const ( PermissionIndexerReleasesRead = "indexer.releases.read" PermissionIndexerReleasesOverride = "indexer.releases.override" PermissionIndexerReleasesHide = "indexer.releases.hide" PermissionIndexerReleasesPurge = "indexer.releases.purge" PermissionIndexerRuntimeRead = "indexer.runtime.read" PermissionIndexerRuntimeRun = "indexer.runtime.run" PermissionIndexerRuntimePause = "indexer.runtime.pause" PermissionIndexerRuntimeConfigure = "indexer.runtime.configure" PermissionAdminSettingsRead = "admin.settings.read" PermissionAdminSettingsWrite = "admin.settings.write" PermissionAggregatorRuntimeRead = "aggregator.runtime.read" PermissionAggregatorRuntimeConfigure = "aggregator.runtime.configure" PermissionDownloaderRuntimeRead = "downloader.runtime.read" PermissionDownloaderRuntimeConfigure = "downloader.runtime.configure" PermissionAuthUsersRead = "auth.users.read" PermissionAuthUsersWrite = "auth.users.write" PermissionAuthRolesRead = "auth.roles.read" PermissionAuthRolesWrite = "auth.roles.write" PermissionAuthTokensRead = "auth.tokens.read" PermissionAuthTokensWrite = "auth.tokens.write" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Principal ¶
type Role ¶
type Role struct {
ID string `json:"id"`
Name string `json:"name"`
Builtin bool `json:"builtin"`
Permissions []string `json:"permissions"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func DefaultRoles ¶
func DefaultRoles() []Role
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AuthenticatePassword ¶
func (*Service) AuthenticateSession ¶
func (*Service) AuthenticateToken ¶
func (*Service) CreateToken ¶
func (*Service) ListTokensByUser ¶
func (*Service) LogoutSession ¶
func (*Service) RevokeToken ¶
func (*Service) RevokeTokenForUser ¶
func (*Service) SetupInitialUser ¶
func (*Service) UpsertRole ¶
func (*Service) UpsertUser ¶
func (s *Service) UpsertUser(ctx context.Context, user StoredUser, password string, roleIDs []string) (*StoredUser, error)
type Store ¶
type Store interface {
EnsureAuthDefaults(ctx context.Context, roles []Role) error
CountAuthUsers(ctx context.Context) (int, error)
CreateInitialAuthUser(ctx context.Context, user StoredUser, roleIDs []string) error
GetAuthUserByUsername(ctx context.Context, username string) (*StoredUser, error)
GetAuthUserByID(ctx context.Context, userID string) (*StoredUser, error)
ListAuthUsers(ctx context.Context) ([]StoredUser, error)
UpsertAuthUser(ctx context.Context, user StoredUser) error
DeleteAuthUser(ctx context.Context, userID string) error
ListAuthRoles(ctx context.Context) ([]Role, error)
UpsertAuthRole(ctx context.Context, role Role) error
DeleteAuthRole(ctx context.Context, roleID string) error
ReplaceAuthUserRoles(ctx context.Context, userID string, roleIDs []string) error
ListAuthUserRoleIDs(ctx context.Context, userID string) ([]string, error)
CreateAuthSession(ctx context.Context, session Session) error
GetAuthSession(ctx context.Context, sessionID string) (*Session, error)
TouchAuthSession(ctx context.Context, sessionID string, seenAt time.Time) error
DeleteAuthSession(ctx context.Context, sessionID string) error
CreateAuthToken(ctx context.Context, token StoredToken) error
ListAuthTokens(ctx context.Context) ([]Token, error)
ListAuthTokensByUserID(ctx context.Context, userID string) ([]Token, error)
GetAuthTokenByHash(ctx context.Context, tokenHash string) (*StoredToken, error)
GetAuthTokenByID(ctx context.Context, tokenID string) (*StoredToken, error)
TouchAuthToken(ctx context.Context, tokenID string, seenAt time.Time) error
RevokeAuthToken(ctx context.Context, tokenID string) error
}
type StoredToken ¶
type StoredUser ¶
Click to show internal directories.
Click to hide internal directories.