Documentation
¶
Index ¶
- func ForgetPwdVerifyKindValidator(k ForgetPwdVerifyKind) error
- func GrantTypeValidator(gt GrantType) error
- func KindValidator(k Kind) error
- func RegisterAuthHandlers(router *gin.RouterGroup, si AuthServer)
- func RegisterHandlersManual(router *gin.RouterGroup, service *ServerImpl)
- func RegisterValidator()
- type AppOrgsRequest
- type AuthServer
- type BindFingerprintRequest
- type BindMfaRequest
- type Captcha
- type CaptchaRequest
- type CheckDeviceRequest
- type CheckDeviceResponse
- type DeviceInfo
- type Domain
- type Error
- type ErrorResponse
- type FingerprintLoginRequest
- type ForgetPwdBeginRequest
- type ForgetPwdBeginResponse
- type ForgetPwdResetRequest
- type ForgetPwdSendEmailRequest
- type ForgetPwdVerify
- type ForgetPwdVerifyEmailRequest
- type ForgetPwdVerifyKind
- type ForgetPwdVerifyMfaRequest
- type GetDomainRequest
- type GetPreSignUrlRequest
- type GetPreSignUrlResponse
- type GetSTSRequest
- type GetSTSResponse
- type GetSpmAuthRequest
- type GrantType
- type Kind
- type LoginRequest
- type LoginResponse
- type Mfa
- type OldFingerprintLoginRequest
- type OldLoginForAppRequest
- type Options
- type OptionsPwdPolicy
- type RefreshTokenRequest
- type ResetPasswordRequest
- type Server
- type ServerImpl
- func (s *ServerImpl) AppOrgs(ctx *gin.Context, req *AppOrgsRequest) ([]*Domain, error)
- func (s *ServerImpl) Apply(cnf *conf.AppConfiguration) error
- func (s *ServerImpl) BindFingerprint(ctx *gin.Context, req *BindFingerprintRequest) (bool, error)
- func (s *ServerImpl) BindMfa(ctx *gin.Context, req *BindMfaRequest) (bool, error)
- func (s *ServerImpl) BindMfaPrepare(ctx *gin.Context) (*Mfa, error)
- func (s *ServerImpl) Captcha(ctx *gin.Context, req *CaptchaRequest) (*Captcha, error)
- func (s *ServerImpl) CheckDevice(ctx *gin.Context, req *CheckDeviceRequest) (*CheckDeviceResponse, error)
- func (s *ServerImpl) CreateSpm(ctx *gin.Context) (string, error)
- func (s *ServerImpl) FingerprintLogin(ctx *gin.Context, req *FingerprintLoginRequest) (*LoginResponse, error)
- func (s *ServerImpl) ForgetPwdBegin(ctx *gin.Context, req *ForgetPwdBeginRequest) (*ForgetPwdBeginResponse, error)
- func (s *ServerImpl) ForgetPwdReset(ctx *gin.Context, req *ForgetPwdResetRequest) (bool, error)
- func (s *ServerImpl) ForgetPwdSendEmail(ctx *gin.Context, req *ForgetPwdSendEmailRequest) (string, error)
- func (s *ServerImpl) ForgetPwdVerifyEmail(ctx *gin.Context, req *ForgetPwdVerifyEmailRequest) (*ForgetPwdBeginResponse, error)
- func (s *ServerImpl) ForgetPwdVerifyMfa(ctx *gin.Context, req *ForgetPwdVerifyMfaRequest) (*ForgetPwdBeginResponse, error)
- func (s *ServerImpl) GetDomain(ctx *gin.Context, req *GetDomainRequest) (*Domain, error)
- func (s *ServerImpl) GetPreSignUrl(ctx *gin.Context, req *GetPreSignUrlRequest) (*GetPreSignUrlResponse, error)
- func (s *ServerImpl) GetSTS(c *gin.Context, req *GetSTSRequest) (*GetSTSResponse, error)
- func (s *ServerImpl) GetSpmAuth(c *gin.Context, r *GetSpmAuthRequest) (*LoginResponse, error)
- func (s *ServerImpl) GetUserRootOrg(ctx *gin.Context, uid int) (uorg *ent.Org, err error)
- func (s *ServerImpl) Login(ctx *gin.Context, req *LoginRequest) (res *LoginResponse, err error)
- func (s *ServerImpl) Logout(ctx *gin.Context) error
- func (s *ServerImpl) MfaQRCode(ctx *gin.Context, userID int, secret string) ([]byte, error)
- func (s *ServerImpl) OldFingerprintLogin(ctx *gin.Context, req *OldFingerprintLoginRequest) (*LoginResponse, error)
- func (s *ServerImpl) OldLoginForApp(ctx *gin.Context, req *OldLoginForAppRequest) (res *LoginResponse, err error)
- func (s *ServerImpl) ParentDomain(ctx context.Context, orgID int) (string, error)
- func (s *ServerImpl) PasswordPolicy(ctx *gin.Context) (*UserPasswordPolicy, error)
- func (s *ServerImpl) RefreshToken(ctx *gin.Context, req *RefreshTokenRequest) (*LoginResponse, error)
- func (s *ServerImpl) ResetPassword(ctx *gin.Context, req *ResetPasswordRequest) (res *LoginResponse, err error)
- func (s *ServerImpl) Token(c *gin.Context, r *TokenRequest) (*TokenResponse, error)
- func (s *ServerImpl) UnBindMfa(ctx *gin.Context, req *UnBindMfaRequest) (bool, error)
- func (s *ServerImpl) VerifyDevice(ctx *gin.Context, req *VerifyDeviceRequest) (*LoginResponse, error)
- func (s *ServerImpl) VerifyDeviceSendEmail(ctx *gin.Context, req *VerifyDeviceSendEmailRequest) (string, error)
- func (s *ServerImpl) VerifyFactor(ctx *gin.Context, req *VerifyFactorRequest) (*LoginResponse, error)
- type TokenRequest
- type TokenResponse
- type UnBindMfaRequest
- type UnimplementedAuthServer
- func (UnimplementedAuthServer) AppOrgs(c *gin.Context, req *AppOrgsRequest) (_ []*Domain, err error)
- func (UnimplementedAuthServer) BindFingerprint(c *gin.Context, req *BindFingerprintRequest) (_ bool, err error)
- func (UnimplementedAuthServer) BindMfa(c *gin.Context, req *BindMfaRequest) (_ bool, err error)
- func (UnimplementedAuthServer) BindMfaPrepare(c *gin.Context) (_ *Mfa, err error)
- func (UnimplementedAuthServer) Captcha(c *gin.Context, req *CaptchaRequest) (_ *Captcha, err error)
- func (UnimplementedAuthServer) CheckDevice(c *gin.Context, req *CheckDeviceRequest) (_ *CheckDeviceResponse, err error)
- func (UnimplementedAuthServer) CreateSpm(c *gin.Context) (_ string, err error)
- func (UnimplementedAuthServer) FingerprintLogin(c *gin.Context, req *FingerprintLoginRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) ForgetPwdBegin(c *gin.Context, req *ForgetPwdBeginRequest) (_ *ForgetPwdBeginResponse, err error)
- func (UnimplementedAuthServer) ForgetPwdReset(c *gin.Context, req *ForgetPwdResetRequest) (_ bool, err error)
- func (UnimplementedAuthServer) ForgetPwdSendEmail(c *gin.Context, req *ForgetPwdSendEmailRequest) (_ string, err error)
- func (UnimplementedAuthServer) ForgetPwdVerifyEmail(c *gin.Context, req *ForgetPwdVerifyEmailRequest) (_ *ForgetPwdBeginResponse, err error)
- func (UnimplementedAuthServer) ForgetPwdVerifyMfa(c *gin.Context, req *ForgetPwdVerifyMfaRequest) (_ *ForgetPwdBeginResponse, err error)
- func (UnimplementedAuthServer) GetDomain(c *gin.Context, req *GetDomainRequest) (_ *Domain, err error)
- func (UnimplementedAuthServer) GetPreSignUrl(c *gin.Context, req *GetPreSignUrlRequest) (_ *GetPreSignUrlResponse, err error)
- func (UnimplementedAuthServer) GetSTS(c *gin.Context, req *GetSTSRequest) (_ *GetSTSResponse, err error)
- func (UnimplementedAuthServer) GetSpmAuth(c *gin.Context, req *GetSpmAuthRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) Login(c *gin.Context, req *LoginRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) Logout(c *gin.Context) (err error)
- func (UnimplementedAuthServer) OldFingerprintLogin(c *gin.Context, req *OldFingerprintLoginRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) OldLoginForApp(c *gin.Context, req *OldLoginForAppRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) PasswordPolicy(c *gin.Context) (_ *UserPasswordPolicy, err error)
- func (UnimplementedAuthServer) RefreshToken(c *gin.Context, req *RefreshTokenRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) ResetPassword(c *gin.Context, req *ResetPasswordRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) Token(c *gin.Context, req *TokenRequest) (_ *TokenResponse, err error)
- func (UnimplementedAuthServer) UnBindMfa(c *gin.Context, req *UnBindMfaRequest) (_ bool, err error)
- func (UnimplementedAuthServer) VerifyDevice(c *gin.Context, req *VerifyDeviceRequest) (_ *LoginResponse, err error)
- func (UnimplementedAuthServer) VerifyDeviceSendEmail(c *gin.Context, req *VerifyDeviceSendEmailRequest) (_ string, err error)
- func (UnimplementedAuthServer) VerifyFactor(c *gin.Context, req *VerifyFactorRequest) (_ *LoginResponse, err error)
- type User
- type UserPasswordPolicy
- type VerifyDeviceRequest
- type VerifyDeviceSendEmailRequest
- type VerifyFactorRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForgetPwdVerifyKindValidator ¶
func ForgetPwdVerifyKindValidator(k ForgetPwdVerifyKind) error
ForgetPwdVerifyKindValidator is a validator for the ForgetPwdVerifyKind field enum values.
func GrantTypeValidator ¶
GrantTypeValidator is a validator for the GrantType field enum values.
func KindValidator ¶
KindValidator is a validator for the Kind field enum values.
func RegisterAuthHandlers ¶
func RegisterAuthHandlers(router *gin.RouterGroup, si AuthServer)
RegisterAuthHandlers creates http.Handler with routing matching OpenAPI spec.
func RegisterHandlersManual ¶
func RegisterHandlersManual(router *gin.RouterGroup, service *ServerImpl)
func RegisterValidator ¶
func RegisterValidator()
Types ¶
type AppOrgsRequest ¶
type AppOrgsRequest struct {
// AppCode the app code
AppCode string `binding:"required" json:"appCode"`
}
AppOrgsRequest is the request object for (POST /login/app-orgs)
type AuthServer ¶
type AuthServer interface {
// AppOrgs Use this API to get app login orgs
// (POST /login/app-orgs)
AppOrgs(*gin.Context, *AppOrgsRequest) ([]*Domain, error)
// BindFingerprint Use this API to enable fingerprint login
// (POST /login/bind-fingerprint)
BindFingerprint(*gin.Context, *BindFingerprintRequest) (bool, error)
// BindMfa Verify a one-time password (OTP) value to binding MFA.
// (POST /mfa/bind)
BindMfa(*gin.Context, *BindMfaRequest) (bool, error)
// BindMfaPrepare Use this api to get the temporary MFA secret key.
// (POST /mfa/bind-prepare)
BindMfaPrepare(*gin.Context) (*Mfa, error)
// Captcha Use this API to get captcha
// (GET /captcha)
Captcha(*gin.Context, *CaptchaRequest) (*Captcha, error)
// CheckDevice Check whether the device needs verification.
// (POST /login/check-device)
CheckDevice(*gin.Context, *CheckDeviceRequest) (*CheckDeviceResponse, error)
// CreateSpm create spm key.
// (POST /spm/create)
CreateSpm(*gin.Context) (string, error)
// FingerprintLogin Use this API to fingerprint login
// (POST /login/fingerprint)
FingerprintLogin(*gin.Context, *FingerprintLoginRequest) (*LoginResponse, error)
// ForgetPwdBegin start the process of forgetting your password by verifying your account.
// (POST /forget-pwd/begin)
ForgetPwdBegin(*gin.Context, *ForgetPwdBeginRequest) (*ForgetPwdBeginResponse, error)
// ForgetPwdReset reset-password.
// (POST /forget-pwd/reset)
ForgetPwdReset(*gin.Context, *ForgetPwdResetRequest) (bool, error)
// ForgetPwdSendEmail send an email to get the verify code.
// (POST /forget-pwd/send-email)
ForgetPwdSendEmail(*gin.Context, *ForgetPwdSendEmailRequest) (string, error)
// ForgetPwdVerifyEmail verify the email to reset-password.
// (POST /forget-pwd/verify-email)
ForgetPwdVerifyEmail(*gin.Context, *ForgetPwdVerifyEmailRequest) (*ForgetPwdBeginResponse, error)
// ForgetPwdVerifyMfa verify the email to reset-password.
// (POST /forget-pwd/verify-mfa)
ForgetPwdVerifyMfa(*gin.Context, *ForgetPwdVerifyMfaRequest) (*ForgetPwdBeginResponse, error)
// GetDomain Use this API to get domain
// (GET /org/domain)
GetDomain(*gin.Context, *GetDomainRequest) (*Domain, error)
// GetPreSignUrl return the temporary authorization access url
// (POST /oss/presignurl)
GetPreSignUrl(*gin.Context, *GetPreSignUrlRequest) (*GetPreSignUrlResponse, error)
// GetSTS return temporary credentials by aws sts
// (POST /oss/sts)
GetSTS(*gin.Context, *GetSTSRequest) (*GetSTSResponse, error)
// GetSpmAuth get auth data by spm.
// (POST /spm/auth)
GetSpmAuth(*gin.Context, *GetSpmAuthRequest) (*LoginResponse, error)
// Login Use this API to Login
// (POST /login/auth)
Login(*gin.Context, *LoginRequest) (*LoginResponse, error)
// Logout log out a user
// (POST /logout)
Logout(*gin.Context) error
// OldFingerprintLogin Use this API to fingerprint login
// (POST /login/old-fingerprint)
OldFingerprintLogin(*gin.Context, *OldFingerprintLoginRequest) (*LoginResponse, error)
// OldLoginForApp use this API to compatible old app login
// (POST /login/old-auth)
OldLoginForApp(*gin.Context, *OldLoginForAppRequest) (*LoginResponse, error)
// PasswordPolicy Use this API to get pwd policy
// (GET /pwd/policy)
PasswordPolicy(*gin.Context) (*UserPasswordPolicy, error)
// RefreshToken Use this API to refresh token
// (POST /login/refresh-token)
RefreshToken(*gin.Context, *RefreshTokenRequest) (*LoginResponse, error)
// ResetPassword if login profile demand change password. use this API to reset password.
// (POST /login/reset-password)
ResetPassword(*gin.Context, *ResetPasswordRequest) (*LoginResponse, error)
// Token return access token for oauth2 flow
// (POST /token)
Token(*gin.Context, *TokenRequest) (*TokenResponse, error)
// UnBindMfa Verify a one-time password (OTP) value to unBind MFA.
// (POST /mfa/unbind)
UnBindMfa(*gin.Context, *UnBindMfaRequest) (bool, error)
// VerifyDevice verify the device login with the verification code.
// (POST /login/verify-device)
VerifyDevice(*gin.Context, *VerifyDeviceRequest) (*LoginResponse, error)
// VerifyDeviceSendEmail the captcha code is sent to the login device.
// (POST /login/device-captcha)
VerifyDeviceSendEmail(*gin.Context, *VerifyDeviceSendEmailRequest) (string, error)
// VerifyFactor Verify a one-time password (OTP) value, provided for a second factor, when multi-factor authentication (MFA) is required.
// (POST /login/verify-factor)
VerifyFactor(*gin.Context, *VerifyFactorRequest) (*LoginResponse, error)
}
AuthServer is the server API for Auth service.
type BindFingerprintRequest ¶
type BindFingerprintRequest struct {
// UserPassword the userPassword
UserPassword string `binding:"required" json:"userPassword"`
}
BindFingerprintRequest is the request object for (POST /login/bind-fingerprint)
type BindMfaRequest ¶
type BindMfaRequest struct {
OtpToken string `binding:"required" json:"otpToken"`
StateToken string `binding:"required" json:"stateToken"`
}
BindMfaRequest is the request object for (POST /mfa/bind)
type Captcha ¶
type Captcha struct {
CaptchaId string `json:"captchaId,omitempty"`
CaptchaImage string `json:"captchaImage,omitempty"`
}
Captcha captcha info
type CaptchaRequest ¶
type CaptchaRequest struct {
// W width of captcha
W *int `form:"w"`
// H height of captcha
H *int `form:"h"`
}
CaptchaRequest is the request object for (GET /captcha)
type CheckDeviceRequest ¶
type CheckDeviceRequest struct {
// DeviceInfo device info
DeviceInfo DeviceInfo `json:"deviceInfo"`
}
CheckDeviceRequest is the request object for (POST /login/check-device)
type CheckDeviceResponse ¶
type CheckDeviceResponse struct {
// StateToken use the state token to request callback_url
StateToken string `json:"stateToken,omitempty"`
Verifies []*ForgetPwdVerify `json:"verifies,omitempty"`
VerifyDevice bool `json:"verifyDevice,omitempty"`
}
CheckDeviceResponse whether the device needs verification.
type DeviceInfo ¶
type DeviceInfo struct {
AppVersion string `json:"appVersion,omitempty"`
Comments string `json:"comments,omitempty"`
DeviceModel string `json:"deviceModel,omitempty"`
DeviceName string `json:"deviceName,omitempty"`
DeviceUid string `json:"deviceUid,omitempty"`
SystemName string `json:"systemName,omitempty"`
SystemVersion string `json:"systemVersion,omitempty"`
}
DeviceInfo device info
type Domain ¶
type Domain struct {
ID int `json:"id,omitempty"`
LocalCurrency string `json:"local_currency,omitempty"`
Name string `json:"name,omitempty"`
ParentCurrency string `json:"parent_currency,omitempty"`
// ParentID the top-level parent domain id
ParentID int `json:"parent_id,omitempty"`
// ParentName the top-level parent domain name
ParentName string `json:"parent_name,omitempty"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Errors []*Error `json:"errors,omitempty"`
}
type FingerprintLoginRequest ¶
type FingerprintLoginRequest struct {
// RefreshToken the refreshToken
RefreshToken string `binding:"required" json:"refreshToken"`
}
FingerprintLoginRequest is the request object for (POST /login/fingerprint)
type ForgetPwdBeginRequest ¶
type ForgetPwdBeginRequest struct {
Captcha string `binding:"required" json:"captcha"`
CaptchaId string `binding:"required" json:"captchaId"`
Username string `binding:"required" json:"username"`
}
ForgetPwdBeginRequest is the request object for (POST /forget-pwd/begin)
type ForgetPwdBeginResponse ¶
type ForgetPwdBeginResponse struct {
StateToken string `json:"stateToken,omitempty"`
StateTokenTTL float64 `json:"stateTokenTTL,omitempty"`
Verifies []*ForgetPwdVerify `json:"verifies,omitempty"`
}
type ForgetPwdResetRequest ¶
type ForgetPwdResetRequest struct {
NewPassword string `binding:"required" json:"newPassword"`
// StateToken from verify-mfa or verify-email
StateToken string `binding:"required" json:"stateToken"`
}
ForgetPwdResetRequest is the request object for (POST /forget-pwd/reset)
type ForgetPwdSendEmailRequest ¶
type ForgetPwdSendEmailRequest struct {
// StateToken form begin
StateToken string `binding:"required" json:"stateToken"`
}
ForgetPwdSendEmailRequest is the request object for (POST /forget-pwd/send-email)
type ForgetPwdVerify ¶
type ForgetPwdVerify struct {
Kind ForgetPwdVerifyKind `binding:"omitempty,oneof=email mfa" json:"kind,omitempty"`
Value string `json:"value,omitempty"`
}
type ForgetPwdVerifyEmailRequest ¶
type ForgetPwdVerifyEmailRequest struct {
// Captcha the email verify code
Captcha string `binding:"required" json:"captcha"`
// CaptchaId the email verify code
CaptchaId string `binding:"required" json:"captchaId"`
// StateToken form begin
StateToken string `binding:"required" json:"stateToken"`
}
ForgetPwdVerifyEmailRequest is the request object for (POST /forget-pwd/verify-email)
type ForgetPwdVerifyKind ¶
type ForgetPwdVerifyKind string
ForgetPwdVerifyKind defines the type for the ForgetPwdVerify.kind enum field.
const ( ForgetPwdVerifyKindEmail ForgetPwdVerifyKind = "email" ForgetPwdVerifyKindMfa ForgetPwdVerifyKind = "mfa" )
ForgetPwdVerifyKind values.
func (ForgetPwdVerifyKind) String ¶
func (k ForgetPwdVerifyKind) String() string
type ForgetPwdVerifyMfaRequest ¶
type ForgetPwdVerifyMfaRequest struct {
// OtpToken the email verify code
OtpToken string `binding:"required" json:"otpToken"`
// StateToken form begin
StateToken string `binding:"required" json:"stateToken"`
}
ForgetPwdVerifyMfaRequest is the request object for (POST /forget-pwd/verify-mfa)
type GetDomainRequest ¶
type GetDomainRequest struct {
OrgID int `binding:"required" form:"orgID"`
}
GetDomainRequest is the request object for (GET /org/domain)
type GetPreSignUrlRequest ¶
type GetPreSignUrlRequest struct {
// Bucket do not use the default identity,must be used with endpoint
Bucket string `json:"bucket,omitempty"`
// Endpoint do not use the default identity,must be used with bucket
Endpoint string `json:"endpoint,omitempty"`
// URL the url of file
URL string `binding:"required" json:"url"`
}
GetPreSignUrlRequest is the request object for (POST /oss/presignurl)
type GetPreSignUrlResponse ¶
type GetPreSignUrlResponse struct {
URL string `json:"url,omitempty"`
}
GetPreSignUrlResponse successful operation
type GetSTSRequest ¶
type GetSTSRequest struct {
Bucket string `json:"bucket,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
}
GetSTSRequest is the request object for (POST /oss/sts)
type GetSTSResponse ¶
type GetSTSResponse struct {
AccessKeyID string `json:"access_key_id,omitempty"`
Expiration time.Time `json:"expiration,omitempty" time_format:"2006-01-02T15:04:05Z07:00"`
SecretAccessKey string `json:"secret_access_key,omitempty"`
SessionToken string `json:"session_token,omitempty"`
}
GetSTSResponse successful operation
type GetSpmAuthRequest ¶
type GetSpmAuthRequest struct {
// Spm the spm key to get auth data
Spm string `binding:"required" json:"spm"`
}
GetSpmAuthRequest is the request object for (POST /spm/auth)
type GrantType ¶
type GrantType string
GrantType defines the type for the grant_type.grant_type enum field.
const (
GrantTypeClientCredentials GrantType = "client_credentials"
)
GrantType values.
type LoginRequest ¶
type LoginRequest struct {
// Captcha captcha code,if login fail 3 times, the login profile will demand captcha.
Captcha string `json:"captcha,omitempty"`
// CaptchaId captcha id,if login fail 3 times, the login profile will demand captcha.
CaptchaId string `json:"captchaId,omitempty"`
// DeviceId device id,app verify the login device.
DeviceId string `json:"deviceId,omitempty"`
// Password hashed password
Password string `binding:"required" json:"password"`
// Username username or email
Username string `binding:"required" json:"username"`
}
LoginRequest is the request object for (POST /login/auth)
type LoginResponse ¶
type LoginResponse struct {
AccessToken string `json:"accessToken,omitempty"`
CallbackUrl string `json:"callbackUrl,omitempty"`
ExpiresIn int `json:"expiresIn,omitempty"`
RefreshToken string `json:"refreshToken,omitempty"`
// StateToken when need MFA or Change PWD. use the state token to request callback_url
StateToken string `json:"stateToken,omitempty"`
User *User `json:"user,omitempty"`
}
LoginResponse when complete login accessToken,expiresAt,refreshToken will be filled
type Mfa ¶
type Mfa struct {
PrincipalName string `json:"principalName,omitempty"`
QrCodeUri string `json:"qrCodeUri,omitempty"`
Secret string `json:"secret,omitempty"`
// StateToken when need MFA or Change PWD. use the state token to request callback_url
StateToken string `json:"stateToken,omitempty"`
StateTokenTTL float64 `json:"stateTokenTTL,omitempty"`
}
Mfa mfa info
type OldFingerprintLoginRequest ¶
type OldFingerprintLoginRequest struct {
AppCode string `binding:"required" json:"appCode"`
Password string `binding:"required" json:"password"`
Username string `binding:"required" json:"username"`
}
OldFingerprintLoginRequest is the request object for (POST /login/old-fingerprint)
type OldLoginForAppRequest ¶
type OldLoginForAppRequest struct {
// AppCode app code,verify login permissions
AppCode string `binding:"required" json:"appCode"`
// OtpToken mfa random code
OtpToken string `binding:"required" json:"otpToken"`
// Password hashed password
Password string `binding:"required" json:"password"`
// Username username or email
Username string `binding:"required" json:"username"`
}
OldLoginForAppRequest is the request object for (POST /login/old-auth)
type Options ¶
type Options struct {
// the path key of cache config, default `redis`
CacheDriverName string `json:"cacheDriverName"`
CaptchaCollectNum int `json:"captchaCollectNum"` // captcha memory store collect num
CaptchaExpire time.Duration `json:"captchaExpire"` // captcha expire time
CaptchaLength int `json:"captchaLength"` // captcha length
CaptchaTimes int `json:"captchaTimes"` // if login fail times, captcha will force show
CaptchaTTL time.Duration `json:"captchaTTL"` // captcha ttl
LoginFailTimes int `json:"loginFailTimes"` // if login fail times, captcha will force show
LoginFailLockTime time.Duration `json:"loginFailLockTime"` // lock time while login upper to max fail times
StateTokenTTL time.Duration `json:"stateTokenTTL"` // state token ttl
StateTokenSecret string `json:"stateTokenSecret"` // state token secret
SpmTTL time.Duration `json:"spmTTL"` // spm ttl
VerifyDeviceParams struct {
DefaultBound bool `json:"defaultBound"` // The device is bound by default when logging in for the first time
ExcludeAccounts []string `json:"excludeAccounts"` // exclude accounts
} `json:"verifyDeviceParams"`
JWT struct {
SigningMethod string `json:"signingMethod"`
SigningKey string `json:"signingKey"`
PrivateKey string `json:"privateKey"`
TokenTTL time.Duration `json:"tokenTTL"`
RefreshTokenTTL time.Duration `json:"refreshTokenTTL"`
} `json:"jwt"`
PwdPolicy OptionsPwdPolicy `json:"pwdPolicy"`
}
Options is the configuration of AuthServer in the `auth` section.
type OptionsPwdPolicy ¶
type OptionsPwdPolicy struct {
// 密码最短长度,长度应在6-32位之间
Length int32 `json:"length"`
// 必须包含的元素,异或:1-小写字母,2-大写字母,4-数字,8-符号
IncludeElement int32 `json:"includeElement"`
// 最少包含的不同字符数,最多8个,0代表不限制
IncludeChar int32 `json:"includeChar"`
// 是否允许包含用户名
AllowIncludeUserName bool `json:"allowIncludeUserName"`
// 有效天数,最大1095天,0代表不过期
InvalidDay int32 `json:"invalidDay"`
// 过期后是否限制登录
InvalidLoginLimit bool `json:"invalidLoginLimit"`
// 一小时内密码错误最多尝试次数,最大32次,0代表不限次数
Retry int32 `json:"retry"`
// 密码错误多少次出现验证码,最大5次,0代表不出现验证码
CaptchaTimes int32 `json:"captchaTimes"`
}
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
// RefreshToken the refreshToken
RefreshToken string `binding:"required" json:"refreshToken"`
}
RefreshTokenRequest is the request object for (POST /login/refresh-token)
type ResetPasswordRequest ¶
type ResetPasswordRequest struct {
NewPassword string `binding:"required" json:"newPassword"`
StateToken string `binding:"required" json:"stateToken"`
}
ResetPasswordRequest is the request object for (POST /login/reset-password)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
type ServerImpl ¶
type ServerImpl struct {
Options
LogoutHandler func(*gin.Context)
// contains filtered or unexported fields
}
ServerImpl is the server API for service.
func NewServerImpl ¶
func NewServerImpl(cnf *conf.AppConfiguration) *ServerImpl
func (*ServerImpl) AppOrgs ¶
func (s *ServerImpl) AppOrgs(ctx *gin.Context, req *AppOrgsRequest) ([]*Domain, error)
func (*ServerImpl) Apply ¶
func (s *ServerImpl) Apply(cnf *conf.AppConfiguration) error
func (*ServerImpl) BindFingerprint ¶
func (s *ServerImpl) BindFingerprint(ctx *gin.Context, req *BindFingerprintRequest) (bool, error)
func (*ServerImpl) BindMfa ¶
func (s *ServerImpl) BindMfa(ctx *gin.Context, req *BindMfaRequest) (bool, error)
func (*ServerImpl) BindMfaPrepare ¶
func (s *ServerImpl) BindMfaPrepare(ctx *gin.Context) (*Mfa, error)
func (*ServerImpl) Captcha ¶
func (s *ServerImpl) Captcha(ctx *gin.Context, req *CaptchaRequest) (*Captcha, error)
func (*ServerImpl) CheckDevice ¶
func (s *ServerImpl) CheckDevice(ctx *gin.Context, req *CheckDeviceRequest) (*CheckDeviceResponse, error)
func (*ServerImpl) CreateSpm ¶
func (s *ServerImpl) CreateSpm(ctx *gin.Context) (string, error)
CreateSpm 创建spm key
func (*ServerImpl) FingerprintLogin ¶
func (s *ServerImpl) FingerprintLogin(ctx *gin.Context, req *FingerprintLoginRequest) (*LoginResponse, error)
func (*ServerImpl) ForgetPwdBegin ¶
func (s *ServerImpl) ForgetPwdBegin(ctx *gin.Context, req *ForgetPwdBeginRequest) (*ForgetPwdBeginResponse, error)
ForgetPwdBegin 忘记密码验证用户账户,开始修改密码流程
func (*ServerImpl) ForgetPwdReset ¶
func (s *ServerImpl) ForgetPwdReset(ctx *gin.Context, req *ForgetPwdResetRequest) (bool, error)
ForgetPwdReset 忘记密码设置新密码
func (*ServerImpl) ForgetPwdSendEmail ¶
func (s *ServerImpl) ForgetPwdSendEmail(ctx *gin.Context, req *ForgetPwdSendEmailRequest) (string, error)
ForgetPwdSendEmail 忘记密码 发送邮件验证码
func (*ServerImpl) ForgetPwdVerifyEmail ¶
func (s *ServerImpl) ForgetPwdVerifyEmail(ctx *gin.Context, req *ForgetPwdVerifyEmailRequest) (*ForgetPwdBeginResponse, error)
ForgetPwdVerifyEmail 忘记密码 邮件验证身份
func (*ServerImpl) ForgetPwdVerifyMfa ¶
func (s *ServerImpl) ForgetPwdVerifyMfa(ctx *gin.Context, req *ForgetPwdVerifyMfaRequest) (*ForgetPwdBeginResponse, error)
ForgetPwdVerifyMfa 忘记密码 mfa验证身份
func (*ServerImpl) GetDomain ¶
func (s *ServerImpl) GetDomain(ctx *gin.Context, req *GetDomainRequest) (*Domain, error)
func (*ServerImpl) GetPreSignUrl ¶
func (s *ServerImpl) GetPreSignUrl(ctx *gin.Context, req *GetPreSignUrlRequest) (*GetPreSignUrlResponse, error)
func (*ServerImpl) GetSTS ¶
func (s *ServerImpl) GetSTS(c *gin.Context, req *GetSTSRequest) (*GetSTSResponse, error)
func (*ServerImpl) GetSpmAuth ¶
func (s *ServerImpl) GetSpmAuth(c *gin.Context, r *GetSpmAuthRequest) (*LoginResponse, error)
GetSpmAuth 根据spm 获取登录信息
func (*ServerImpl) GetUserRootOrg ¶
func (*ServerImpl) Login ¶
func (s *ServerImpl) Login(ctx *gin.Context, req *LoginRequest) (res *LoginResponse, err error)
Login login
func (*ServerImpl) OldFingerprintLogin ¶
func (s *ServerImpl) OldFingerprintLogin(ctx *gin.Context, req *OldFingerprintLoginRequest) (*LoginResponse, error)
func (*ServerImpl) OldLoginForApp ¶
func (s *ServerImpl) OldLoginForApp(ctx *gin.Context, req *OldLoginForAppRequest) (res *LoginResponse, err error)
func (*ServerImpl) ParentDomain ¶
func (*ServerImpl) PasswordPolicy ¶
func (s *ServerImpl) PasswordPolicy(ctx *gin.Context) (*UserPasswordPolicy, error)
func (*ServerImpl) RefreshToken ¶
func (s *ServerImpl) RefreshToken(ctx *gin.Context, req *RefreshTokenRequest) (*LoginResponse, error)
func (*ServerImpl) ResetPassword ¶
func (s *ServerImpl) ResetPassword(ctx *gin.Context, req *ResetPasswordRequest) (res *LoginResponse, err error)
func (*ServerImpl) Token ¶
func (s *ServerImpl) Token(c *gin.Context, r *TokenRequest) (*TokenResponse, error)
Token oauth获取accessToken
func (*ServerImpl) UnBindMfa ¶
func (s *ServerImpl) UnBindMfa(ctx *gin.Context, req *UnBindMfaRequest) (bool, error)
func (*ServerImpl) VerifyDevice ¶
func (s *ServerImpl) VerifyDevice(ctx *gin.Context, req *VerifyDeviceRequest) (*LoginResponse, error)
VerifyDevice 验证登录设备并绑定
func (*ServerImpl) VerifyDeviceSendEmail ¶
func (s *ServerImpl) VerifyDeviceSendEmail(ctx *gin.Context, req *VerifyDeviceSendEmailRequest) (string, error)
VerifyDeviceSendEmail 验证登录设备 发送邮件验证码
func (*ServerImpl) VerifyFactor ¶
func (s *ServerImpl) VerifyFactor(ctx *gin.Context, req *VerifyFactorRequest) (*LoginResponse, error)
type TokenRequest ¶
type TokenRequest struct {
ClientID string `binding:"required" form:"client_id"`
ClientSecret string `binding:"required" form:"client_secret"`
GrantType GrantType `binding:"required,oneof=client_credentials" form:"grant_type"`
}
TokenRequest is the request object for (POST /token)
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token,omitempty"`
ExpiresIn int `json:"expires_in,omitempty"`
}
TokenResponse successful operation
type UnBindMfaRequest ¶
type UnBindMfaRequest struct {
OtpToken string `binding:"required" json:"otpToken"`
}
UnBindMfaRequest is the request object for (POST /mfa/unbind)
type UnimplementedAuthServer ¶
type UnimplementedAuthServer struct {
}
func (UnimplementedAuthServer) AppOrgs ¶
func (UnimplementedAuthServer) AppOrgs(c *gin.Context, req *AppOrgsRequest) (_ []*Domain, err error)
func (UnimplementedAuthServer) BindFingerprint ¶
func (UnimplementedAuthServer) BindFingerprint(c *gin.Context, req *BindFingerprintRequest) (_ bool, err error)
func (UnimplementedAuthServer) BindMfa ¶
func (UnimplementedAuthServer) BindMfa(c *gin.Context, req *BindMfaRequest) (_ bool, err error)
func (UnimplementedAuthServer) BindMfaPrepare ¶
func (UnimplementedAuthServer) BindMfaPrepare(c *gin.Context) (_ *Mfa, err error)
func (UnimplementedAuthServer) Captcha ¶
func (UnimplementedAuthServer) Captcha(c *gin.Context, req *CaptchaRequest) (_ *Captcha, err error)
func (UnimplementedAuthServer) CheckDevice ¶
func (UnimplementedAuthServer) CheckDevice(c *gin.Context, req *CheckDeviceRequest) (_ *CheckDeviceResponse, err error)
func (UnimplementedAuthServer) CreateSpm ¶
func (UnimplementedAuthServer) CreateSpm(c *gin.Context) (_ string, err error)
func (UnimplementedAuthServer) FingerprintLogin ¶
func (UnimplementedAuthServer) FingerprintLogin(c *gin.Context, req *FingerprintLoginRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) ForgetPwdBegin ¶
func (UnimplementedAuthServer) ForgetPwdBegin(c *gin.Context, req *ForgetPwdBeginRequest) (_ *ForgetPwdBeginResponse, err error)
func (UnimplementedAuthServer) ForgetPwdReset ¶
func (UnimplementedAuthServer) ForgetPwdReset(c *gin.Context, req *ForgetPwdResetRequest) (_ bool, err error)
func (UnimplementedAuthServer) ForgetPwdSendEmail ¶
func (UnimplementedAuthServer) ForgetPwdSendEmail(c *gin.Context, req *ForgetPwdSendEmailRequest) (_ string, err error)
func (UnimplementedAuthServer) ForgetPwdVerifyEmail ¶
func (UnimplementedAuthServer) ForgetPwdVerifyEmail(c *gin.Context, req *ForgetPwdVerifyEmailRequest) (_ *ForgetPwdBeginResponse, err error)
func (UnimplementedAuthServer) ForgetPwdVerifyMfa ¶
func (UnimplementedAuthServer) ForgetPwdVerifyMfa(c *gin.Context, req *ForgetPwdVerifyMfaRequest) (_ *ForgetPwdBeginResponse, err error)
func (UnimplementedAuthServer) GetDomain ¶
func (UnimplementedAuthServer) GetDomain(c *gin.Context, req *GetDomainRequest) (_ *Domain, err error)
func (UnimplementedAuthServer) GetPreSignUrl ¶
func (UnimplementedAuthServer) GetPreSignUrl(c *gin.Context, req *GetPreSignUrlRequest) (_ *GetPreSignUrlResponse, err error)
func (UnimplementedAuthServer) GetSTS ¶
func (UnimplementedAuthServer) GetSTS(c *gin.Context, req *GetSTSRequest) (_ *GetSTSResponse, err error)
func (UnimplementedAuthServer) GetSpmAuth ¶
func (UnimplementedAuthServer) GetSpmAuth(c *gin.Context, req *GetSpmAuthRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) Login ¶
func (UnimplementedAuthServer) Login(c *gin.Context, req *LoginRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) Logout ¶
func (UnimplementedAuthServer) Logout(c *gin.Context) (err error)
func (UnimplementedAuthServer) OldFingerprintLogin ¶
func (UnimplementedAuthServer) OldFingerprintLogin(c *gin.Context, req *OldFingerprintLoginRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) OldLoginForApp ¶
func (UnimplementedAuthServer) OldLoginForApp(c *gin.Context, req *OldLoginForAppRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) PasswordPolicy ¶
func (UnimplementedAuthServer) PasswordPolicy(c *gin.Context) (_ *UserPasswordPolicy, err error)
func (UnimplementedAuthServer) RefreshToken ¶
func (UnimplementedAuthServer) RefreshToken(c *gin.Context, req *RefreshTokenRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) ResetPassword ¶
func (UnimplementedAuthServer) ResetPassword(c *gin.Context, req *ResetPasswordRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) Token ¶
func (UnimplementedAuthServer) Token(c *gin.Context, req *TokenRequest) (_ *TokenResponse, err error)
func (UnimplementedAuthServer) UnBindMfa ¶
func (UnimplementedAuthServer) UnBindMfa(c *gin.Context, req *UnBindMfaRequest) (_ bool, err error)
func (UnimplementedAuthServer) VerifyDevice ¶
func (UnimplementedAuthServer) VerifyDevice(c *gin.Context, req *VerifyDeviceRequest) (_ *LoginResponse, err error)
func (UnimplementedAuthServer) VerifyDeviceSendEmail ¶
func (UnimplementedAuthServer) VerifyDeviceSendEmail(c *gin.Context, req *VerifyDeviceSendEmailRequest) (_ string, err error)
func (UnimplementedAuthServer) VerifyFactor ¶
func (UnimplementedAuthServer) VerifyFactor(c *gin.Context, req *VerifyFactorRequest) (_ *LoginResponse, err error)
type UserPasswordPolicy ¶
type UserPasswordPolicy struct {
AllowIncludeUserName bool `json:"allowIncludeUserName,omitempty"`
CaptchaTimes int `json:"captchaTimes,omitempty"`
IncludeChar int `json:"includeChar,omitempty"`
IncludeElement int `json:"includeElement,omitempty"`
InvalidDay int `json:"invalidDay,omitempty"`
InvalidLoginLimit bool `json:"invalidLoginLimit,omitempty"`
Length int `json:"length,omitempty"`
Retry int `json:"retry,omitempty"`
}
type VerifyDeviceRequest ¶
type VerifyDeviceRequest struct {
Captcha string `json:"captcha,omitempty"`
CaptchaId string `json:"captchaId,omitempty"`
// DeviceInfo device info
DeviceInfo DeviceInfo `json:"deviceInfo,omitempty"`
Kind Kind `binding:"required,oneof=email mfa" json:"kind"`
OtpToken string `json:"otpToken,omitempty"`
StateToken string `binding:"required" json:"stateToken"`
}
VerifyDeviceRequest is the request object for (POST /login/verify-device)
type VerifyDeviceSendEmailRequest ¶
type VerifyDeviceSendEmailRequest struct {
Email string `binding:"required" json:"email"`
StateToken string `json:"stateToken,omitempty"`
}
VerifyDeviceSendEmailRequest is the request object for (POST /login/device-captcha)
type VerifyFactorRequest ¶
type VerifyFactorRequest struct {
// DeviceId provide the MFA deviceId. the deviceId is register by MFA setting.
DeviceId string `binding:"required" json:"deviceId"`
OtpToken string `binding:"required" json:"otpToken"`
StateToken string `binding:"required" json:"stateToken"`
}
VerifyFactorRequest is the request object for (POST /login/verify-factor)