Documentation ¶
Index ¶
- Variables
- func ApplyPermissions(db *gorm.DB, permissions []ConfigPermission) ([]string, error)
- func ImportConfig(db *gorm.DB, bs []byte) error
- func ImportPermissions(db *gorm.DB, permissions []ConfigPermission) error
- func ImportSources(db *gorm.DB, sources []ConfigSource) error
- func NewDB(dbpath string) (*gorm.DB, error)
- func NewToken(db *gorm.DB, userId string, token *Token) (secret string, err error)
- func Run(options Options) error
- type ApiKey
- type Config
- type ConfigPermission
- type ConfigSource
- type Destination
- type Http
- type Options
- type Permission
- type Settings
- type Source
- func (s *Source) BeforeCreate(tx *gorm.DB) (err error)
- func (s *Source) BeforeDelete(tx *gorm.DB) error
- func (s *Source) CreateUser(db *gorm.DB, user *User, email string, password string, admin bool) error
- func (s *Source) DeleteUser(db *gorm.DB, u *User) error
- func (s *Source) SyncUsers(db *gorm.DB) error
- type Token
- type User
- type UserIdContextKey
- type V1Server
- func (v *V1Server) CreateCred(ctx context.Context, in *emptypb.Empty) (*v1.CreateCredResponse, error)
- func (v *V1Server) CreateDestination(ctx context.Context, in *v1.CreateDestinationRequest) (*v1.Destination, error)
- func (v *V1Server) CreateSource(ctx context.Context, in *v1.CreateSourceRequest) (*v1.Source, error)
- func (v *V1Server) CreateUser(ctx context.Context, in *v1.CreateUserRequest) (*v1.User, error)
- func (v *V1Server) DeleteSource(ctx context.Context, in *v1.DeleteSourceRequest) (*emptypb.Empty, error)
- func (v *V1Server) DeleteUser(ctx context.Context, in *v1.DeleteUserRequest) (*empty.Empty, error)
- func (v *V1Server) ListApiKeys(ctx context.Context, in *emptypb.Empty) (*v1.ListApiKeyResponse, error)
- func (v *V1Server) ListDestinations(ctx context.Context, _ *emptypb.Empty) (*v1.ListDestinationsResponse, error)
- func (v *V1Server) ListPermissions(ctx context.Context, in *v1.ListPermissionsRequest) (*v1.ListPermissionsResponse, error)
- func (v *V1Server) ListSources(context.Context, *emptypb.Empty) (*v1.ListSourcesResponse, error)
- func (v *V1Server) ListUsers(ctx context.Context, in *v1.ListUsersRequest) (*v1.ListUsersResponse, error)
- func (v *V1Server) Login(ctx context.Context, in *v1.LoginRequest) (*v1.LoginResponse, error)
- func (v *V1Server) Logout(ctx context.Context, in *emptypb.Empty) (*emptypb.Empty, error)
- func (v *V1Server) Signup(ctx context.Context, in *v1.SignupRequest) (*v1.LoginResponse, error)
- func (v *V1Server) Status(ctx context.Context, in *emptypb.Empty) (*v1.StatusResponse, error)
- func (v *V1Server) Version(ctx context.Context, in *emptypb.Empty) (*v1.VersionResponse, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SOURCE_TYPE_INFRA = "infra" SOURCE_TYPE_OKTA = "okta" )
View Source
var ( TOKEN_SECRET_LEN = 24 TOKEN_LEN = ID_LEN + TOKEN_SECRET_LEN )
View Source
var (
API_KEY_LEN = 24
)
View Source
var (
DESTINATION_TYPE_KUBERNERNETES = "kubernetes"
)
View Source
var (
ID_LEN = 12
)
Functions ¶
func ApplyPermissions ¶
func ApplyPermissions(db *gorm.DB, permissions []ConfigPermission) ([]string, error)
func ImportPermissions ¶
func ImportPermissions(db *gorm.DB, permissions []ConfigPermission) error
func ImportSources ¶
func ImportSources(db *gorm.DB, sources []ConfigSource) error
Types ¶
type ApiKey ¶ added in v0.0.6
type Config ¶
type Config struct { Sources []ConfigSource `yaml:"sources"` Permissions []ConfigPermission `yaml:"permissions"` }
type ConfigPermission ¶ added in v0.0.6
type ConfigSource ¶ added in v0.0.6
type Destination ¶
type Destination struct { Id string `gorm:"primaryKey"` Created int64 `gorm:"autoCreateTime"` Updated int64 `gorm:"autoUpdateTime"` Name string `gorm:"unique"` Type string KubernetesCa string KubernetesEndpoint string KubernetesNamespace string KubernetesSaToken string }
func (*Destination) AfterCreate ¶
func (d *Destination) AfterCreate(tx *gorm.DB) error
func (*Destination) AfterSave ¶ added in v0.0.6
func (d *Destination) AfterSave(tx *gorm.DB) (err error)
func (*Destination) BeforeCreate ¶
func (r *Destination) BeforeCreate(tx *gorm.DB) (err error)
func (*Destination) BeforeDelete ¶
func (d *Destination) BeforeDelete(tx *gorm.DB) (err error)
TODO (jmorganca): use foreign constraints instead?
type Http ¶ added in v0.0.6
type Http struct {
// contains filtered or unexported fields
}
func (*Http) Healthz ¶ added in v0.0.6
func (h *Http) Healthz(w http.ResponseWriter, r *http.Request)
func (*Http) WellKnownJWKs ¶ added in v0.0.6
func (h *Http) WellKnownJWKs(w http.ResponseWriter, r *http.Request)
type Permission ¶
type Permission struct { Id string `gorm:"primaryKey"` Created int64 `gorm:"autoCreateTime"` Updated int64 `gorm:"autoUpdateTime"` Role string UserId string DestinationId string User User `gorm:"foreignKey:UserId;references:Id"` Destination Destination `gorm:"foreignKey:DestinationId;references:Id"` FromConfig bool FromDefault bool }
func (*Permission) BeforeCreate ¶
func (g *Permission) BeforeCreate(tx *gorm.DB) (err error)
type Settings ¶
type Source ¶
type Source struct { Id string `gorm:"primaryKey"` Created int64 `gorm:"autoCreateTime"` Updated int64 `gorm:"autoUpdateTime"` Type string `yaml:"type"` OktaDomain string `gorm:"unique"` OktaClientId string OktaClientSecret string OktaApiToken string Users []User `gorm:"many2many:users_sources"` FromConfig bool }
func (*Source) CreateUser ¶
func (s *Source) CreateUser(db *gorm.DB, user *User, email string, password string, admin bool) error
CreateUser will create a user and associate them with the source If the user already exists, they will not be created, instead an association will be added instead
func (*Source) DeleteUser ¶
Delete will delete a user's association with a source If this is their only source, then the user will be deleted entirely TODO (jmorganca): wrap this in a transaction or at least find out why there seems to cause a bug when used in a nested transaction
type Token ¶
type Token struct { Id string `gorm:"primaryKey"` Created int64 `gorm:"autoCreateTime"` Updated int64 `gorm:"autoUpdateTime"` Expires int64 Secret []byte UserId string User User `gorm:"foreignKey:UserId;references:Id;"` }
func (*Token) CheckSecret ¶
type User ¶
type UserIdContextKey ¶ added in v0.0.6
type UserIdContextKey struct{}
type V1Server ¶ added in v0.0.6
type V1Server struct { v1.UnimplementedV1Server // contains filtered or unexported fields }
func (*V1Server) CreateCred ¶ added in v0.0.6
func (*V1Server) CreateDestination ¶ added in v0.0.6
func (v *V1Server) CreateDestination(ctx context.Context, in *v1.CreateDestinationRequest) (*v1.Destination, error)
func (*V1Server) CreateSource ¶ added in v0.0.6
func (*V1Server) CreateUser ¶ added in v0.0.6
func (*V1Server) DeleteSource ¶ added in v0.0.6
func (*V1Server) DeleteUser ¶ added in v0.0.6
func (*V1Server) ListApiKeys ¶ added in v0.0.6
func (*V1Server) ListDestinations ¶ added in v0.0.6
func (*V1Server) ListPermissions ¶ added in v0.0.6
func (v *V1Server) ListPermissions(ctx context.Context, in *v1.ListPermissionsRequest) (*v1.ListPermissionsResponse, error)
func (*V1Server) ListSources ¶ added in v0.0.6
func (*V1Server) ListUsers ¶ added in v0.0.6
func (v *V1Server) ListUsers(ctx context.Context, in *v1.ListUsersRequest) (*v1.ListUsersResponse, error)
func (*V1Server) Login ¶ added in v0.0.6
func (v *V1Server) Login(ctx context.Context, in *v1.LoginRequest) (*v1.LoginResponse, error)
func (*V1Server) Signup ¶ added in v0.0.6
func (v *V1Server) Signup(ctx context.Context, in *v1.SignupRequest) (*v1.LoginResponse, error)
Click to show internal directories.
Click to hide internal directories.