models

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidTokenError  = "invalid_token"
	TokenNotFoundError = "token_not_found"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthChangePassword added in v0.0.6

type OAuthChangePassword struct {
	OldPassword string `json:"oldPassword"`
	NewPassword string `json:"newPassword"`
}

type OAuthConfigurationResponse

type OAuthConfigurationResponse struct {
	Issuer                             string   `json:"issuer"`
	JwksURI                            string   `json:"jwks_uri"`
	AuthorizationEndpoint              string   `json:"authorization_endpoint"`
	TokenEndpoint                      string   `json:"token_endpoint"`
	UserinfoEndpoint                   string   `json:"userinfo_endpoint"`
	EndSessionEndpoint                 string   `json:"end_session_endpoint"`
	CheckSessionIframe                 string   `json:"check_session_iframe"`
	RevocationEndpoint                 string   `json:"revocation_endpoint"`
	IntrospectionEndpoint              string   `json:"introspection_endpoint"`
	DeviceAuthorizationEndpoint        string   `json:"device_authorization_endpoint"`
	FrontchannelLogoutSupported        bool     `json:"frontchannel_logout_supported"`
	FrontchannelLogoutSessionSupported bool     `json:"frontchannel_logout_session_supported"`
	BackchannelLogoutSupported         bool     `json:"backchannel_logout_supported"`
	BackchannelLogoutSessionSupported  bool     `json:"backchannel_logout_session_supported"`
	ScopesSupported                    []string `json:"scopes_supported"`
	ClaimsSupported                    []string `json:"claims_supported"`
	GrantTypesSupported                []string `json:"grant_types_supported"`
	ResponseTypesSupported             []string `json:"response_types_supported"`
	ResponseModesSupported             []string `json:"response_modes_supported"`
	TokenEndpointAuthMethodsSupported  []string `json:"token_endpoint_auth_methods_supported"`
	SubjectTypesSupported              []string `json:"subject_types_supported"`
	IDTokenSigningAlgValuesSupported   []string `json:"id_token_signing_alg_values_supported"`
	CodeChallengeMethodsSupported      []string `json:"code_challenge_methods_supported"`
	RequestParameterSupported          bool     `json:"request_parameter_supported"`
}

type OAuthErrorResponse

type OAuthErrorResponse struct {
	Error            OAuthErrorType `json:"error"`
	ErrorDescription string         `json:"error_description,omitempty"`
	ErrorUri         string         `json:"error_uri,omitempty"`
}

OAuthErrorResponse entity

func NewOAuthErrorResponse

func NewOAuthErrorResponse(err OAuthErrorType, description string) OAuthErrorResponse

func (OAuthErrorResponse) Log

func (err OAuthErrorResponse) Log(extraLogs ...string)

func (OAuthErrorResponse) String

func (err OAuthErrorResponse) String() string

type OAuthErrorType

type OAuthErrorType int64

OAuthErrorType Enum

const (
	OAuthInvalidRequestError OAuthErrorType = iota
	OAuthInvalidClientError
	OAuthInvalidGrant
	OAuthInvalidScope
	OAuthUserExists
	OAuthUnauthorizedClient
	OAuthUnsupportedGrantType
	OAuthPasswordMismatch
	OAuthPasswordValidation
	OAuthUserValidation
	OAuthEmailNotVerified
	OAuthUserBlocked
	UnknownError
)

func (OAuthErrorType) FromString

func (oAuthErrorType OAuthErrorType) FromString(keyType string) OAuthErrorType

func (OAuthErrorType) MarshalJSON

func (oAuthErrorType OAuthErrorType) MarshalJSON() ([]byte, error)

func (OAuthErrorType) String

func (oAuthErrorType OAuthErrorType) String() string

func (*OAuthErrorType) UnmarshalJSON

func (oAuthErrorType *OAuthErrorType) UnmarshalJSON(b []byte) error

type OAuthGrantType

type OAuthGrantType int64

OAuthGrantType Enum

const (
	OAuthPasswordGrant OAuthGrantType = iota
)

func (OAuthGrantType) FromString

func (oauthGrantType OAuthGrantType) FromString(keyType string) OAuthGrantType

func (OAuthGrantType) MarshalJSON

func (oauthGrantType OAuthGrantType) MarshalJSON() ([]byte, error)

func (OAuthGrantType) String

func (oauthGrantType OAuthGrantType) String() string

func (*OAuthGrantType) UnmarshalJSON

func (oauthGrantType *OAuthGrantType) UnmarshalJSON(b []byte) error

type OAuthIntrospectResponse

type OAuthIntrospectResponse struct {
	ID        string `json:"jti,omitempty"`
	Active    bool   `json:"active"`
	TokenType string `json:"token_type,omitempty"`
	Subject   string `json:"sub,omitempty"`
	ClientId  string `json:"client_id,omitempty"`
	ExpiresAt string `json:"exp,omitempty"`
	IssuedAt  string `json:"iat,omitempty"`
	Issuer    string `json:"iss,omitempty"`
}

OAuthIntrospectResponse entity

type OAuthJwksKey

type OAuthJwksKey struct {
	ID              string                       `json:"kid"`
	Algorithm       encryption.EncryptionKey     `json:"alg"`
	AlgorithmFamily encryption.EncryptionKeyType `json:"kty"`
	Use             string                       `json:"use"`
	X5C             []string                     `json:"x5c"`
	Exponent        string                       `json:"e,omitempty"`
	Modulus         string                       `json:"n,omitempty"`
	Curve           string                       `json:"curve,omitempty"`
	X               string                       `json:"x,omitempty"`
	Y               string                       `json:"y,omitempty"`
	Thumbprint      string                       `json:"x5t"`
}

type OAuthJwksResponse

type OAuthJwksResponse struct {
	Keys []OAuthJwksKey `json:"keys"`
}

type OAuthLoginRequest

type OAuthLoginRequest struct {
	GrantType    string `json:"grant_type"`
	Username     string `json:"username,omitempty"`
	Password     string `json:"password,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Scope        string `json:"scope,omitempty"`
	ProviderID   string `json:"providerId,omitempty"`
	ClientID     string `json:"client_id,omitempty"`
	ClientSecret string `json:"client_secret,omitempty"`
}

OAuthLoginRequest Entity

type OAuthLoginResponse

type OAuthLoginResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    string `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
}

OAuthLoginRequest Entity

type OAuthNotification added in v0.0.7

type OAuthNotification struct {
	Type    OAuthNotificationType
	Data    interface{}
	Request *http.Request
	Error   *OAuthErrorResponse
}

func (OAuthNotification) GetBody added in v0.0.11

func (n OAuthNotification) GetBody(dest interface{}) error

func (OAuthNotification) Success added in v0.0.11

func (n OAuthNotification) Success() bool

type OAuthNotificationType added in v0.0.7

type OAuthNotificationType int64

OAuthNotificationType Enum

const (
	RegistrationRequest OAuthNotificationType = iota
	EmailValidationRequest
	EmailValidation
	PasswordRecoveryRequest
	PasswordRecoveryValidation
	PasswordRecovery
	PasswordChange
	TokenRequest
	TokenRevoked
	ConfigurationRequest
)

func (OAuthNotificationType) FromString added in v0.0.7

func (oOAuthNotificationType OAuthNotificationType) FromString(keyType string) OAuthNotificationType

func (OAuthNotificationType) MarshalJSON added in v0.0.7

func (OAuthNotificationType OAuthNotificationType) MarshalJSON() ([]byte, error)

func (OAuthNotificationType) String added in v0.0.7

func (OAuthNotificationType OAuthNotificationType) String() string

func (*OAuthNotificationType) UnmarshalJSON added in v0.0.7

func (OAuthNotificationType *OAuthNotificationType) UnmarshalJSON(b []byte) error

type OAuthRecoverPasswordChangeRequest added in v0.0.20

type OAuthRecoverPasswordChangeRequest struct {
	UserID       string `json:"user_id"`
	RecoverToken string `json:"recover_token"`
	NewPassword  string `json:"new_password"`
}

type OAuthRecoverPasswordRequest added in v0.0.17

type OAuthRecoverPasswordRequest struct {
	Email string `json:"email"`
}

type OAuthRecoverPasswordValidateRequest added in v0.0.20

type OAuthRecoverPasswordValidateRequest struct {
	UserID       string `json:"user_id"`
	RecoverToken string `json:"recover_token"`
}

type OAuthRegisterRequest

type OAuthRegisterRequest struct {
	Username  string   `json:"username"`
	Password  string   `json:"password"`
	Email     string   `json:"email"`
	FirstName string   `json:"firstName"`
	LastName  string   `json:"lastName"`
	Roles     []string `json:"roles"`
	Claims    []string `json:"claims"`
}

type OAuthRevokeRequest

type OAuthRevokeRequest struct {
	ClientID  string `json:"client_id"`
	GrantType string `json:"grant_type"`
}

type OAuthVerifyEmail added in v0.0.6

type OAuthVerifyEmail struct {
	UserID     string `json:"user_id"`
	EmailToken string `json:"email_token"`
}

type OAuthVerifyEmailRequest added in v0.0.17

type OAuthVerifyEmailRequest struct {
	Email string `json:"email"`
}

type Tenant

type Tenant struct {
	ID   string `json:"id" bson:"_id"`
	Name string `json:"name" bson:"name"`
}

func NewTenant

func NewTenant() *Tenant

type TenantFeature

type TenantFeature struct {
	ID    string             `json:"id" bson:"_id"`
	Name  string             `json:"name" bson:"name"`
	State TenantFeatureState `json:"state" bson:"state"`
}

type TenantFeatureState

type TenantFeatureState int64
const (
	Unknown TenantFeatureState = iota
	Provisioning
	Provisioned
	Enabling
	Enabled
	Disabling
	Disabled
	Deleting
	Deleted
	Error
)

func (TenantFeatureState) FromString

func (l TenantFeatureState) FromString(value string) TenantFeatureState

func (TenantFeatureState) String

func (l TenantFeatureState) String() string

type User

type User struct {
	ID               string      `json:"id" bson:"_id"`
	Email            string      `json:"email" bson:"email"`
	EmailVerified    bool        `json:"emailVerified" bson:"emailVerified"`
	Username         string      `json:"username" bson:"username"`
	FirstName        string      `json:"firstName" bson:"firstName"`
	LastName         string      `json:"lastName" bson:"lastName"`
	DisplayName      string      `json:"displayName" bson:"displayName"`
	Password         string      `json:"password" bson:"password"`
	Token            string      `json:"-" bson:"-"`
	RefreshToken     string      `json:"refreshToken" bson:"refreshToken"`
	RecoveryToken    string      `json:"recoveryToken" bson:"recoveryToken"`
	EmailVerifyToken string      `json:"emailVerifyToken" bson:"emailVerifyToken"`
	InvalidAttempts  int         `json:"invalidAttempts" bson:"invalidAttempts"`
	Blocked          bool        `json:"blocked" bson:"blocked"`
	BlockedUntil     string      `json:"blockedUntil" bson:"blockedUntil"`
	Roles            []UserRole  `json:"roles" bson:"roles"`
	Claims           []UserClaim `json:"claims" bson:"claims"`
}

User entity

func NewUser

func NewUser() *User

func (User) GetHashedPassword added in v0.0.6

func (u User) GetHashedPassword() string

func (User) HashPassword added in v0.0.6

func (u User) HashPassword(password string) string

func (User) IsValid

func (u User) IsValid() bool

type UserClaim

type UserClaim struct {
	ID   string `json:"id" bson:"_id"`
	Name string `json:"claimName" bson:"claimName"`
}

func NewUserClaim

func NewUserClaim(id string, name string) UserClaim

func (UserClaim) IsValid

func (uc UserClaim) IsValid() bool

type UserRole

type UserRole struct {
	ID   string `json:"id" bson:"_id"`
	Name string `json:"roleName" bson:"roleName"`
}

func NewUserRole

func NewUserRole(id string, name string) UserRole

func (UserRole) IsSuperUser

func (ur UserRole) IsSuperUser() bool

func (UserRole) IsValid

func (ur UserRole) IsValid() bool

type UserToken

type UserToken struct {
	ID            string    `json:"jti,omitempty"`
	Scope         string    `json:"scope,omitempty"`
	User          string    `json:"sub,omitempty"`
	Issuer        string    `json:"iss,omitempty"`
	FirstName     string    `json:"given_name,omitempty"`
	LastName      string    `json:"family_name,omitempty"`
	UserID        string    `json:"uid,omitempty"`
	TenantId      string    `json:"tid,omitempty"`
	DisplayName   string    `json:"name,omitempty"`
	Email         string    `json:"email,omitempty"`
	EmailVerified bool      `json:"email_verified,omitempty"`
	Nonce         string    `json:"nonce,omitempty"`
	NotBefore     time.Time `json:"nbf,omitempty"`
	ExpiresAt     time.Time `json:"exp,omitempty"`
	IssuedAt      time.Time `json:"iat,omitempty"`
	Audiences     []string  `json:"aud,omitempty"`
	Roles         []string  `json:"roles,omitempty"`
	UsedKeyID     string    `json:"-"`
	RefreshToken  string    `json:"-"`
	Token         string    `json:"-"`
}

func (*UserToken) UnmarshalJSON

func (userToken *UserToken) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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