apps

package
v0.0.0-...-0eac02a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ConsoleApplicationClientId = "admin_console"
View Source
const DefaultApplicationClientId = "default"

Variables

This section is empty.

Functions

func NewApplicationError

func NewApplicationError(msg string) shared.AppError

Types

type AppDTO

type AppDTO struct {
	Description     string     `json:"description"`
	ClientId        string     `json:"client_id"`
	State           string     `json:"state"`
	Type            string     `json:"type"`
	CreatedAt       time.Time  `json:"created_at"`
	UpdatedAt       time.Time  `json:"updated_at"`
	DeletedAt       *time.Time `json:"deleted_at"`
	RedirectUris    []string   `json:"redirect_uris"`
	AvailableScopes []string   `json:"available_scopes"`
	// contains filtered or unexported fields
}

func ConvertModelToDTO

func ConvertModelToDTO(app *Application) *AppDTO

type Application

type Application struct {
	ID                 uuid.UUID  `gorm:"type:uuid;primary_key;"`
	CreatedAt          time.Time  `gorm:"type:timestamp"`
	UpdatedAt          time.Time  `gorm:"type:timestamp"`
	DeletedAt          *time.Time `gorm:"type:timestamp"`
	Codename           string     `gorm:"varchar"`
	Name               string     `gorm:"varchar"`
	Type               string     `gorm:"varchar"`
	State              string     `gorm:"varchar"`
	Description        string     `gorm:"varchar"`
	ClientId           string     `gorm:"varchar"`
	RedirectUrisStr    string     `gorm:"type:text;column:redirect_uris"`
	AvailableScopesStr string     `gorm:"type:text;column:available_scopes"`
}

func (*Application) AddScopes

func (a *Application) AddScopes(newScopes []string)

func (*Application) AddUris

func (a *Application) AddUris(newUris []string)

func (*Application) IsActive

func (a *Application) IsActive() bool

func (*Application) RedirectUris

func (a *Application) RedirectUris() []string

func (*Application) Scopes

func (a *Application) Scopes() []string

func (*Application) SetScopes

func (a *Application) SetScopes(scopes []string)

func (*Application) SetUris

func (a *Application) SetUris(uris []string)

func (Application) TableName

func (Application) TableName() string

type CreateDTO

type CreateDTO struct {
	Codename    string `json:"codename"`
	Name        string `json:"name"`
	Description string `json:"description"`
	ClientId    string `json:"client_id"`
	Type        string `json:"type"`
}

func (*CreateDTO) LogFields

func (d *CreateDTO) LogFields() log.Fields

type DiProvider

type DiProvider struct {
	Repos    Repositories
	Services Services
	Facade   Facade
}

func NewDiProvider

func NewDiProvider(db shared.DBConnection, features *shared.FeaturesConfig) DiProvider

type Facade

type Facade interface {
	Create(ctx context.Context, newApp *CreateDTO) (*Application, error)
	Update(ctx context.Context, userId uuid.UUID, newUser *UpdateDTO) (*Application, error)
	Delete(ctx context.Context, userId uuid.UUID) error
	List(ctx context.Context, listParams ListParams) ([]Application, error)
	Get(ctx context.Context, appId uuid.UUID) (*Application, error)
	GetByCodename(ctx context.Context, appId string) (*Application, error)
	GetByAnyId(ctx context.Context, sid string) (*Application, error)
	GetByClientId(ctx context.Context, sid string) (*Application, error)
}

func NewApplicationsFacade

func NewApplicationsFacade(apps Repository, secrets SecretsRepository, findService FindService) Facade

type FindQuery

type FindQuery struct {
	repos.PaginationQuery

	Id       uuid.UUID
	Codename string
	ClientId string
	State    string
	Type     string
	AnyId    string
}

type FindService

type FindService interface {
	Find(ctx context.Context, params FindQuery) ([]Application, error)
	FindOne(ctx context.Context, params FindQuery) (*Application, error)
}

func NewFindAppsService

func NewFindAppsService(repo Repository) FindService

type ListApplicationDTO

type ListApplicationDTO struct {
	// contains filtered or unexported fields
}

func ConvertModelsToList

func ConvertModelsToList(list []Application) (result []ListApplicationDTO)

type ListParams

type ListParams struct {
	Offset int
	Limit  int
}

type Repositories

type Repositories struct {
	Apps    Repository
	Secrets SecretsRepository
}

type Repository

type Repository interface {
	Create(ctx context.Context, app *Application) error
	Update(ctx context.Context, app *Application) error
	Delete(ctx context.Context, app *Application) error
	Query(ctx context.Context, query FindQuery) ([]Application, error)
	QueryOne(ctx context.Context, query FindQuery) (*Application, error)
}

func NweApplicationsRepositoryDB

func NweApplicationsRepositoryDB(db *gorm.DB) Repository

type SecretModel

type SecretModel struct {
	ID            uuid.UUID  `gorm:"type:uuid;primary_key;" json:"id"`
	ApplicationId uuid.UUID  `gorm:"type:varchar" json:"application_id"`
	Value         string     `gorm:"type:varchar" json:"value"`
	CreatedAt     time.Time  `gorm:"type:timestamp" json:"created_at"`
	UpdatedAt     time.Time  `gorm:"type:timestamp" json:"updated_at"`
	ExpiresAt     *time.Time `gorm:"type:timestamp" json:"expires_at"`
}

func (SecretModel) IsExpired

func (s SecretModel) IsExpired() bool

func (SecretModel) TableName

func (SecretModel) TableName() string

type SecretQuery

type SecretQuery struct {
	repos.PaginationQuery
	Id            uuid.UUID
	ApplicationId uuid.UUID
}

type SecretsRepository

type SecretsRepository interface {
	Create(ctx context.Context, secret *SecretModel) error
	Update(ctx context.Context, secret *SecretModel) error
	Delete(ctx context.Context, secret *SecretModel) error
	Query(ctx context.Context, query SecretQuery) ([]SecretModel, error)
	QueryOne(ctx context.Context, query SecretQuery) (*SecretModel, error)
}

func NewSecretsRepositoryDB

func NewSecretsRepositoryDB(db *gorm.DB) SecretsRepository

type Services

type Services struct {
	Find FindService
}

type UpdateDTO

type UpdateDTO struct {
	Codename    string `gorm:"varchar" json:"codename"`
	Name        string `gorm:"varchar" json:"name"`
	Description string `gorm:"varchar" json:"description"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL