Documentation ¶
Index ¶
- func GetAccessToken(client *Client) (string, error)
- func QueryAccessToken(client *Client) (*model.AccessTokenRes, error)
- type Client
- func (c *Client) AssociateFaceByUrl(baseFaceUrl, CompareFaceUrl, token string) (..., error)
- func (c *Client) AssociateMfaAuthenticator(req *model.MfaInput) (..., error)
- func (c *Client) BindEmail(email, emailCode string) (*model.User, error)
- func (c *Client) BindPhone(phone, phoneCode string) (*model.User, error)
- func (c *Client) BuildAuthorizeUrlByCas(service *string) string
- func (c *Client) BuildAuthorizeUrlByOauth(scope, redirectUri, state, responseType string) (string, error)
- func (c *Client) BuildAuthorizeUrlByOidc(params model.OidcParams) (string, error)
- func (c *Client) BuildAuthorizeUrlBySaml() string
- func (c *Client) BuildLogoutUrl(expert, redirectUri, idToken *string) string
- func (c *Client) CheckLoginStatus(token string) (*model.CheckLoginStatusResponse, error)
- func (c *Client) CheckPasswordStrength(password string) (..., error)
- func (c *Client) ClearUser()
- func (c *Client) ConfirmAssociateMfaAuthenticator(req *model.ConfirmAssociateMfaAuthenticatorRequest) (..., error)
- func (c *Client) DeleteMfaAuthenticator() (*model.CommonMessageAndCode, error)
- func (c *Client) GenerateCodeChallenge(size int) (string, error)
- func (c *Client) GetAccessTokenByClientCredentials(req model.GetAccessTokenByClientCredentialsRequest) (string, error)
- func (c *Client) GetAccessTokenByCode(code string) (string, error)
- func (c *Client) GetCodeChallengeDigest(codeChallenge string, method constant.GenerateCodeChallengeMethod) (string, error)
- func (c *Client) GetCurrentUser(token *string) (*model.User, error)
- func (c *Client) GetMfaAuthenticators(req *model.MfaInput) (..., error)
- func (c *Client) GetNewAccessTokenByRefreshToken(refreshToken string) (string, error)
- func (c *Client) GetSecurityLevel() (..., error)
- func (c *Client) GetUserInfoByAccessToken(accessToken string) (string, error)
- func (c *Client) HasRole(code, namespace string) (*bool, error)
- func (c *Client) IntrospectToken(token string) (string, error)
- func (c *Client) IsUserExists(req *model.IsUserExistsRequest) (*bool, error)
- func (c *Client) LinkAccount(primaryUserToken, secondaryUserToken string) (*model.CommonMessageAndCode, error)
- func (c *Client) ListApplications(page, limit int) (..., error)
- func (c *Client) ListAuthorizedResources(namespace string, resourceType model.EnumResourceType) (*model.AuthorizedResources, error)
- func (c *Client) ListDepartments() (*model.PaginatedDepartments, error)
- func (c *Client) ListOrg() (..., error)
- func (c *Client) ListRole(namespace string) (..., error)
- func (c *Client) ListUdv() (*[]model.UserDefinedData, error)
- func (c *Client) LoginByAd(username, password string) (..., error)
- func (c *Client) LoginByEmail(request model.LoginByEmailInput) (*model.User, error)
- func (c *Client) LoginByLdap(username, password string) (..., error)
- func (c *Client) LoginByPhoneCode(req *model.LoginByPhoneCodeInput) (*model.User, error)
- func (c *Client) LoginByPhonePassword(request model.LoginByPhonePasswordInput) (*model.User, error)
- func (c *Client) LoginBySubAccount(req *model.LoginBySubAccountRequest) (*model.User, error)
- func (c *Client) LoginByUserName(request model.LoginByUsernameInput) (*model.User, error)
- func (c *Client) Logout() (*model.CommonMessageAndCode, error)
- func (c *Client) LogoutByToken(token string) (*model.CommonMessageAndCode, error)
- func (c *Client) PhoneOrEmailBindable(email, phone *string, token string) (..., error)
- func (c *Client) RefreshToken(token *string) (*model.RefreshToken, error)
- func (c *Client) RegisterByEmail(request *model.RegisterByEmailInput) (*model.User, error)
- func (c *Client) RegisterByPhoneCode(request *model.RegisterByPhoneCodeInput) (*model.User, error)
- func (c *Client) RegisterByUsername(request *model.RegisterByUsernameInput) (*model.User, error)
- func (c *Client) RemoveUdv(key string) (*[]model.UserDefinedData, error)
- func (c *Client) ResetPasswordByEmailCode(email, code, newPassword string) (*model.CommonMessageAndCode, error)
- func (c *Client) ResetPasswordByFirstLoginToken(token, password string) (*model.CommonMessageAndCode, error)
- func (c *Client) ResetPasswordByForceResetToken(token, password, newPassword string) (*model.CommonMessageAndCode, error)
- func (c *Client) ResetPasswordByPhoneCode(phone, code, newPassword string) (*model.CommonMessageAndCode, error)
- func (c *Client) RevokeToken(token string) (string, error)
- func (c *Client) SendEmail(email string, scene model.EnumEmailScene) (*model.CommonMessageAndCode, error)
- func (c *Client) SendHttpRequest(url string, method string, header map[string]string, body map[string]string) ([]byte, error)
- func (c *Client) SendHttpRequestCustomTokenManage(url string, method string, token *string, query string, ...) ([]byte, error)
- func (c *Client) SendHttpRequestManage(url string, method string, query string, variables map[string]interface{}) ([]byte, error)
- func (c *Client) SendHttpRestRequest(url string, method string, token *string, variables map[string]interface{}) ([]byte, error)
- func (c *Client) SendHttpRestRequestNotToken(url string, method string, variables map[string]interface{}) ([]byte, error)
- func (c *Client) SendSmsCode(phone string) (..., error)
- func (c *Client) SetCurrentUser(user *model.User) (*model.User, error)
- func (c *Client) SetPublicKey(publicKey string)
- func (c *Client) SetToken(token string)
- func (c *Client) SetUdv(udvList []model.KeyValuePair) (*[]model.UserDefinedData, error)
- func (c *Client) TrackSession(code string, country, lang, state *string) (..., error)
- func (c *Client) UnBindEmail() (*model.User, error)
- func (c *Client) UnBindPhone() (*model.User, error)
- func (c *Client) UnLinkAccount(primaryUserToken string, provider constant.SocialProviderType) (*model.CommonMessageAndCode, error)
- func (c *Client) UpdateEmail(email, code string, oldEmail, oldEmailCode *string) (*model.User, error)
- func (c *Client) UpdatePassword(oldPassword *string, newPassword string) (*model.User, error)
- func (c *Client) UpdatePhone(phone, code string, oldPhone, oldPhoneCode *string) (*model.User, error)
- func (c *Client) UpdateProfile(req *model.UpdateUserInput) (*model.User, error)
- func (c *Client) ValidateTicketV1(ticket, service string) (..., error)
- func (c *Client) ValidateTicketV2(ticket, service string, format constant.TicketFormat) (..., error)
- func (c *Client) ValidateToken(req model.ValidateTokenRequest) (string, error)
- func (c *Client) VerifyAppEmailMfa(email, code, token string) (..., error)
- func (c *Client) VerifyAppSmsMfa(phone, code, token string) (..., error)
- func (c *Client) VerifyFaceMfa(faceUrl, token string) (..., error)
- func (c *Client) VerifyTotpMfa(totp, token string) (..., error)
- func (c *Client) VerifyTotpRecoveryCode(code, token string) (..., error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { HttpClient *http.Client AppId string Protocol constant.ProtocolEnum Secret string Host string RedirectUri string UserPoolId string TokenEndPointAuthMethod constant.AuthMethodEnum ClientToken *string ClientUser *model.User Log func(s string) }
func (*Client) AssociateFaceByUrl ¶
func (c *Client) AssociateFaceByUrl(baseFaceUrl, CompareFaceUrl, token string) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data interface{} `json:"data"` }, error)
AssociateFaceByUrl 通过图片 URL 绑定人脸
func (*Client) AssociateMfaAuthenticator ¶
func (c *Client) AssociateMfaAuthenticator(req *model.MfaInput) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data model.AssociateMfaAuthenticatorResponse `json:"data"` }, error)
AssociateMfaAuthenticator 请求 MFA 二维码和密钥信息
func (*Client) BuildAuthorizeUrlByCas ¶
func (*Client) BuildAuthorizeUrlByOauth ¶
func (*Client) BuildAuthorizeUrlByOidc ¶
func (c *Client) BuildAuthorizeUrlByOidc(params model.OidcParams) (string, error)
TODO
func (*Client) BuildAuthorizeUrlBySaml ¶
func (*Client) BuildLogoutUrl ¶
BuildLogoutUrl 拼接登出 URL
func (*Client) CheckLoginStatus ¶
func (c *Client) CheckLoginStatus(token string) (*model.CheckLoginStatusResponse, error)
CheckLoginStatus 检测 Token 登录状态
func (*Client) CheckPasswordStrength ¶
func (c *Client) CheckPasswordStrength(password string) (*struct { Valid bool `json:"valid"` Message string `json:"message"` }, error)
CheckPasswordStrength 检查密码强度
func (*Client) ConfirmAssociateMfaAuthenticator ¶
func (c *Client) ConfirmAssociateMfaAuthenticator(req *model.ConfirmAssociateMfaAuthenticatorRequest) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data interface{} `json:"data"` }, error)
ConfirmAssociateMfaAuthenticator 确认绑定 MFA
func (*Client) DeleteMfaAuthenticator ¶
func (c *Client) DeleteMfaAuthenticator() (*model.CommonMessageAndCode, error)
DeleteMfaAuthenticator 解绑 MFA
func (*Client) GenerateCodeChallenge ¶
GenerateCodeChallenge 生成一个 PKCE 校验码,长度必须大于等于 43。
func (*Client) GetAccessTokenByClientCredentials ¶
func (c *Client) GetAccessTokenByClientCredentials(req model.GetAccessTokenByClientCredentialsRequest) (string, error)
GetAccessTokenByClientCredentials Client Credentials 模式获取 Access Token
func (*Client) GetCodeChallengeDigest ¶
func (c *Client) GetCodeChallengeDigest(codeChallenge string, method constant.GenerateCodeChallengeMethod) (string, error)
GetCodeChallengeDigest 生成一个 PKCE 校验码摘要值
func (*Client) GetCurrentUser ¶
GetCurrentUser 获取资源列表
func (*Client) GetMfaAuthenticators ¶
func (c *Client) GetMfaAuthenticators(req *model.MfaInput) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data []model.GetMfaAuthenticatorsResponse `json:"data"` }, error)
GetMfaAuthenticators 获取 MFA 认证器
func (*Client) GetNewAccessTokenByRefreshToken ¶
GetNewAccessTokenByRefreshToken
使用 Refresh token 获取新的 Access token
func (*Client) GetSecurityLevel ¶
func (c *Client) GetSecurityLevel() (*struct { Code int64 `json:"code"` Message string `json:"message"` Data model.GetSecurityLevelResponse `json:"data"` }, error)
GetSecurityLevel 用户安全等级
func (*Client) GetUserInfoByAccessToken ¶
GetUserInfoByAccessToken accessToken 换取用户信息
func (*Client) IntrospectToken ¶
IntrospectToken 检查 Access token 或 Refresh token 的状态
func (*Client) IsUserExists ¶
func (c *Client) IsUserExists(req *model.IsUserExistsRequest) (*bool, error)
IsUserExists 判断用户是否存在
func (*Client) LinkAccount ¶
func (c *Client) LinkAccount(primaryUserToken, secondaryUserToken string) (*model.CommonMessageAndCode, error)
LinkAccount 关联账号
func (*Client) ListApplications ¶
func (c *Client) ListApplications(page, limit int) (*struct { Code int64 `json:"code"` Message string `json:"message"` Data struct { TotalCount int64 `json:"totalCount"` List []model.Application `json:"list"` } `json:"data"` }, error)
ListApplications 获取当前用户能够访问的应用
func (*Client) ListAuthorizedResources ¶
func (c *Client) ListAuthorizedResources(namespace string, resourceType model.EnumResourceType) (*model.AuthorizedResources, error)
ListAuthorizedResources 获取用户被授权的所有资源
func (*Client) ListDepartments ¶
func (c *Client) ListDepartments() (*model.PaginatedDepartments, error)
ListDepartments 获取用户所有部门
func (*Client) ListOrg ¶
func (c *Client) ListOrg() (*struct { Code int64 `json:"code"` Message string `json:"message"` Data []model.UserOrgs `json:"data"` }, error)
ListOrg 获取用户所在组织机构
func (*Client) ListRole ¶
func (c *Client) ListRole(namespace string) (*struct { TotalCount int `json:"totalCount"` List []model.RoleModel `json:"list"` }, error)
ListRole 获取用户拥有的角色列表
func (*Client) ListUdv ¶
func (c *Client) ListUdv() (*[]model.UserDefinedData, error)
ListUdv 获取当前用户的自定义数据列表
func (*Client) LoginByAd ¶
func (c *Client) LoginByAd(username, password string) (*struct { Code int64 `json:"code"` Message string `json:"message"` Data model.User `json:"data"` }, error)
LoginByAd 使用 AD 用户名登录
func (*Client) LoginByEmail ¶
LoginByEmail 使用邮箱登录
func (*Client) LoginByLdap ¶
func (c *Client) LoginByLdap(username, password string) (*struct { Code int64 `json:"code"` Message string `json:"message"` Data model.User `json:"data"` }, error)
LoginByLdap 使用 LDAP 用户名登录
func (*Client) LoginByPhoneCode ¶
LoginByPhoneCode 使用手机号验证码登录
func (*Client) LoginByPhonePassword ¶
LoginByPhonePassword 使用手机号密码登录
func (*Client) LoginBySubAccount ¶
LoginBySubAccount 登录子账号
func (*Client) LoginByUserName ¶
LoginByUserName 使用用户名登录
func (*Client) LogoutByToken ¶
func (c *Client) LogoutByToken(token string) (*model.CommonMessageAndCode, error)
func (*Client) PhoneOrEmailBindable ¶
func (c *Client) PhoneOrEmailBindable(email, phone *string, token string) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data interface{} `json:"data"` }, error)
PhoneOrEmailBindable 检测手机号或邮箱是否已被绑定
func (*Client) RefreshToken ¶
func (c *Client) RefreshToken(token *string) (*model.RefreshToken, error)
RefreshToken 刷新当前用户的 token
func (*Client) RegisterByEmail ¶
RegisterByEmail 使用邮箱注册
func (*Client) RegisterByPhoneCode ¶
RegisterByPhoneCode 使用手机号及验证码注册
func (*Client) RegisterByUsername ¶
RegisterByUsername 使用用户名注册
func (*Client) RemoveUdv ¶
func (c *Client) RemoveUdv(key string) (*[]model.UserDefinedData, error)
RemoveUdv 删除自定义数据
func (*Client) ResetPasswordByEmailCode ¶
func (c *Client) ResetPasswordByEmailCode(email, code, newPassword string) (*model.CommonMessageAndCode, error)
ResetPasswordByEmailCode 通过邮件验证码重置密码
func (*Client) ResetPasswordByFirstLoginToken ¶
func (c *Client) ResetPasswordByFirstLoginToken(token, password string) (*model.CommonMessageAndCode, error)
ResetPasswordByFirstLoginToken 通过首次登录的 Token 重置密码
func (*Client) ResetPasswordByForceResetToken ¶
func (c *Client) ResetPasswordByForceResetToken(token, password, newPassword string) (*model.CommonMessageAndCode, error)
ResetPasswordByForceResetToken 通过密码强制更新临时 Token 修改密码
func (*Client) ResetPasswordByPhoneCode ¶
func (c *Client) ResetPasswordByPhoneCode(phone, code, newPassword string) (*model.CommonMessageAndCode, error)
ResetPasswordByPhoneCode 通过短信验证码重置密码
func (*Client) RevokeToken ¶
RevokeToken 撤回 Access token 或 Refresh token
func (*Client) SendEmail ¶
func (c *Client) SendEmail(email string, scene model.EnumEmailScene) (*model.CommonMessageAndCode, error)
SendEmail 发送邮件
func (*Client) SendHttpRequest ¶
func (*Client) SendHttpRequestCustomTokenManage ¶
func (*Client) SendHttpRequestManage ¶
func (*Client) SendHttpRestRequest ¶
func (*Client) SendHttpRestRequestNotToken ¶
func (*Client) SendSmsCode ¶
func (c *Client) SendSmsCode(phone string) (*struct { Message string `json:"message"` Code int64 `json:"code"` }, error)
SendSmsCode 发送短信验证码
func (*Client) SetCurrentUser ¶
SetCurrentUser 设置当前用户
func (*Client) SetPublicKey ¶ added in v0.3.1
func (*Client) SetUdv ¶
func (c *Client) SetUdv(udvList []model.KeyValuePair) (*[]model.UserDefinedData, error)
SetUdv 添加自定义数据
func (*Client) TrackSession ¶
func (c *Client) TrackSession(code string, country, lang, state *string) (*struct { Code int64 `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }, error)
TrackSession sso 检测登录态
func (*Client) UnLinkAccount ¶
func (c *Client) UnLinkAccount(primaryUserToken string, provider constant.SocialProviderType) (*model.CommonMessageAndCode, error)
UnLinkAccount 主账号解绑社会化登录账号
func (*Client) UpdateEmail ¶
func (c *Client) UpdateEmail(email, code string, oldEmail, oldEmailCode *string) (*model.User, error)
UpdateEmail 更新用户邮箱
func (*Client) UpdatePassword ¶
UpdatePassword 更新用户密码
func (*Client) UpdatePhone ¶
func (c *Client) UpdatePhone(phone, code string, oldPhone, oldPhoneCode *string) (*model.User, error)
UpdatePhone 更新用户手机号
func (*Client) UpdateProfile ¶
UpdateProfile 修改用户资料
func (*Client) ValidateTicketV1 ¶
func (c *Client) ValidateTicketV1(ticket, service string) (*struct { Valid bool `json:"code"` Message string `json:"message"` Username string `json:"username"` }, error)
ValidateTicketV1 检验 CAS 1.0 Ticket 合法性
func (*Client) ValidateTicketV2 ¶
func (c *Client) ValidateTicketV2(ticket, service string, format constant.TicketFormat) (*struct { Code int64 `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }, error)
ValidateTicketV2 通过远端服务验证票据合法性
func (*Client) ValidateToken ¶
func (c *Client) ValidateToken(req model.ValidateTokenRequest) (string, error)
ValidateToken 效验Token合法性
func (*Client) VerifyAppEmailMfa ¶
func (c *Client) VerifyAppEmailMfa(email, code, token string) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data interface{} `json:"data"` }, error)
VerifyAppEmailMfa 检验二次验证 MFA 邮箱验证码
func (*Client) VerifyAppSmsMfa ¶
func (c *Client) VerifyAppSmsMfa(phone, code, token string) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data interface{} `json:"data"` }, error)
VerifyAppSmsMfa 检验二次验证 MFA 短信验证码
func (*Client) VerifyFaceMfa ¶
func (c *Client) VerifyFaceMfa(faceUrl, token string) (*struct { Message string `json:"message"` Code int64 `json:"code"` Data interface{} `json:"data"` }, error)
VerifyFaceMfa 人脸二次认证