Documentation ¶
Index ¶
- Constants
- Variables
- func AddAdminUser(ctx context.Context, authService Service, user *model.SuperuserConfiguration) (*model.Credential, error)
- func ArnMatch(src, dst string) bool
- func Base64StringGenerator(bytes int) string
- func CreateInitialAdminUser(ctx context.Context, authService Service, metadataManger MetadataManager, ...) (*model.Credential, error)
- func CreateInitialAdminUserWithKeys(ctx context.Context, authService Service, metadataManger MetadataManager, ...) (*model.Credential, error)
- func HexStringGenerator(bytes int) string
- func KeyGenerator(length int) string
- func ListPaged(ctx context.Context, db db.Querier, retType reflect.Type, ...) (*reflect.Value, *model.Paginator, error)
- func SetupAdminUser(ctx context.Context, authService Service, ...) (*model.Credential, error)
- func SetupBaseGroups(ctx context.Context, authService Service, ts time.Time) error
- type Arn
- type AuthorizationRequest
- type AuthorizationResponse
- type Cache
- type CredentialSetFn
- type DBAuthService
- func (s *DBAuthService) AddCredentials(ctx context.Context, username, accessKeyID, secretAccessKey string) (*model.Credential, error)
- func (s *DBAuthService) AddUserToGroup(ctx context.Context, username, groupDisplayName string) error
- func (s *DBAuthService) AttachPolicyToGroup(ctx context.Context, policyDisplayName, groupDisplayName string) error
- func (s *DBAuthService) AttachPolicyToUser(ctx context.Context, policyDisplayName, username string) error
- func (s *DBAuthService) Authorize(ctx context.Context, req *AuthorizationRequest) (*AuthorizationResponse, error)
- func (s *DBAuthService) CreateCredentials(ctx context.Context, username string) (*model.Credential, error)
- func (s *DBAuthService) CreateGroup(ctx context.Context, group *model.Group) error
- func (s *DBAuthService) CreateUser(ctx context.Context, user *model.User) error
- func (s *DBAuthService) DB() db.Database
- func (s *DBAuthService) DeleteCredentials(ctx context.Context, username, accessKeyID string) error
- func (s *DBAuthService) DeleteGroup(ctx context.Context, groupDisplayName string) error
- func (s *DBAuthService) DeletePolicy(ctx context.Context, policyDisplayName string) error
- func (s *DBAuthService) DeleteUser(ctx context.Context, username string) error
- func (s *DBAuthService) DetachPolicyFromGroup(ctx context.Context, policyDisplayName, groupDisplayName string) error
- func (s *DBAuthService) DetachPolicyFromUser(ctx context.Context, policyDisplayName, username string) error
- func (s *DBAuthService) GetCredentials(ctx context.Context, accessKeyID string) (*model.Credential, error)
- func (s *DBAuthService) GetCredentialsForUser(ctx context.Context, username, accessKeyID string) (*model.Credential, error)
- func (s *DBAuthService) GetGroup(ctx context.Context, groupDisplayName string) (*model.Group, error)
- func (s *DBAuthService) GetPolicy(ctx context.Context, policyDisplayName string) (*model.Policy, error)
- func (s *DBAuthService) GetUser(ctx context.Context, username string) (*model.User, error)
- func (s *DBAuthService) GetUserByID(ctx context.Context, userID int) (*model.User, error)
- func (s *DBAuthService) ListEffectivePolicies(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error)
- func (s *DBAuthService) ListGroupPolicies(ctx context.Context, groupDisplayName string, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error)
- func (s *DBAuthService) ListGroupUsers(ctx context.Context, groupDisplayName string, params *model.PaginationParams) ([]*model.User, *model.Paginator, error)
- func (s *DBAuthService) ListGroups(ctx context.Context, params *model.PaginationParams) ([]*model.Group, *model.Paginator, error)
- func (s *DBAuthService) ListPolicies(ctx context.Context, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error)
- func (s *DBAuthService) ListUserCredentials(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Credential, *model.Paginator, error)
- func (s *DBAuthService) ListUserGroups(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Group, *model.Paginator, error)
- func (s *DBAuthService) ListUserPolicies(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error)
- func (s *DBAuthService) ListUsers(ctx context.Context, params *model.PaginationParams) ([]*model.User, *model.Paginator, error)
- func (s *DBAuthService) RemoveUserFromGroup(ctx context.Context, username, groupDisplayName string) error
- func (s *DBAuthService) SecretStore() crypt.SecretStore
- func (s *DBAuthService) WritePolicy(ctx context.Context, policy *model.Policy) error
- type DBMetadataManager
- type DummyCache
- func (d *DummyCache) GetCredential(accessKeyID string, setFn CredentialSetFn) (*model.Credential, error)
- func (d *DummyCache) GetUser(username string, setFn UserSetFn) (*model.User, error)
- func (d *DummyCache) GetUserByID(userID int, setFn UserSetFn) (*model.User, error)
- func (d *DummyCache) GetUserPolicies(userID string, setFn UserPoliciesSetFn) ([]*model.Policy, error)
- type LRUCache
- func (c *LRUCache) GetCredential(accessKeyID string, setFn CredentialSetFn) (*model.Credential, error)
- func (c *LRUCache) GetUser(username string, setFn UserSetFn) (*model.User, error)
- func (c *LRUCache) GetUserByID(userID int, setFn UserSetFn) (*model.User, error)
- func (c *LRUCache) GetUserPolicies(userID string, setFn UserPoliciesSetFn) ([]*model.Policy, error)
- type MetadataManager
- type Service
- type UserPoliciesSetFn
- type UserSetFn
Constants ¶
View Source
const ( InstallationIDKeyName = "installation_id" SetupTimestampKeyName = "setup_timestamp" )
View Source
const AkiaAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" // Amazon AKIA alphabet is weird.
Variables ¶
View Source
var ( ErrNotFound = db.ErrNotFound ErrAlreadyExists = db.ErrAlreadyExists ErrInvalidArn = errors.New("invalid ARN") ErrInsufficientPermissions = errors.New("insufficient permissions") ErrNoField = errors.New("no field tagged in struct") )
Functions ¶
func AddAdminUser ¶
func AddAdminUser(ctx context.Context, authService Service, user *model.SuperuserConfiguration) (*model.Credential, error)
func Base64StringGenerator ¶
func CreateInitialAdminUser ¶
func CreateInitialAdminUser(ctx context.Context, authService Service, metadataManger MetadataManager, username string) (*model.Credential, error)
func CreateInitialAdminUserWithKeys ¶
func CreateInitialAdminUserWithKeys(ctx context.Context, authService Service, metadataManger MetadataManager, username string, accessKeyID *string, secretAccessKey *string) (*model.Credential, error)
func HexStringGenerator ¶
func KeyGenerator ¶
func SetupAdminUser ¶
func SetupAdminUser(ctx context.Context, authService Service, superuser *model.SuperuserConfiguration) (*model.Credential, error)
Types ¶
type Arn ¶
type AuthorizationRequest ¶
type AuthorizationRequest struct { Username string RequiredPermissions []permissions.Permission }
type AuthorizationResponse ¶
type Cache ¶
type Cache interface { GetCredential(accessKeyID string, setFn CredentialSetFn) (*model.Credential, error) GetUser(username string, setFn UserSetFn) (*model.User, error) GetUserByID(userID int, setFn UserSetFn) (*model.User, error) GetUserPolicies(userID string, setFn UserPoliciesSetFn) ([]*model.Policy, error) }
type CredentialSetFn ¶
type CredentialSetFn func() (*model.Credential, error)
type DBAuthService ¶
type DBAuthService struct {
// contains filtered or unexported fields
}
func NewDBAuthService ¶
func NewDBAuthService(db db.Database, secretStore crypt.SecretStore, cacheConf params.ServiceCache) *DBAuthService
func (*DBAuthService) AddCredentials ¶
func (s *DBAuthService) AddCredentials(ctx context.Context, username, accessKeyID, secretAccessKey string) (*model.Credential, error)
func (*DBAuthService) AddUserToGroup ¶
func (s *DBAuthService) AddUserToGroup(ctx context.Context, username, groupDisplayName string) error
func (*DBAuthService) AttachPolicyToGroup ¶
func (s *DBAuthService) AttachPolicyToGroup(ctx context.Context, policyDisplayName, groupDisplayName string) error
func (*DBAuthService) AttachPolicyToUser ¶
func (s *DBAuthService) AttachPolicyToUser(ctx context.Context, policyDisplayName, username string) error
func (*DBAuthService) Authorize ¶
func (s *DBAuthService) Authorize(ctx context.Context, req *AuthorizationRequest) (*AuthorizationResponse, error)
func (*DBAuthService) CreateCredentials ¶
func (s *DBAuthService) CreateCredentials(ctx context.Context, username string) (*model.Credential, error)
func (*DBAuthService) CreateGroup ¶
func (*DBAuthService) CreateUser ¶
func (*DBAuthService) DB ¶
func (s *DBAuthService) DB() db.Database
func (*DBAuthService) DeleteCredentials ¶
func (s *DBAuthService) DeleteCredentials(ctx context.Context, username, accessKeyID string) error
func (*DBAuthService) DeleteGroup ¶
func (s *DBAuthService) DeleteGroup(ctx context.Context, groupDisplayName string) error
func (*DBAuthService) DeletePolicy ¶
func (s *DBAuthService) DeletePolicy(ctx context.Context, policyDisplayName string) error
func (*DBAuthService) DeleteUser ¶
func (s *DBAuthService) DeleteUser(ctx context.Context, username string) error
func (*DBAuthService) DetachPolicyFromGroup ¶
func (s *DBAuthService) DetachPolicyFromGroup(ctx context.Context, policyDisplayName, groupDisplayName string) error
func (*DBAuthService) DetachPolicyFromUser ¶
func (s *DBAuthService) DetachPolicyFromUser(ctx context.Context, policyDisplayName, username string) error
func (*DBAuthService) GetCredentials ¶
func (s *DBAuthService) GetCredentials(ctx context.Context, accessKeyID string) (*model.Credential, error)
func (*DBAuthService) GetCredentialsForUser ¶
func (s *DBAuthService) GetCredentialsForUser(ctx context.Context, username, accessKeyID string) (*model.Credential, error)
func (*DBAuthService) GetUserByID ¶
func (*DBAuthService) ListEffectivePolicies ¶
func (*DBAuthService) ListGroupPolicies ¶
func (*DBAuthService) ListGroupUsers ¶
func (*DBAuthService) ListGroups ¶
func (s *DBAuthService) ListGroups(ctx context.Context, params *model.PaginationParams) ([]*model.Group, *model.Paginator, error)
func (*DBAuthService) ListPolicies ¶
func (s *DBAuthService) ListPolicies(ctx context.Context, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error)
func (*DBAuthService) ListUserCredentials ¶
func (s *DBAuthService) ListUserCredentials(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Credential, *model.Paginator, error)
func (*DBAuthService) ListUserGroups ¶
func (*DBAuthService) ListUserPolicies ¶
func (*DBAuthService) ListUsers ¶
func (s *DBAuthService) ListUsers(ctx context.Context, params *model.PaginationParams) ([]*model.User, *model.Paginator, error)
func (*DBAuthService) RemoveUserFromGroup ¶
func (s *DBAuthService) RemoveUserFromGroup(ctx context.Context, username, groupDisplayName string) error
func (*DBAuthService) SecretStore ¶
func (s *DBAuthService) SecretStore() crypt.SecretStore
func (*DBAuthService) WritePolicy ¶
type DBMetadataManager ¶
type DBMetadataManager struct {
// contains filtered or unexported fields
}
func NewDBMetadataManager ¶
func NewDBMetadataManager(version string, fixedInstallationID string, database db.Database) *DBMetadataManager
func (*DBMetadataManager) IsInitialized ¶ added in v0.43.0
func (d *DBMetadataManager) IsInitialized(ctx context.Context) (bool, error)
func (*DBMetadataManager) UpdateSetupTimestamp ¶
type DummyCache ¶
type DummyCache struct { }
func (*DummyCache) GetCredential ¶
func (d *DummyCache) GetCredential(accessKeyID string, setFn CredentialSetFn) (*model.Credential, error)
func (*DummyCache) GetUserByID ¶
func (*DummyCache) GetUserPolicies ¶
func (d *DummyCache) GetUserPolicies(userID string, setFn UserPoliciesSetFn) ([]*model.Policy, error)
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
func (*LRUCache) GetCredential ¶
func (c *LRUCache) GetCredential(accessKeyID string, setFn CredentialSetFn) (*model.Credential, error)
func (*LRUCache) GetUserByID ¶
func (*LRUCache) GetUserPolicies ¶
type MetadataManager ¶
type Service ¶
type Service interface { SecretStore() crypt.SecretStore // users CreateUser(ctx context.Context, user *model.User) error DeleteUser(ctx context.Context, username string) error GetUserByID(ctx context.Context, userID int) (*model.User, error) GetUser(ctx context.Context, username string) (*model.User, error) ListUsers(ctx context.Context, params *model.PaginationParams) ([]*model.User, *model.Paginator, error) // groups CreateGroup(ctx context.Context, group *model.Group) error DeleteGroup(ctx context.Context, groupDisplayName string) error GetGroup(ctx context.Context, groupDisplayName string) (*model.Group, error) ListGroups(ctx context.Context, params *model.PaginationParams) ([]*model.Group, *model.Paginator, error) // group<->user memberships AddUserToGroup(ctx context.Context, username, groupDisplayName string) error RemoveUserFromGroup(ctx context.Context, username, groupDisplayName string) error ListUserGroups(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Group, *model.Paginator, error) ListGroupUsers(ctx context.Context, groupDisplayName string, params *model.PaginationParams) ([]*model.User, *model.Paginator, error) // policies WritePolicy(ctx context.Context, policy *model.Policy) error GetPolicy(ctx context.Context, policyDisplayName string) (*model.Policy, error) DeletePolicy(ctx context.Context, policyDisplayName string) error ListPolicies(ctx context.Context, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error) // credentials CreateCredentials(ctx context.Context, username string) (*model.Credential, error) AddCredentials(ctx context.Context, username, accessKeyID, secretAccessKey string) (*model.Credential, error) DeleteCredentials(ctx context.Context, username, accessKeyID string) error GetCredentialsForUser(ctx context.Context, username, accessKeyID string) (*model.Credential, error) GetCredentials(ctx context.Context, accessKeyID string) (*model.Credential, error) ListUserCredentials(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Credential, *model.Paginator, error) // policy<->user attachments AttachPolicyToUser(ctx context.Context, policyDisplayName, username string) error DetachPolicyFromUser(ctx context.Context, policyDisplayName, username string) error ListUserPolicies(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error) ListEffectivePolicies(ctx context.Context, username string, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error) // policy<->group attachments AttachPolicyToGroup(ctx context.Context, policyDisplayName, groupDisplayName string) error DetachPolicyFromGroup(ctx context.Context, policyDisplayName, groupDisplayName string) error ListGroupPolicies(ctx context.Context, groupDisplayName string, params *model.PaginationParams) ([]*model.Policy, *model.Paginator, error) // authorize user for an action Authorize(ctx context.Context, req *AuthorizationRequest) (*AuthorizationResponse, error) }
type UserPoliciesSetFn ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.