Documentation
¶
Index ¶
Constants ¶
View Source
const ( // account logged in from other source: FB/Google/Github AccTypeExternal = "external" // account logged with username and password AccTypeInternal = "internal" // account external but has set username and password AccTypeBoth = "both" )
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(name string, clientConf clientcredentials.Config) *oauth
Types ¶
type AccountType ¶
type AccountType string
type OAuthUser ¶
type OAuthUser struct {
Id string `json:"id" gorm:"id"`
Username string `json:"username" gorm:"username"`
Email string `json:"email"`
PhonePrefix string `json:"phone_prefix" bson:"phone_prefix,omitempty" gorm:"phone_prefix"`
Phone string `json:"phone" bson:"phone,omitempty"`
AccountType AccountType `json:"account_type" bson:"account_type" gorm:"account_type"`
FBId string `json:"fb_id" bson:"fb_id" gorm:"fb_id"`
AKId string `json:"ak_id" bson:"account_kit_id" gorm:"column:account_kit_id"`
AppleId string `json:"apple_id" bson:"apple_id" gorm:"apple_id"`
ClientId string `json:"client_id" bson:"client_id"`
Dob *sdkcm.JSONDate `json:"dob,omitempty" form:"-" gorm:"dob" time_format:"2006-01-02"`
Status *int `json:"-" form:"-" gorm:"status"`
Gender *Gender `json:"gender,omitempty" form:"gender" gorm:"gender"`
Address *string `json:"address,omitempty" form:"address" gorm:"address"`
}
type OAuthUserCreate ¶
type OAuthUserCreate struct {
Username *string `json:"username" gorm:"username"`
Password *string `json:"-"`
Email *string `json:"email"`
PhonePrefix *string `json:"phone_prefix" bson:"phone_prefix,omitempty" gorm:"phone_prefix"`
Phone *string `json:"phone" bson:"phone,omitempty"`
AccountType *AccountType `json:"account_type" bson:"account_type" gorm:"account_type"`
FBId *string `json:"fb_id" bson:"fb_id" gorm:"fb_id"`
AKId *string `json:"ak_id" bson:"account_kit_id" gorm:"column:account_kit_id"`
AppleId *string `json:"apple_id" bson:"apple_id" gorm:"apple_id"`
ClientId *string `json:"client_id" bson:"client_id"`
}
type OAuthUserFilter ¶
type OAuthUserFilter struct {
UserId *string `json:"id" bson:"-" gorm:"-"`
Username *string `json:"username" gorm:"username"`
Email *string `json:"email"`
PhonePrefix *string `json:"phone_prefix" bson:"phone_prefix,omitempty" gorm:"phone_prefix"`
Phone *string `json:"phone" bson:"phone,omitempty"`
FBId *string `json:"fb_id" bson:"fb_id" gorm:"fb_id"`
AKId *string `json:"ak_id" bson:"account_kit_id" gorm:"column:account_kit_id"`
AppleId *string `json:"apple_id" bson:"apple_id" gorm:"apple_id"`
ClientId *string `json:"client_id" bson:"client_id"`
}
type OAuthUserLogin ¶
type OAuthUserLogin struct {
Username *string `json:"username" gorm:"username"`
Email *string `json:"email" gorm:"email"`
Phone *string `json:"phone" gorm:"phone"`
Password *string `json:"password" gorm:"phone"`
OTPCode *string `json:"otp_code" gorm:"otp_code"`
ClientId *string `json:"client_id" gorm:"client"`
}
func (*OAuthUserLogin) URLValues ¶
func (oul *OAuthUserLogin) URLValues() url.Values
type OAuthUserUpdate ¶
type OAuthUserUpdate struct {
Username *string
FirstName *string `json:"first_name" form:"first_name" gorm:"first_name"`
LastName *string `json:"last_name" form:"last_name" gorm:"last_name"`
Email *string `json:"email,omitempty" form:"email" gorm:"email"`
PhonePrefix *string `json:"phone_prefix,omitempty" form:"phone_prefix" gorm:"phone_prefix"`
Phone *string `json:"phone,omitempty" form:"phone" gorm:"phone"`
Gender *Gender `json:"gender,omitempty" form:"gender" gorm:"gender"`
Address *string `json:"address,omitempty" form:"address" gorm:"address"`
Dob *sdkcm.JSONDate `json:"dob,omitempty" form:"-" gorm:"dob" time_format:"2006-01-02"`
DobString *string `json:"dob" form:"dob" gorm:"-"`
Status *int `json:"-" form:"-" gorm:"status"`
Password *string `json:"password"`
PasswordConfirmation *string `json:"password_confirmation" gorm:"-"`
FBId *string `json:"fb_id" bson:"fb_id" gorm:"fb_id"`
AKId *string `json:"ak_id" bson:"account_kit_id" gorm:"column:account_kit_id"`
AppleId *string `json:"apple_id" bson:"apple_id" gorm:"apple_id"`
AccountType *AccountType `json:"account_type" bson:"account_type" gorm:"account_type"`
}
func (*OAuthUserUpdate) ProcessData ¶
func (u *OAuthUserUpdate) ProcessData() error
func (OAuthUserUpdate) TableName ¶
func (OAuthUserUpdate) TableName() string
type TokenIntrospect ¶
type TokenIntrospect struct {
Active bool `json:"active"`
ClientId string `json:"client_id"`
Scope string `json:"scope"`
Exp uint32 `json:"exp"`
Iat uint32 `json:"iat"`
Sub string `json:"sub"`
Username string `json:"username"`
Email string `json:"email"`
UserId string `json:"user_id"`
}
func (TokenIntrospect) OAuthID ¶
func (t TokenIntrospect) OAuthID() string
type TokenResponse ¶
type TrustedClient ¶
type TrustedClient interface {
PasswordCredentialsToken(ctx context.Context, username, password string) (*Token, error)
Introspect(ctx context.Context, token string) (*TokenIntrospect, error)
RefreshToken(ctx context.Context, refreshToken string) (*Token, error)
FindUserById(ctx context.Context, uid string) (*OAuthUser, error)
FindUser(ctx context.Context, filter *OAuthUserFilter) (*OAuthUser, error)
CreateUser(ctx context.Context, user *OAuthUserCreate) (*Token, error)
UpdateUser(ctx context.Context, uid string, update *OAuthUserUpdate) error
CreateUserWithEmail(ctx context.Context, email string) (*Token, error)
CreateUserWithPhone(ctx context.Context, phone string) (*Token, error)
CreateUserWithFacebook(ctx context.Context, fbId, email string) (*Token, error)
CreateUserWithAccountKit(ctx context.Context, akId, email, prefix, phone string) (*Token, error)
CreateUserWithApple(ctx context.Context, appleId, email string) (*Token, error)
ChangePassword(ctx context.Context, userId, oldPass, newPass string) error
SetUsernamePassword(ctx context.Context, userId, username, password string) error
LoginOtherCredential(ctx context.Context, userLogin *OAuthUserLogin) (*Token, error)
DeleteUser(ctx context.Context, userId string) error
}
Click to show internal directories.
Click to hide internal directories.