Documentation ¶
Index ¶
- Variables
- type APIToken
- type Config
- type EmailConfig
- type GoogleConfig
- type GoogleOAuthManager
- type GoogleUser
- type ProviderType
- type TokenAuthManager
- func (m *TokenAuthManager) CreateMerchantToken(ctx context.Context, merchantID int64, name string) (*APIToken, error)
- func (m *TokenAuthManager) CreateUserToken(ctx context.Context, merchantID int64, name string) (*APIToken, error)
- func (m *TokenAuthManager) DeleteToken(ctx context.Context, id int64) error
- func (m *TokenAuthManager) GetMerchantTokenByUUID(ctx context.Context, merchantID int64, id uuid.UUID) (*APIToken, error)
- func (m *TokenAuthManager) GetToken(ctx context.Context, tokenType TokenType, token string) (*APIToken, error)
- func (m *TokenAuthManager) GetTokenByUUID(ctx context.Context, id uuid.UUID) (*APIToken, error)
- func (m *TokenAuthManager) ListByEntityType(ctx context.Context, tokenType TokenType, entityID int64) ([]*APIToken, error)
- type TokenType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("token not found")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Google GoogleConfig `yaml:"google"` Email EmailConfig `yaml:"email"` }
func (*Config) EnabledProviders ¶
func (c *Config) EnabledProviders() []ProviderType
type EmailConfig ¶
type EmailConfig struct { Enabled bool `yaml:"enabled" env:"EMAIL_AUTH_ENABLED" env-default:"true" env-description:"Enables email auth"` FirstUserEmail string `yaml:"user_email" env:"EMAIL_AUTH_USER_EMAIL" env-description:"Email of an user that will be created on a first startup"` FirstUserPass string `` /* 129-byte string literal not displayed */ }
type GoogleConfig ¶
type GoogleConfig struct { Enabled bool `yaml:"enabled" env:"GOOGLE_AUTH_ENABLED" env-default:"false" env-description:"Internal variable"` ClientID string `yaml:"client_id" env:"GOOGLE_AUTH_CLIENT_ID" env-description:"Internal variable"` ClientSecret string `yaml:"client_secret" env:"GOOGLE_AUTH_CLIENT_SECRET" env-description:"Internal variable"` RedirectCallback string `yaml:"redirect_callback" env:"GOOGLE_AUTH_REDIRECT_CALLBACK" env-description:"Internal variable"` AuthenticatedRedirect string `yaml:"authenticated_redirect" env:"GOOGLE_AUTH_REDIRECT_SUCCESS" env-default:"/dashboard" env-description:"Internal variable"` }
type GoogleOAuthManager ¶
type GoogleOAuthManager struct {
// contains filtered or unexported fields
}
func NewGoogleOAuth ¶
func NewGoogleOAuth(cfg GoogleConfig, logger *zerolog.Logger) *GoogleOAuthManager
func (*GoogleOAuthManager) GetAuthenticatedRedirectURL ¶
func (a *GoogleOAuthManager) GetAuthenticatedRedirectURL() string
GetAuthenticatedRedirectURL returns a URL where user should be redirected when already authenticated.
func (*GoogleOAuthManager) RedirectURLWithState ¶ added in v0.4.0
func (a *GoogleOAuthManager) RedirectURLWithState() (string, string)
RedirectURLWithState return URL to Google auth screen.
func (*GoogleOAuthManager) ResolveUser ¶
func (a *GoogleOAuthManager) ResolveUser(ctx context.Context, code string) (*GoogleUser, error)
type GoogleUser ¶
type ProviderType ¶
type ProviderType string
const ( ProviderTypeGoogle ProviderType = "google" ProviderTypeEmail ProviderType = "email" )
type TokenAuthManager ¶
type TokenAuthManager struct {
// contains filtered or unexported fields
}
func NewTokenAuth ¶
func NewTokenAuth(repo *repository.Queries, logger *zerolog.Logger) *TokenAuthManager
func (*TokenAuthManager) CreateMerchantToken ¶
func (*TokenAuthManager) CreateUserToken ¶
func (*TokenAuthManager) DeleteToken ¶
func (m *TokenAuthManager) DeleteToken(ctx context.Context, id int64) error
func (*TokenAuthManager) GetMerchantTokenByUUID ¶
func (*TokenAuthManager) GetTokenByUUID ¶
func (*TokenAuthManager) ListByEntityType ¶
Click to show internal directories.
Click to hide internal directories.