Documentation
¶
Index ¶
- Constants
- func GenFormArgs(variables map[string]string) *fasthttp.Args
- func GenQueryString(variables map[string]string) string
- type AccessTokenClaims
- type AccessTokenExtended
- type AuthUrlResult
- type AuthenticationClient
- func (client *AuthenticationClient) BindEmail(reqDto *dto.BindEmailDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) BindPhone(reqDto *dto.BindPhoneDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) BuildAuthorizeUrlByCas(service *string) string
- func (client *AuthenticationClient) BuildAuthorizeUrlByOauth(params *OAuth2AuthURLParams) (string, error)
- func (client *AuthenticationClient) BuildAuthorizeUrlByOidc(params *OIDCAuthURLParams) (AuthUrlResult, error)
- func (client *AuthenticationClient) BuildAuthorizeUrlBySaml() string
- func (client *AuthenticationClient) BuildLogoutUrl(params *BuildLogoutURLParams) (string, error)
- func (client *AuthenticationClient) ChangeQrCodeStatus(reqDto *dto.ChangeQRCodeStatusDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) CheckPermissionByArrayResource(reqDto *dto.CheckPermissionArrayResourceDto) *dto.CheckResourcePermissionsRespDto
- func (client *AuthenticationClient) CheckPermissionByStringResource(reqDto *dto.CheckPermissionStringResourceDto) *dto.CheckResourcePermissionsRespDto
- func (client *AuthenticationClient) CheckPermissionByTreeResource(reqDto *dto.CheckPermissionTreeResourceDto) *dto.CheckResourcePermissionsRespDto
- func (client *AuthenticationClient) CheckQrCodeStatus(reqDto *dto.CheckQrcodeStatusDto) *dto.CheckQRCodeStatusRespDto
- func (client *AuthenticationClient) DecryptWechatMiniProgramData(reqDto *dto.DecryptWechatMiniProgramDataDto) *dto.DecryptWechatMiniProgramDataRespDto
- func (client *AuthenticationClient) DeleteAccount(reqDto *dto.DeleteAccounDto) *dto.IsSuccessRespDto
- func (client *AuthenticationClient) EnrollFactor(reqDto *dto.EnrollFactorDto) *dto.EnrollFactorRespDto
- func (client *AuthenticationClient) ExchangeTokenSetWithQrCodeTicket(reqDto *dto.ExchangeTokenSetWithQRcodeTicketDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) GeneQrCode(reqDto *dto.GenerateQrcodeDto) *dto.GeneQRCodeRespDto
- func (client *AuthenticationClient) GenerateLinkExtIdpUrl(reqDto *dto.GenerateLinkExtidpUrlDto) *dto.GenerateBindExtIdpLinkRespDto
- func (client *AuthenticationClient) GetAccessTokenByClientCredentials(req GetAccessTokenByClientCredentialsRequest) (string, error)
- func (client *AuthenticationClient) GetAccessTokenByCode(code string) (OIDCTokenResponse, error)
- func (client *AuthenticationClient) GetAccessibleApps() *dto.GetAccessibleAppsRespDto
- func (client *AuthenticationClient) GetAlipayAuthInfo(reqDto *dto.GetAlipayAuthinfoDto) *dto.GetAlipayAuthInfoRespDto
- func (client *AuthenticationClient) GetApplicationEnabledExtIdps() *dto.GetExtIdpsRespDto
- func (client *AuthenticationClient) GetAuthorizedResources(reqDto *dto.GetMyAuthorizedResourcesDto) *dto.AuthorizedResourcePaginatedRespDto
- func (client *AuthenticationClient) GetCountryList() *dto.GetCountryListRespDto
- func (client *AuthenticationClient) GetDepartmentList(reqDto *dto.GetMyDepartmentListDto) *dto.UserDepartmentPaginatedRespDto
- func (client *AuthenticationClient) GetFactor(reqDto *dto.GetFactorDto) *dto.GetFactorRespDto
- func (client *AuthenticationClient) GetGroupList() *dto.GroupListRespDto
- func (client *AuthenticationClient) GetIdentities() *dto.GetIdentitiesRespDto
- func (client *AuthenticationClient) GetLoggedInApps() *dto.GetLoggedInAppsRespDto
- func (client *AuthenticationClient) GetLoginHistory(reqDto *dto.GetMyLoginHistoryDto) *dto.GetLoginHistoryRespDto
- func (client *AuthenticationClient) GetNewAccessTokenByRefreshToken(refreshToken string) (string, error)
- func (client *AuthenticationClient) GetProfile(reqDto *dto.GetProfileDto) *dto.UserSingleRespDto
- func (client *AuthenticationClient) GetRoleList(reqDto *dto.GetMyRoleListDto) *dto.RoleListRespDto
- func (client *AuthenticationClient) GetSecurityLevel() *dto.GetSecurityInfoRespDto
- func (client *AuthenticationClient) GetSystemInfo() *dto.SystemInfoResp
- func (client *AuthenticationClient) GetTenantList() *dto.GetTenantListRespDto
- func (client *AuthenticationClient) GetUserAuthorizedResourcesList() *dto.GetUserAuthResourceListRespDto
- func (client *AuthenticationClient) GetUserInfo(accessToken string) (*UserInfo, error)
- func (client *AuthenticationClient) GetWechatMpAccessToken(reqDto *dto.GetWechatAccessTokenDto) *dto.GetWechatAccessTokenRespDto
- func (client *AuthenticationClient) IntrospectAccessTokenOffline(tokenStr string) (*AccessTokenClaims, error)
- func (client *AuthenticationClient) ListEnrolledFactors() *dto.ListEnrolledFactorsRespDto
- func (client *AuthenticationClient) ListFactorsToEnroll() *dto.ListFactorsToEnrollRespDto
- func (client *AuthenticationClient) ParseIDToken(tokenStr string) (*IDTokenClaims, error)
- func (client *AuthenticationClient) PreCheckCode(reqDto *dto.PreCheckCodeDto) *dto.PreCheckCodeRespDto
- func (client *AuthenticationClient) ResetFactor(reqDto *dto.ResetFactorDto) *dto.ResetFactorRespDto
- func (client *AuthenticationClient) ResetPassword(reqDto *dto.ResetPasswordDto) *dto.IsSuccessRespDto
- func (client *AuthenticationClient) RevokeToken(token string) (bool, error)
- func (client *AuthenticationClient) SendEmail(reqDto *dto.SendEmailDto) *dto.SendEmailRespDto
- func (client *AuthenticationClient) SendEnrollFactorRequest(reqDto *dto.SendEnrollFactorRequestDto) *dto.SendEnrollFactorRequestRespDto
- func (client *AuthenticationClient) SendHttpRequest(url string, method string, reqDto interface{}) ([]byte, error)
- func (client AuthenticationClient) SendProtocolHttpRequest(option *ProtocolRequestOption) (*ResponseData, error)
- func (client *AuthenticationClient) SendSms(reqDto *dto.SendSMSDto) *dto.SendSMSRespDto
- func (client *AuthenticationClient) SetAccessToken(accessToken string)
- func (client *AuthenticationClient) SignInByAD(sAMAccountName string, passCode string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByAccountPassword(account string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByCredentials(reqDto *dto.SigninByCredentialsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByEmailPassCode(email string, passCode string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByEmailPassword(email string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByLDAP(sAMAccountName string, passCode string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByMobile(reqDto *dto.SigninByMobileDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByPhonePassCode(phone string, passCode string, phoneCountryCode string, ...) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByPhonePassword(phone string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignInByUsernamePassword(username string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
- func (client *AuthenticationClient) SignUp(reqDto *dto.SignUpDto) *dto.UserSingleRespDto
- func (client *AuthenticationClient) SignUpByEmailPassCode(email string, passCode string, options dto.SignUpOptionsDto) *dto.UserSingleRespDto
- func (client *AuthenticationClient) SignUpByEmailPassword(email string, password string, options dto.SignUpOptionsDto) *dto.UserSingleRespDto
- func (client *AuthenticationClient) SignUpByPhonePassCode(phone string, passCode string, phoneCountryCode string, ...) *dto.UserSingleRespDto
- func (client *AuthenticationClient) SignUpByUsernamePassword(username string, password string, options dto.SignUpOptionsDto) *dto.UserSingleRespDto
- func (client *AuthenticationClient) UnbindEmail(reqDto *dto.UnbindEmailDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) UnbindPhone(reqDto *dto.UnbindPhoneDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) UnlinkExtIdp(reqDto *dto.UnlinkExtIdpDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) UpdateEmail(reqDto *dto.UpdateEmailDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) UpdatePassword(reqDto *dto.UpdatePasswordDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) UpdatePhone(reqDto *dto.UpdatePhoneDto) *dto.CommonResponseDto
- func (client *AuthenticationClient) UpdateProfile(reqDto *dto.UpdateUserProfileDto) *dto.UserSingleRespDto
- func (client *AuthenticationClient) ValidateTicketV1(ticket, service string) (..., error)
- func (client *AuthenticationClient) ValidateTicketV2(ticket, service string, format string) (..., error)
- func (client *AuthenticationClient) VerifyDeleteAccountRequest(reqDto *dto.VerifyDeleteAccountRequestDto) *dto.VerifyDeleteAccountRequestRespDto
- func (client *AuthenticationClient) VerifyResetPasswordRequest(reqDto *dto.VerifyResetPasswordRequestDto) *dto.PasswordResetVerifyResp
- func (client *AuthenticationClient) VerifyUpdateEmailRequest(reqDto *dto.VerifyUpdateEmailRequestDto) *dto.VerifyUpdateEmailRequestRespDto
- func (client *AuthenticationClient) VerifyUpdatePhoneRequest(reqDto *dto.VerifyUpdatePhoneRequestDto) *dto.VerifyUpdatePhoneRequestRespDto
- type AuthenticationClientOptions
- type BuildLogoutURLParams
- type ClientCredentialInput
- type CodeToTokenParams
- type ContentType
- type GetAccessTokenByClientCredentialsRequest
- type IDTokenClaims
- type IDTokenExtended
- type OAuth2AuthURLParams
- type OIDCAuthURLParams
- type OIDCTokenResponse
- type ProtocolEnum
- type ProtocolRequestOption
- type ResponseData
- type TokenAuthMethodEnum
- type UserInfo
- type UserInfoCommon
Constants ¶
const ( ClientSecretPost = "client_secret_post" ClientSecretBasic = "client_secret_basic" None = "none" )
const ALG_HS256 = "HS256"
const JWK_PATH = "/oidc/.well-known/jwks.json"
const RandStringLen = 16
Variables ¶
This section is empty.
Functions ¶
func GenQueryString ¶
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct {
jwt.StandardClaims
AccessTokenExtended
}
type AccessTokenExtended ¶
type AccessTokenExtended struct {
Scope string `json:"scope,omitempty"`
}
type AuthUrlResult ¶
type AuthenticationClient ¶
type AuthenticationClient struct {
// contains filtered or unexported fields
}
func NewAuthenticationClient ¶
func NewAuthenticationClient(options *AuthenticationClientOptions) (*AuthenticationClient, error)
func (*AuthenticationClient) BindEmail ¶
func (client *AuthenticationClient) BindEmail(reqDto *dto.BindEmailDto) *dto.CommonResponseDto
* @summary 绑定邮箱 * @description 如果用户还**没有绑定邮箱**,此接口可用于用户**自主**绑定邮箱。如果用户已经绑定邮箱想要修改邮箱,请使用**修改邮箱**接口。你需要先调用**发送邮件**接口发送邮箱验证码。 * @returns CommonResponseDto
func (*AuthenticationClient) BindPhone ¶
func (client *AuthenticationClient) BindPhone(reqDto *dto.BindPhoneDto) *dto.CommonResponseDto
* @summary 绑定手机号 * @description 如果用户还**没有绑定手机号**,此接口可用于用户**自主**绑定手机号。如果用户已经绑定手机号想要修改手机号,请使用**修改手机号**接口。你需要先调用**发送短信**接口发送短信验证码。 * @returns CommonResponseDto
func (*AuthenticationClient) BuildAuthorizeUrlByCas ¶
func (client *AuthenticationClient) BuildAuthorizeUrlByCas(service *string) string
func (*AuthenticationClient) BuildAuthorizeUrlByOauth ¶
func (client *AuthenticationClient) BuildAuthorizeUrlByOauth(params *OAuth2AuthURLParams) (string, error)
func (*AuthenticationClient) BuildAuthorizeUrlByOidc ¶
func (client *AuthenticationClient) BuildAuthorizeUrlByOidc(params *OIDCAuthURLParams) (AuthUrlResult, error)
func (*AuthenticationClient) BuildAuthorizeUrlBySaml ¶
func (client *AuthenticationClient) BuildAuthorizeUrlBySaml() string
func (*AuthenticationClient) BuildLogoutUrl ¶
func (client *AuthenticationClient) BuildLogoutUrl(params *BuildLogoutURLParams) (string, error)
拼接登出 URL
func (*AuthenticationClient) ChangeQrCodeStatus ¶
func (client *AuthenticationClient) ChangeQrCodeStatus(reqDto *dto.ChangeQRCodeStatusDto) *dto.CommonResponseDto
* @summary 自建 APP 扫码登录:APP 端修改二维码状态 * @description 此端点用于在自建 APP 扫码登录中修改二维码状态,对应着在浏览器渲染出二维码之后,终端用户扫码、确认授权、取消授权的过程。**此接口要求具备用户的登录态**。 * @returns CommonResponseDto
func (*AuthenticationClient) CheckPermissionByArrayResource ¶ added in v3.0.5
func (client *AuthenticationClient) CheckPermissionByArrayResource(reqDto *dto.CheckPermissionArrayResourceDto) *dto.CheckResourcePermissionsRespDto
* @summary 数组类型资源鉴权 * @description 数组类型资源鉴权,支持用户对一个或者多个数组资源进行权限判断 * @returns CheckResourcePermissionsRespDto
func (*AuthenticationClient) CheckPermissionByStringResource ¶ added in v3.0.5
func (client *AuthenticationClient) CheckPermissionByStringResource(reqDto *dto.CheckPermissionStringResourceDto) *dto.CheckResourcePermissionsRespDto
* @summary 字符串类型资源鉴权 * @description 字符串类型资源鉴权,支持用户对一个或者多个字符串资源进行权限判断 * @returns CheckResourcePermissionsRespDto
func (*AuthenticationClient) CheckPermissionByTreeResource ¶ added in v3.0.5
func (client *AuthenticationClient) CheckPermissionByTreeResource(reqDto *dto.CheckPermissionTreeResourceDto) *dto.CheckResourcePermissionsRespDto
* @summary 树类型资源鉴权 * @description 树类型资源鉴权,支持用户对一个或者多个树资源进行权限判断 * @returns CheckResourcePermissionsRespDto
func (*AuthenticationClient) CheckQrCodeStatus ¶
func (client *AuthenticationClient) CheckQrCodeStatus(reqDto *dto.CheckQrcodeStatusDto) *dto.CheckQRCodeStatusRespDto
* @summary 查询二维码状态 * @description 按照用户扫码顺序,共分为未扫码、已扫码等待用户确认、用户同意/取消授权、二维码过期以及未知错误六种状态,前端应该通过不同的状态给到用户不同的反馈。你可以通过下面这篇文章了解扫码登录详细的流程:https://docs.authing.cn/v2/concepts/how-qrcode-works.html. * @returns CheckQRCodeStatusRespDto
func (*AuthenticationClient) DecryptWechatMiniProgramData ¶
func (client *AuthenticationClient) DecryptWechatMiniProgramData(reqDto *dto.DecryptWechatMiniProgramDataDto) *dto.DecryptWechatMiniProgramDataRespDto
* @summary 解密微信小程序数据 * @description 解密微信小程序数据 * @returns DecryptWechatMiniProgramDataRespDto
func (*AuthenticationClient) DeleteAccount ¶
func (client *AuthenticationClient) DeleteAccount(reqDto *dto.DeleteAccounDto) *dto.IsSuccessRespDto
* @summary 注销账户 * @description 此端点用于用户自主注销账号,需要提供用于注销账号的临时凭证 deleteAccountToken,此参数需要通过**发起注销账号请求**接口获取。 * @returns IsSuccessRespDto
func (*AuthenticationClient) EnrollFactor ¶
func (client *AuthenticationClient) EnrollFactor(reqDto *dto.EnrollFactorDto) *dto.EnrollFactorRespDto
* @summary 绑定 MFA 认证要素 * @description 绑定 MFA 要素。 * @returns EnrollFactorRespDto
func (*AuthenticationClient) ExchangeTokenSetWithQrCodeTicket ¶
func (client *AuthenticationClient) ExchangeTokenSetWithQrCodeTicket(reqDto *dto.ExchangeTokenSetWithQRcodeTicketDto) *dto.LoginTokenRespDto
- @summary 使用二维码 ticket 换取 TokenSet
- @description
- 此端点为使用二维码的 ticket 换取用户的 `access_token` 和 `id_token`。 * *
- 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 *
- <details>
- <summary>点击展开详情</summary> *
- <br> *
- 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置**
- 中找到**换取 token 身份验证方式** 配置项: *
- > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 *
-  *
- #### 换取 token 身份验证方式为 none 时 *
- 调用此接口不需要进行额外操作。 *
- #### 换取 token 身份验证方式为 client_secret_post 时 *
- 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 *
- #### 换取 token 身份验证方式为 client_secret_basic 时 *
- 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): *
- ```
- Basic base64(<client_id>:<client_secret>)
- ``` *
- 结果示例: *
- ```
- Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3
- ``` *
- JS 代码示例: *
- ```js
- 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64');
- ``` *
- </details> * *
- @returns LoginTokenRespDto
func (*AuthenticationClient) GeneQrCode ¶
func (client *AuthenticationClient) GeneQrCode(reqDto *dto.GenerateQrcodeDto) *dto.GeneQRCodeRespDto
* @summary 生成用于登录的二维码 * @description 生成用于登录的二维码,目前支持生成微信公众号扫码登录、小程序扫码登录、自建移动 APP 扫码登录的二维码。 * @returns GeneQRCodeRespDto
func (*AuthenticationClient) GenerateLinkExtIdpUrl ¶
func (client *AuthenticationClient) GenerateLinkExtIdpUrl(reqDto *dto.GenerateLinkExtidpUrlDto) *dto.GenerateBindExtIdpLinkRespDto
- @summary 生成绑定外部身份源的链接
- @description
- 此接口用于生成绑定外部身份源的链接,生成之后可以引导用户进行跳转。 *
- @returns GenerateBindExtIdpLinkRespDto
func (*AuthenticationClient) GetAccessTokenByClientCredentials ¶
func (client *AuthenticationClient) GetAccessTokenByClientCredentials(req GetAccessTokenByClientCredentialsRequest) (string, error)
GetAccessTokenByClientCredentials AuthenticationClient Credentials 模式获取 Access Token
func (*AuthenticationClient) GetAccessTokenByCode ¶
func (client *AuthenticationClient) GetAccessTokenByCode(code string) (OIDCTokenResponse, error)
GetAccessTokenByCode 使用 code 换取 accessToken
func (*AuthenticationClient) GetAccessibleApps ¶
func (client *AuthenticationClient) GetAccessibleApps() *dto.GetAccessibleAppsRespDto
* @summary 获取具备访问权限的应用 * @description 获取具备访问权限的应用 * @returns GetAccessibleAppsRespDto
func (*AuthenticationClient) GetAlipayAuthInfo ¶
func (client *AuthenticationClient) GetAlipayAuthInfo(reqDto *dto.GetAlipayAuthinfoDto) *dto.GetAlipayAuthInfoRespDto
* @summary 获取支付宝 AuthInfo * @description 此接口用于获取发起支付宝认证需要的[初始化参数 AuthInfo](https://opendocs.alipay.com/open/218/105325)。 * @returns GetAlipayAuthInfoRespDto
func (*AuthenticationClient) GetApplicationEnabledExtIdps ¶
func (client *AuthenticationClient) GetApplicationEnabledExtIdps() *dto.GetExtIdpsRespDto
* @summary 获取应用开启的外部身份源列表 * @description 获取应用开启的外部身份源列表,前端可以基于此渲染外部身份源按钮。 * @returns GetExtIdpsRespDto
func (*AuthenticationClient) GetAuthorizedResources ¶
func (client *AuthenticationClient) GetAuthorizedResources(reqDto *dto.GetMyAuthorizedResourcesDto) *dto.AuthorizedResourcePaginatedRespDto
* @summary 获取被授权的资源列表 * @description 此接口用于获取用户被授权的资源列表。 * @returns AuthorizedResourcePaginatedRespDto
func (*AuthenticationClient) GetCountryList ¶
func (client *AuthenticationClient) GetCountryList() *dto.GetCountryListRespDto
* @summary 获取国家列表 * @description 动态获取国家列表,可以用于前端登录页面国家选择和国际短信输入框选择,以减少前端静态资源体积。 * @returns GetCountryListRespDto
func (*AuthenticationClient) GetDepartmentList ¶
func (client *AuthenticationClient) GetDepartmentList(reqDto *dto.GetMyDepartmentListDto) *dto.UserDepartmentPaginatedRespDto
* @summary 获取部门列表 * @description 此接口用于获取用户的部门列表,可根据一定排序规则进行排序。 * @returns UserDepartmentPaginatedRespDto
func (*AuthenticationClient) GetFactor ¶
func (client *AuthenticationClient) GetFactor(reqDto *dto.GetFactorDto) *dto.GetFactorRespDto
* @summary 获取绑定的某个 MFA 认证要素 * @description 根据 Factor ID 获取用户绑定的某个 MFA Factor 详情。 * @returns GetFactorRespDto
func (*AuthenticationClient) GetGroupList ¶
func (client *AuthenticationClient) GetGroupList() *dto.GroupListRespDto
* @summary 获取分组列表 * @description 获取分组列表 * @returns GroupListRespDto
func (*AuthenticationClient) GetIdentities ¶
func (client *AuthenticationClient) GetIdentities() *dto.GetIdentitiesRespDto
- @summary 获取绑定的外部身份源
- @description
- 如在**介绍**部分中所描述的,一个外部身份源对应多个外部身份源连接,用户通过某个外部身份源连接绑定了某个外部身份源账号之后,
- 用户会建立一条与此外部身份源之间的关联关系。此接口用于获取此用户绑定的所有外部身份源。 *
- 取决于外部身份源的具体实现,一个用户在外部身份源中,可能会有多个身份 ID,比如在微信体系中会有 `openid` 和 `unionid`,在非书中有
- `open_id`、`union_id` 和 `user_id`。在 Authing 中,我们把这样的一条 `open_id` 或者 `unionid_` 叫做一条 `Identity`, 所以用户在一个身份源会有多条 `Identity` 记录。 *
- 以微信为例,如果用户使用微信登录或者绑定了微信账号,他的 `Identity` 信息如下所示: *
- ```json
- [
- {
- "identityId": "62f20932xxxxbcc10d966ee5",
- "extIdpId": "62f209327xxxxcc10d966ee5",
- "provider": "wechat",
- "type": "openid",
- "userIdInIdp": "oH_5k5SflrwjGvk7wqpoBKq_cc6M",
- "originConnIds": ["62f2093244fa5cb19ff21ed3"]
- },
- {
- "identityId": "62f726239xxxxe3285d21c93",
- "extIdpId": "62f209327xxxxcc10d966ee5",
- "provider": "wechat",
- "type": "unionid",
- "userIdInIdp": "o9Nka5ibU-lUGQaeAHqu0nOZyJg0",
- "originConnIds": ["62f2093244fa5cb19ff21ed3"]
- }
- ]
- ``` * *
- 可以看到他们的 `extIdpId` 是一样的,这个是你在 Authing 中创建的**身份源 ID**;`provider` 都是 `wechat`;
- 通过 `type` 可以区分出哪个是 `openid`,哪个是 `unionid`,以及具体的值(`userIdInIdp`);他们都来自于同一个身份源连接(`originConnIds`)。 * * *
- @returns GetIdentitiesRespDto
func (*AuthenticationClient) GetLoggedInApps ¶
func (client *AuthenticationClient) GetLoggedInApps() *dto.GetLoggedInAppsRespDto
* @summary 获取登录应用 * @description 获取登录应用 * @returns GetLoggedInAppsRespDto
func (*AuthenticationClient) GetLoginHistory ¶
func (client *AuthenticationClient) GetLoginHistory(reqDto *dto.GetMyLoginHistoryDto) *dto.GetLoginHistoryRespDto
* @summary 获取登录日志 * @description 获取登录日志 * @returns GetLoginHistoryRespDto
func (*AuthenticationClient) GetNewAccessTokenByRefreshToken ¶
func (client *AuthenticationClient) GetNewAccessTokenByRefreshToken(refreshToken string) (string, error)
GetNewAccessTokenByRefreshToken
使用 Refresh token 获取新的 Access token
func (*AuthenticationClient) GetProfile ¶
func (client *AuthenticationClient) GetProfile(reqDto *dto.GetProfileDto) *dto.UserSingleRespDto
* @summary 获取用户资料 * @description 此端点用户获取用户资料,需要在请求头中带上用户的 `access_token`,Authing 服务器会根据用户 `access_token` 中的 `scope` 返回对应的字段。 * @returns UserSingleRespDto
func (*AuthenticationClient) GetRoleList ¶
func (client *AuthenticationClient) GetRoleList(reqDto *dto.GetMyRoleListDto) *dto.RoleListRespDto
* @summary 获取角色列表 * @description 获取角色列表 * @returns RoleListRespDto
func (*AuthenticationClient) GetSecurityLevel ¶
func (client *AuthenticationClient) GetSecurityLevel() *dto.GetSecurityInfoRespDto
* @summary 获取密码强度和账号安全等级评分 * @description 获取用户的密码强度和账号安全等级评分,需要在请求头中带上用户的 `access_token`。 * @returns GetSecurityInfoRespDto
func (*AuthenticationClient) GetSystemInfo ¶
func (client *AuthenticationClient) GetSystemInfo() *dto.SystemInfoResp
* @summary 获取服务器公开信息 * @description 可端点可获取服务器的公开信息,如 RSA256 公钥、SM2 公钥、Authing 服务版本号等。 * @returns SystemInfoResp
func (*AuthenticationClient) GetTenantList ¶
func (client *AuthenticationClient) GetTenantList() *dto.GetTenantListRespDto
* @summary 获取租户列表 * @description 获取租户列表 * @returns GetTenantListRespDto
func (*AuthenticationClient) GetUserAuthorizedResourcesList ¶ added in v3.0.5
func (client *AuthenticationClient) GetUserAuthorizedResourcesList() *dto.GetUserAuthResourceListRespDto
* @summary 获取用户在登录应用下被授权资源列表 * @description 获取用户指定资源权限列表,用户获取在某个应用下所拥有的资源列表 * @returns GetUserAuthResourceListRespDto
func (*AuthenticationClient) GetUserInfo ¶
func (client *AuthenticationClient) GetUserInfo(accessToken string) (*UserInfo, error)
func (*AuthenticationClient) GetWechatMpAccessToken ¶
func (client *AuthenticationClient) GetWechatMpAccessToken(reqDto *dto.GetWechatAccessTokenDto) *dto.GetWechatAccessTokenRespDto
* @summary 获取微信小程序、公众号 Access Token * @description 获取 Authing 服务器缓存的微信小程序、公众号 Access Token * @returns GetWechatAccessTokenRespDto
func (*AuthenticationClient) IntrospectAccessTokenOffline ¶
func (client *AuthenticationClient) IntrospectAccessTokenOffline(tokenStr string) (*AccessTokenClaims, error)
func (*AuthenticationClient) ListEnrolledFactors ¶
func (client *AuthenticationClient) ListEnrolledFactors() *dto.ListEnrolledFactorsRespDto
* @summary 获取绑定的所有 MFA 认证要素 * @description Authing 目前支持四种类型的 MFA 认证要素:手机短信、邮件验证码、OTP、人脸。 * @returns ListEnrolledFactorsRespDto
func (*AuthenticationClient) ListFactorsToEnroll ¶
func (client *AuthenticationClient) ListFactorsToEnroll() *dto.ListFactorsToEnrollRespDto
* @summary 获取可绑定的 MFA 认证要素 * @description 获取所有应用已经开启、用户暂未绑定的 MFA 认证要素,用户可以从返回的列表中绑定新的 MFA 认证要素。 * @returns ListFactorsToEnrollRespDto
func (*AuthenticationClient) ParseIDToken ¶
func (client *AuthenticationClient) ParseIDToken(tokenStr string) (*IDTokenClaims, error)
func (*AuthenticationClient) PreCheckCode ¶
func (client *AuthenticationClient) PreCheckCode(reqDto *dto.PreCheckCodeDto) *dto.PreCheckCodeRespDto
* @summary 预检验验证码是否正确 * @description 预检测验证码是否有效,此检验不会使得验证码失效。 * @returns PreCheckCodeRespDto
func (*AuthenticationClient) ResetFactor ¶
func (client *AuthenticationClient) ResetFactor(reqDto *dto.ResetFactorDto) *dto.ResetFactorRespDto
* @summary 解绑 MFA 认证要素 * @description 根据 Factor ID 解绑用户绑定的某个 MFA 认证要素。 * @returns ResetFactorRespDto
func (*AuthenticationClient) ResetPassword ¶
func (client *AuthenticationClient) ResetPassword(reqDto *dto.ResetPasswordDto) *dto.IsSuccessRespDto
* @summary 忘记密码 * @description 此端点用于用户忘记密码之后,通过**手机号验证码**或者**邮箱验证码**的方式重置密码。此接口需要提供用于重置密码的临时凭证 `passwordResetToken`,此参数需要通过**发起忘记密码请求**接口获取。 * @returns IsSuccessRespDto
func (*AuthenticationClient) RevokeToken ¶
func (client *AuthenticationClient) RevokeToken(token string) (bool, error)
RevokeToken 撤回 Access token 或 Refresh token
func (*AuthenticationClient) SendEmail ¶
func (client *AuthenticationClient) SendEmail(reqDto *dto.SendEmailDto) *dto.SendEmailRespDto
* @summary 发送邮件 * @description 发送邮件时必须指定邮件 Channel,每个邮箱同一 Channel 在一分钟内只能发送一次。 * @returns SendEmailRespDto
func (*AuthenticationClient) SendEnrollFactorRequest ¶
func (client *AuthenticationClient) SendEnrollFactorRequest(reqDto *dto.SendEnrollFactorRequestDto) *dto.SendEnrollFactorRequestRespDto
* @summary 发起绑定 MFA 认证要素请求 * @description 当用户未绑定某个 MFA 认证要素时,可以发起绑定 MFA 认证要素请求。不同类型的 MFA 认证要素绑定请求需要发送不同的参数,详细见 profile 参数。发起验证请求之后,Authing 服务器会根据相应的认证要素类型和传递的参数,使用不同的手段要求验证。此接口会返回 enrollmentToken,你需要在请求「绑定 MFA 认证要素」接口时带上此 enrollmentToken,并提供相应的凭证。 * @returns SendEnrollFactorRequestRespDto
func (*AuthenticationClient) SendHttpRequest ¶
func (client *AuthenticationClient) SendHttpRequest(url string, method string, reqDto interface{}) ([]byte, error)
func (AuthenticationClient) SendProtocolHttpRequest ¶
func (client AuthenticationClient) SendProtocolHttpRequest(option *ProtocolRequestOption) (*ResponseData, error)
func (*AuthenticationClient) SendSms ¶
func (client *AuthenticationClient) SendSms(reqDto *dto.SendSMSDto) *dto.SendSMSRespDto
* @summary 发送短信 * @description 发送短信时必须指定短信 Channel,每个手机号同一 Channel 在一分钟内只能发送一次。 * @returns SendSMSRespDto
func (*AuthenticationClient) SetAccessToken ¶
func (client *AuthenticationClient) SetAccessToken(accessToken string)
func (*AuthenticationClient) SignInByAD ¶
func (client *AuthenticationClient) SignInByAD(sAMAccountName string, passCode string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignInByAccountPassword ¶
func (client *AuthenticationClient) SignInByAccountPassword(account string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignInByCredentials ¶
func (client *AuthenticationClient) SignInByCredentials(reqDto *dto.SigninByCredentialsDto) *dto.LoginTokenRespDto
==== AUTO GENERATED AUTHENTICATION METHODS BEGIN ====
- @summary 使用用户凭证登录
- @description
- 此端点为基于直接 API 调用形式的登录端点,适用于你需要自建登录页面的场景。**此端点暂时不支持 MFA、信息补全、首次密码重置等流程,如有需要,请使用 OIDC 标准协议认证端点。** * *
- 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 *
- <details>
- <summary>点击展开详情</summary> *
- <br> *
- 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置**
- 中找到**换取 token 身份验证方式** 配置项: *
- > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 *
-  *
- #### 换取 token 身份验证方式为 none 时 *
- 调用此接口不需要进行额外操作。 *
- #### 换取 token 身份验证方式为 client_secret_post 时 *
- 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 *
- #### 换取 token 身份验证方式为 client_secret_basic 时 *
- 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): *
- ```
- Basic base64(<client_id>:<client_secret>)
- ``` *
- 结果示例: *
- ```
- Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3
- ``` *
- JS 代码示例: *
- ```js
- 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64');
- ``` *
- </details> * *
- @returns LoginTokenRespDto 成功认证
func (*AuthenticationClient) SignInByEmailPassCode ¶ added in v3.0.2
func (client *AuthenticationClient) SignInByEmailPassCode(email string, passCode string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignInByEmailPassword ¶
func (client *AuthenticationClient) SignInByEmailPassword(email string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignInByLDAP ¶
func (client *AuthenticationClient) SignInByLDAP(sAMAccountName string, passCode string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignInByMobile ¶
func (client *AuthenticationClient) SignInByMobile(reqDto *dto.SigninByMobileDto) *dto.LoginTokenRespDto
- @summary 使用移动端社会化登录
- @description
- 此端点为移动端社会化登录接口,使用第三方移动社会化登录返回的临时凭证登录,并换取用户的 `id_token` 和 `access_token`。请先阅读相应社会化登录的接入流程。 * *
- 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 *
- <details>
- <summary>点击展开详情</summary> *
- <br> *
- 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置**
- 中找到**换取 token 身份验证方式** 配置项: *
- > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 *
-  *
- #### 换取 token 身份验证方式为 none 时 *
- 调用此接口不需要进行额外操作。 *
- #### 换取 token 身份验证方式为 client_secret_post 时 *
- 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 *
- #### 换取 token 身份验证方式为 client_secret_basic 时 *
- 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): *
- ```
- Basic base64(<client_id>:<client_secret>)
- ``` *
- 结果示例: *
- ```
- Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3
- ``` *
- JS 代码示例: *
- ```js
- 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64');
- ``` *
- </details> * *
- @returns LoginTokenRespDto
func (*AuthenticationClient) SignInByPhonePassCode ¶ added in v3.0.2
func (client *AuthenticationClient) SignInByPhonePassCode(phone string, passCode string, phoneCountryCode string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignInByPhonePassword ¶
func (client *AuthenticationClient) SignInByPhonePassword(phone string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignInByUsernamePassword ¶
func (client *AuthenticationClient) SignInByUsernamePassword(username string, password string, options dto.SignInOptionsDto) *dto.LoginTokenRespDto
func (*AuthenticationClient) SignUp ¶
func (client *AuthenticationClient) SignUp(reqDto *dto.SignUpDto) *dto.UserSingleRespDto
- @summary 注册
- @description
- 此端点目前支持以下几种基于的注册方式: *
- 1. 基于密码(PASSWORD):用户名 + 密码,邮箱 + 密码。
- 2. 基于一次性临时验证码(PASSCODE):手机号 + 验证码,邮箱 + 验证码。你需要先调用发送短信或者发送邮件接口获取验证码。 *
- 社会化登录等使用外部身份源“注册”请直接使用**登录**接口,我们会在其第一次登录的时候为其创建一个新账号。 *
- @returns UserSingleRespDto
func (*AuthenticationClient) SignUpByEmailPassCode ¶
func (client *AuthenticationClient) SignUpByEmailPassCode(email string, passCode string, options dto.SignUpOptionsDto) *dto.UserSingleRespDto
func (*AuthenticationClient) SignUpByEmailPassword ¶
func (client *AuthenticationClient) SignUpByEmailPassword(email string, password string, options dto.SignUpOptionsDto) *dto.UserSingleRespDto
func (*AuthenticationClient) SignUpByPhonePassCode ¶
func (client *AuthenticationClient) SignUpByPhonePassCode(phone string, passCode string, phoneCountryCode string, options dto.SignUpOptionsDto) *dto.UserSingleRespDto
func (*AuthenticationClient) SignUpByUsernamePassword ¶
func (client *AuthenticationClient) SignUpByUsernamePassword(username string, password string, options dto.SignUpOptionsDto) *dto.UserSingleRespDto
func (*AuthenticationClient) UnbindEmail ¶
func (client *AuthenticationClient) UnbindEmail(reqDto *dto.UnbindEmailDto) *dto.CommonResponseDto
* @summary 解绑邮箱 * @description 用户解绑邮箱,如果用户没有绑定其他登录方式(手机号、社会化登录账号),将无法解绑邮箱,会提示错误。 * @returns CommonResponseDto
func (*AuthenticationClient) UnbindPhone ¶
func (client *AuthenticationClient) UnbindPhone(reqDto *dto.UnbindPhoneDto) *dto.CommonResponseDto
* @summary 解绑手机号 * @description 用户解绑手机号,如果用户没有绑定其他登录方式(邮箱、社会化登录账号),将无法解绑手机号,会提示错误。 * @returns CommonResponseDto
func (*AuthenticationClient) UnlinkExtIdp ¶
func (client *AuthenticationClient) UnlinkExtIdp(reqDto *dto.UnlinkExtIdpDto) *dto.CommonResponseDto
* @summary 解绑外部身份源 * @description 解绑外部身份源,此接口需要传递用户绑定的外部身份源 ID,**注意不是身份源连接 ID**。 * @returns CommonResponseDto
func (*AuthenticationClient) UpdateEmail ¶
func (client *AuthenticationClient) UpdateEmail(reqDto *dto.UpdateEmailDto) *dto.CommonResponseDto
- @summary 修改邮箱
- @description 终端用户自主修改邮箱,需要提供相应的验证手段,见[发起修改邮箱的验证请求](#tag/用户资料/修改邮箱/operation/ProfileV3Controller_updateEmailVerification)。
- 此参数需要提供一次性临时凭证 `updateEmailToken`,此数据需要从**发起修改邮箱的验证请求**接口获取。
- @returns CommonResponseDto
func (*AuthenticationClient) UpdatePassword ¶
func (client *AuthenticationClient) UpdatePassword(reqDto *dto.UpdatePasswordDto) *dto.CommonResponseDto
* @summary 修改密码 * @description 此端点用于用户自主修改密码,如果用户之前已经设置密码,需要提供用户的原始密码作为凭证。如果用户忘记了当前密码,请使用**忘记密码**接口。 * @returns CommonResponseDto
func (*AuthenticationClient) UpdatePhone ¶
func (client *AuthenticationClient) UpdatePhone(reqDto *dto.UpdatePhoneDto) *dto.CommonResponseDto
- @summary 修改手机号
- @description 终端用户自主修改手机号,需要提供相应的验证手段,见[发起修改手机号的验证请求](#tag/用户资料/修改邮箱/operation/ProfileV3Controller_updatePhoneVerification)。
- 此参数需要提供一次性临时凭证 `updatePhoneToken`,此数据需要从**发起修改手机号的验证请求**接口获取。
- @returns CommonResponseDto
func (*AuthenticationClient) UpdateProfile ¶
func (client *AuthenticationClient) UpdateProfile(reqDto *dto.UpdateUserProfileDto) *dto.UserSingleRespDto
* @summary 修改用户资料 * @description 此接口用于修改用户的用户资料,包含用户的自定义数据。如果需要**修改邮箱**、**修改手机号**、**修改密码**,请使用对应的单独接口。 * @returns UserSingleRespDto
func (*AuthenticationClient) ValidateTicketV1 ¶
func (client *AuthenticationClient) ValidateTicketV1(ticket, service string) (*struct { Valid bool `json:"code"` Message string `json:"message"` Username string `json:"username"` }, error)
* 检验 CAS 1.0 Ticket 合法性
func (*AuthenticationClient) ValidateTicketV2 ¶
func (client *AuthenticationClient) ValidateTicketV2(ticket, service string, format string) (*struct { Code int64 `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }, error)
通过远端服务验证票据合法性
func (*AuthenticationClient) VerifyDeleteAccountRequest ¶
func (client *AuthenticationClient) VerifyDeleteAccountRequest(reqDto *dto.VerifyDeleteAccountRequestDto) *dto.VerifyDeleteAccountRequestRespDto
* @summary 发起注销账号请求 * @description 当用户希望注销账号时,需提供相应凭证,当前支持**使用邮箱验证码**、使用**手机验证码**、**使用密码**三种验证方式。 * @returns VerifyDeleteAccountRequestRespDto
func (*AuthenticationClient) VerifyResetPasswordRequest ¶
func (client *AuthenticationClient) VerifyResetPasswordRequest(reqDto *dto.VerifyResetPasswordRequestDto) *dto.PasswordResetVerifyResp
* @summary 发起忘记密码请求 * @description 当用户忘记密码时,可以通过此端点找回密码。用户需要使用相关验证手段进行验证,目前支持**邮箱验证码**和**手机号验证码**两种验证手段。 * @returns PasswordResetVerifyResp
func (*AuthenticationClient) VerifyUpdateEmailRequest ¶
func (client *AuthenticationClient) VerifyUpdateEmailRequest(reqDto *dto.VerifyUpdateEmailRequestDto) *dto.VerifyUpdateEmailRequestRespDto
* @summary 发起修改邮箱的验证请求 * @description 终端用户自主修改邮箱时,需要提供相应的验证手段。此接口用于验证用户的修改邮箱请求是否合法。当前支持通过**邮箱验证码**的方式进行验证,你需要先调用发送邮件接口发送对应的邮件验证码。 * @returns VerifyUpdateEmailRequestRespDto
func (*AuthenticationClient) VerifyUpdatePhoneRequest ¶
func (client *AuthenticationClient) VerifyUpdatePhoneRequest(reqDto *dto.VerifyUpdatePhoneRequestDto) *dto.VerifyUpdatePhoneRequestRespDto
* @summary 发起修改手机号的验证请求 * @description 终端用户自主修改手机号时,需要提供相应的验证手段。此接口用于验证用户的修改手机号请求是否合法。当前支持通过**短信验证码**的方式进行验证,你需要先调用发送短信接口发送对应的短信验证码。 * @returns VerifyUpdatePhoneRequestRespDto
type AuthenticationClientOptions ¶
type AuthenticationClientOptions struct {
/**
应用 ID
*/
AppId string
/**
应用 Secret
*/
AppSecret string
/**
应用域名,例如 pool.authing.cn
*/
AppHost string
/**
用户的 Access Token
*/
AccessToken string
/**
认证完成后的重定向目标 URL
*/
RedirectUri string
/**
登出完成后的重定向目标 URL, 可选
*/
LogoutRedirectUri string
/**
* @optional
* 应用侧向 Authing 请求的权限,以空格分隔,默认为 'openid profile'
*
* 成功获取的权限会出现在 Access Token 的 scope 字段中
*
* 一些示例:
* - openid OIDC 标准规定的权限,必须包含
* - profile 获取用户的基本身份信息
* - offline_access 获取用户的 Refresh Token,可用于调用 refreshLoginState 刷新用户的登录态
*/
Scope string
/**
获取 token 端点认证方式
*/
TokenEndPointAuthMethod TokenAuthMethodEnum
/**
检测 token 端点认证方式
*/
IntrospectionEndPointAuthMethod TokenAuthMethodEnum
/**
撤销 token 端点认证方式
*/
RevocationEndPointAuthMethod TokenAuthMethodEnum
/**
协议类型,默认为 oidc
*/
Protocol ProtocolEnum
/**
请求超时时间
*/
Timeout int
/**
是否跳过 HTTPS 证书检测,默认为 false;如果是私有化部署的场景且证书不被信任,可以设置为 true
*/
InsecureSkipVerify bool
}
type BuildLogoutURLParams ¶
type ClientCredentialInput ¶
type CodeToTokenParams ¶
type GetAccessTokenByClientCredentialsRequest ¶
type GetAccessTokenByClientCredentialsRequest struct {
Scope string `json:"scope"`
ClientCredentialInput *ClientCredentialInput `json:"client_credential_input"`
}
type IDTokenClaims ¶
type IDTokenClaims struct {
UserInfoCommon
IDTokenExtended
jwt.StandardClaims
}
type IDTokenExtended ¶
type OAuth2AuthURLParams ¶
type OIDCAuthURLParams ¶
type OIDCTokenResponse ¶
type OIDCTokenResponse struct {
AccessToken string `json:"access_token,omitempty"`
IDToken string `json:"id_token,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"` //可选
ExpiresIn uint64 `json:"expires_in,omitempty"`
TokenType string `json:"token_type,omitempty"`
Error string `json:"error,omitempty"`
ErrorDescription string `json:"error_description,omitempty"`
}
type ProtocolEnum ¶
type ProtocolEnum string
const ( OAUTH ProtocolEnum = "oauth" OIDC ProtocolEnum = "oidc" CAS ProtocolEnum = "cas" SAML ProtocolEnum = "saml" )
type ProtocolRequestOption ¶
type ResponseData ¶
type ResponseData struct {
Body []byte
Header *fasthttp.ResponseHeader
StatusCode int
}
type TokenAuthMethodEnum ¶
type TokenAuthMethodEnum string
type UserInfo ¶
type UserInfo struct {
Subject string `json:"sub,omitempty"` // 用户 ID
UserInfoCommon
}
type UserInfoCommon ¶
type UserInfoCommon struct {
Name string `json:"name,omitempty"`
Nickname string `json:"nickname,omitempty"`
GivenName string `json:"given_name,omitempty"`
FamilyName string `json:"family_name,omitempty"`
Birthdate string `json:"birthdate,omitempty"`
Gender string `json:"gender,omitempty"` //'M' | 'F' | 'U'
Picture string `json:"picture,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Zoneinfo string `json:"zoneinfo,omitempty"`
PreferredUsername string `json:"preferred_username,omitempty"`
Locale string `json:"locale,omitempty"`
}