Documentation
¶
Index ¶
- Variables
- func ConnectionInfoJSON(ip, device, userAgent string) []byte
- func CreateLoginToken(db db.TxHandler, email string) (core.User, string, error)
- func CreateResetToken(db db.TxHandler, email string) (core.User, string, error)
- func GenerateAPIKey(db db.Handler, auth *Auth, description string) (string, string, string, error)
- func Initialize(cfg Config, log zerolog.Logger) error
- func MagicLinksEnabled() bool
- func OpenIDProviders() []openid.Provider
- func OpenIDStart(db db.Handler, providerName, redirectURI string, clientType OpenIDClientType) (string, error)
- func PasswordAuthEnabled() bool
- func PasswordResetEnabled() bool
- func RevokeAPIKey(db db.Handler, userID int32, keyIDStr string, delete bool) error
- func UpdateAPIKeyDescription(db db.Handler, userID int32, keyIDStr string, description string) error
- func UpdateUserPassword(db db.TxHandler, email, password string) error
- func VerifyAndChangeUserPassword(db db.Handler, email, oldPassword, newPassword string) error
- type APIKey
- type Auth
- func NewAuth(auth *Auth, expires pgtype.Timestamptz, scopes []string) (*Auth, error)
- func NewSUAuth(user core.User) *Auth
- func PerformPasswordLogin(db db.TxHandler, email, password string) (auth *Auth, apiToken string, err error)
- func PerformTokenLogin(db db.TxHandler, encodedToken string) (*Auth, string, error)
- func ReadAPIKey(db db.Handler, keyIDStr, keyStr string, connectionInfo []byte) (*Auth, error)
- func ReadAPIToken(db db.Handler, encodedKey string, connectionInfo []byte) (*Auth, error)
- func ResetUserPassword(db db.TxHandler, email, resetToken, password string) (auth *Auth, apiToken string, err error)
- func VerifyUserPassword(d db.Handler, email, password string) (*Auth, error)
- type Config
- type ConnectionInfo
- type OpenIDClientType
- type PasswordBackend
- type PasswordConfig
- type PasswordRequirements
- type PasswordRequirementsError
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCredentialsInvalid = errors.New("invalid credentials")
View Source
var ErrTokenInvalid = errors.New("invalid token")
Functions ¶
func ConnectionInfoJSON ¶
func CreateLoginToken ¶
func CreateResetToken ¶
func GenerateAPIKey ¶
func MagicLinksEnabled ¶
func MagicLinksEnabled() bool
func OpenIDProviders ¶
func OpenIDStart ¶
func PasswordAuthEnabled ¶
func PasswordAuthEnabled() bool
func PasswordResetEnabled ¶
func PasswordResetEnabled() bool
func RevokeAPIKey ¶
func UpdateAPIKeyDescription ¶
Types ¶
type APIKey ¶
type APIKey struct { ID string Created time.Time Expires pgtype.Timestamptz Description string Scopes []string LastUsed ConnectionInfo }
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func PerformPasswordLogin ¶
func PerformTokenLogin ¶
func ReadAPIKey ¶
func ReadAPIToken ¶
func ResetUserPassword ¶
func VerifyUserPassword ¶
func (*Auth) GetFileSystem ¶
func (*Auth) HasScope ¶
HasScope checks whether or not this authorization includes the given scope, given the following rules:
- Scopes are nested using ":"
- All nested scopes are included for a given scope none are specified
- "*" matches all scopes at that level of nesting (above point applies)
Examples:
- "user:profile" is included in "user", which is included in "*"
- "files:read:id" is included in "files:read", as well as "files:*:id" which are both included in "files", which itself is included in "*"
func (*Auth) UserPermissions ¶
func (a *Auth) UserPermissions() core.UserPermissions
type ConnectionInfo ¶
type OpenIDClientType ¶
type OpenIDClientType uint8
const ( OpenIDClientNone OpenIDClientType = iota OpenIDClientWeb OpenIDClientNative )
func OpenIDValidateAuthCode ¶
func OpenIDValidateAuthCode(d db.Handler, state, authCode, redirectURI string) (OpenIDClientType, error)
type PasswordBackend ¶
type PasswordConfig ¶
type PasswordRequirements ¶
type PasswordRequirementsError ¶
type PasswordRequirementsError struct {
// contains filtered or unexported fields
}
func (PasswordRequirementsError) Error ¶
func (e PasswordRequirementsError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.