Documentation ¶
Index ¶
- Constants
- Variables
- type EventLoginStarted
- type FindAllByUserOpts
- type Session
- func (s *Session) IsAccessValid(accessToken, ipAddress string) bool
- func (s *Session) IsRefreshValid(accessToken, refreshToken string, ipAddress string) bool
- func (s *Session) Refresh(token string)
- func (s *Session) SetFcmToken(token string)
- func (s *Session) SetFromDevice(d *agent.Device)
- func (s *Session) VerifyRefreshToken(token string) bool
- func (s *Session) VerifyToken(token string) bool
- type SessionConfig
- type SessionDestroyOpts
- type SessionFindOpts
- type SessionRepo
- type SessionSaveOpts
- type Verify
- type VerifyConfig
- type VerifyDeleteOpts
- type VerifyFindOpts
- type VerifyIsExistsOpts
- type VerifyRepo
- type VerifySaveOpts
Constants ¶
View Source
const (
SubjectLoginStarted = "Auth.LoginStart"
)
Variables ¶
View Source
var ( VerificationExpired = rescode.New(3000, http.StatusForbidden, codes.Unauthenticated, "verification_expired", rescode.R{ "isExpired": true, }) VerificationExceeded = rescode.New(3001, http.StatusForbidden, codes.Unauthenticated, "verification_exceeded", rescode.R{ "isExceeded": true, }) VerificationInvalid = rescode.New(3002, http.StatusForbidden, codes.Unauthenticated, "verification_invalid", rescode.R{ "isInvalid": true, }) InvalidRefreshOrAccessTokens = rescode.New(3003, http.StatusForbidden, codes.InvalidArgument, "invalid_refresh_or_access_tokens", rescode.R{ "isInvalid": true, }) InvalidAccess = rescode.New(3004, http.StatusForbidden, codes.InvalidArgument, "invalid_access", rescode.R{ "isInvalid": true, }) InvalidOrExpiredToken = rescode.New(3005, http.StatusForbidden, codes.InvalidArgument, "invalid_or_expired_token", rescode.R{ "isInvalidOrExpired": true, }) InvalidRefreshToken = rescode.New(3006, http.StatusForbidden, codes.InvalidArgument, "invalid_refresh_token", rescode.R{ "isInvalid": true, }) "isUnauthorized": true, }) )
Functions ¶
This section is empty.
Types ¶
type EventLoginStarted ¶
type FindAllByUserOpts ¶
type Session ¶
type Session struct { DeviceId string `json:"device_id"` DeviceName string `json:"device_name"` DeviceType string `json:"device_type"` DeviceOS string `json:"device_os"` IpAddress string `json:"ip_address"` FcmToken string `json:"fcm_token"` RefreshToken string `json:"refresh_token"` AccessToken string `json:"access_token"` LastLogin time.Time `json:"last_login"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func NewSession ¶
func NewSession(cnf SessionConfig) *Session
func (*Session) IsAccessValid ¶
func (*Session) IsRefreshValid ¶
func (*Session) SetFcmToken ¶
func (*Session) SetFromDevice ¶
func (*Session) VerifyRefreshToken ¶
func (*Session) VerifyToken ¶
type SessionConfig ¶
type SessionDestroyOpts ¶
type SessionFindOpts ¶
type SessionRepo ¶
type SessionRepo interface { Save(ctx context.Context, t trace.Tracer, opts SessionSaveOpts) error Find(ctx context.Context, t trace.Tracer, opts SessionFindOpts) (*Session, bool, error) FindAllByUser(ctx context.Context, t trace.Tracer, opts FindAllByUserOpts) ([]*Session, error) Destroy(ctx context.Context, t trace.Tracer, opts SessionDestroyOpts) error }
type SessionSaveOpts ¶
type Verify ¶
type Verify struct { DeviceId string `json:"device_id"` Locale string `json:"locale"` UserId uuid.UUID `json:"user_id"` Code string `json:"code"` TryCount int `json:"try_count"` ExpiresAt int64 `json:"expires_at"` }
func NewVerify ¶
func NewVerify(cnf VerifyConfig) *Verify
func (*Verify) IncTryCount ¶
func (v *Verify) IncTryCount()
func (*Verify) IsExceeded ¶
type VerifyDeleteOpts ¶
type VerifyFindOpts ¶
type VerifyIsExistsOpts ¶
type VerifyRepo ¶
type VerifyRepo interface { Save(ctx context.Context, t trace.Tracer, opts VerifySaveOpts) error IsExists(ctx context.Context, t trace.Tracer, opts VerifyIsExistsOpts) (bool, error) Find(ctx context.Context, t trace.Tracer, opts VerifyFindOpts) (*Verify, error) Delete(ctx context.Context, t trace.Tracer, opts VerifyDeleteOpts) error }
type VerifySaveOpts ¶
Click to show internal directories.
Click to hide internal directories.