authentication

package
v3.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientSecretPost  = "client_secret_post"
	ClientSecretBasic = "client_secret_basic"
	None              = "none"
)
View Source
const ALG_HS256 = "HS256"
View Source
const JWK_PATH = "/oidc/.well-known/jwks.json"
View Source
const RandStringLen = 16

Variables

This section is empty.

Functions

func GenFormArgs

func GenFormArgs(variables map[string]string) *fasthttp.Args

func GenQueryString

func GenQueryString(variables map[string]string) string

Types

type AccessTokenClaims

type AccessTokenClaims struct {
	jwt.StandardClaims
	AccessTokenExtended
}

type AccessTokenExtended

type AccessTokenExtended struct {
	Scope string `json:"scope,omitempty"`
}

type AuthUrlResult

type AuthUrlResult struct {
	Url   string
	State string
	Nonce string
}

type AuthenticationClient

type AuthenticationClient struct {
	// contains filtered or unexported fields
}

func NewAuthenticationClient

func NewAuthenticationClient(options *AuthenticationClientOptions) (*AuthenticationClient, error)

func (*AuthenticationClient) AuthByCodeIdentity added in v3.0.14

func (*AuthenticationClient) BindByAccount added in v3.0.14

func (*AuthenticationClient) BindByAccountId added in v3.0.14

func (*AuthenticationClient) BindByEmailCode added in v3.0.14

func (*AuthenticationClient) BindByPhoneCode added in v3.0.14

func (*AuthenticationClient) BindEmail

func (client *AuthenticationClient) BindEmail(reqDto *dto.BindEmailDto) *dto.CommonResponseDto

func (*AuthenticationClient) BindPhone

func (client *AuthenticationClient) BindPhone(reqDto *dto.BindPhoneDto) *dto.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) ChangePushCodeStatus added in v3.0.14

func (client *AuthenticationClient) ChangePushCodeStatus(reqDto *dto.ChangePushCodeStatusDto) *dto.CommonResponseDto

func (*AuthenticationClient) ChangeQrCodeStatus

func (client *AuthenticationClient) ChangeQrCodeStatus(reqDto *dto.ChangeQRCodeStatusDto) *dto.CommonResponseDto

func (*AuthenticationClient) CheckPermissionByArrayResource added in v3.0.5

func (client *AuthenticationClient) CheckPermissionByArrayResource(reqDto *dto.CheckPermissionArrayResourceDto) *dto.CheckResourcePermissionsRespDto

func (*AuthenticationClient) CheckPermissionByStringResource added in v3.0.5

func (client *AuthenticationClient) CheckPermissionByStringResource(reqDto *dto.CheckPermissionStringResourceDto) *dto.CheckResourcePermissionsRespDto

func (*AuthenticationClient) CheckPermissionByTreeResource added in v3.0.5

func (client *AuthenticationClient) CheckPermissionByTreeResource(reqDto *dto.CheckPermissionTreeResourceDto) *dto.CheckResourcePermissionsRespDto

func (*AuthenticationClient) CheckPushCodeStatus added in v3.0.14

func (client *AuthenticationClient) CheckPushCodeStatus(reqDto *dto.CheckPushcodeStatusDto) *dto.CheckPushCodeStatusRespDto

* @summary 查询推送码状态 * @description 按照推送码使用顺序,共分为已推送、等待用户 同意/取消 授权、推送码过期以及未知错误五种状态,前端应该通过不同的状态给到用户不同的反馈。 * @returns CheckPushCodeStatusRespDto

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) CheckValidCredentialsByCredIds added in v3.0.14

func (*AuthenticationClient) DecryptWechatMiniProgramData

func (*AuthenticationClient) DeleteAccount

func (client *AuthenticationClient) DeleteAccount(reqDto *dto.DeleteAccounDto) *dto.IsSuccessRespDto

func (*AuthenticationClient) EnrollFactor

func (client *AuthenticationClient) EnrollFactor(reqDto *dto.EnrollFactorDto) *dto.EnrollFactorRespDto

func (*AuthenticationClient) ExchangeTokenSetWithQrCodeTicket

func (client *AuthenticationClient) ExchangeTokenSetWithQrCodeTicket(reqDto *dto.ExchangeTokenSetWithQRcodeTicketDto) *dto.LoginTokenRespDto

func (*AuthenticationClient) GeneFastpassQrcodeInfo added in v3.0.14

func (client *AuthenticationClient) GeneFastpassQrcodeInfo(reqDto *dto.SignInFastpassDto) *dto.GeneFastpassQRCodeRespDto

func (*AuthenticationClient) GeneQrCode

func (client *AuthenticationClient) GeneQrCode(reqDto *dto.GenerateQrcodeDto) *dto.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

* @summary 获取被授权的资源列表 * @description 此接口用于获取用户被授权的资源列表。 * @returns AuthorizedResourcePaginatedRespDto

func (*AuthenticationClient) GetCountryList

func (client *AuthenticationClient) GetCountryList() *dto.GetCountryListRespDto

* @summary 获取国家列表 * @description 动态获取国家列表,可以用于前端登录页面国家选择和国际短信输入框选择,以减少前端静态资源体积。 * @returns GetCountryListRespDto

func (*AuthenticationClient) GetDepartmentList

* @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) GetFastpassParams added in v3.0.14

* @summary 获取快速认证的应用列表 * @description 此端点用于使用 Authing 令牌 APP 扫「用户个人中心」-「快速认证」二维码后,拉取可快速认证的客户端应用列表。 * @returns GetFastpassQRCodeRelationAppsRespDto

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) GetPushLoginRelationApps added in v3.0.14

func (client *AuthenticationClient) GetPushLoginRelationApps(reqDto *dto.GetPushCodeRelationAppsDto) *dto.GetPushCodeRelationAppsRespDto

func (*AuthenticationClient) GetQrCodeStatus added in v3.0.14

* @summary 查询个人中心「快速认证二维码」的状态 * @description 按照用户扫码顺序,共分为未扫码、已扫码、已登录、二维码过期以及未知错误五种状态,前端应该通过不同的状态给到用户不同的反馈。 * @returns CheckQRCodeStatusRespDto

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) GetUserAuthResourcePermissionList added in v3.0.14

func (*AuthenticationClient) GetUserAuthResourceStruct added in v3.0.14

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

func (*AuthenticationClient) GetWechatMpAccessTokenInfo added in v3.0.14

func (client *AuthenticationClient) GetWechatMpAccessTokenInfo(reqDto *dto.GetWechatAccessTokenDto) *dto.GetWechatAccessTokenInfoRespDto

func (*AuthenticationClient) InitAuthenticationOptions added in v3.0.14

func (client *AuthenticationClient) InitAuthenticationOptions() *dto.GetAuthenticationOptionsRespDto

* @summary 获取 WebAuthn 认证请求初始化参数 * @description 获取 WebAuthn 认证请求初始化参数 * @returns GetAuthenticationOptionsRespDto

func (*AuthenticationClient) InitRegisterOptions added in v3.0.14

func (client *AuthenticationClient) InitRegisterOptions() *dto.GetRegistrationOptionsRespDto

* @summary 获取 webauthn 凭证创建初始化参数 * @description 获取 webauthn 凭证创建初始化参数。**此接口要求具备用户的登录态** * @returns GetRegistrationOptionsRespDto

func (*AuthenticationClient) IntrospectAccessTokenOffline

func (client *AuthenticationClient) IntrospectAccessTokenOffline(tokenStr string) (*AccessTokenClaims, error)

func (*AuthenticationClient) IntrospectToken

func (client *AuthenticationClient) IntrospectToken(token string) (*dto.TokenIntrospectResponse, error)

func (*AuthenticationClient) List added in v3.0.14

* @summary 我的设备列表 * @description 我登录过的设备列表。 * @returns TerminalSessionRespDto

func (*AuthenticationClient) ListCredentialsByPage added in v3.0.14

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) ListPublicAccountsForSwitchLoggedIn added in v3.0.14

func (client *AuthenticationClient) ListPublicAccountsForSwitchLoggedIn(reqDto *dto.GetUserSelectLoginPublicAccountsDto) *dto.GetPublicAccountDataRespDto

* @summary 查询当前登录用户可切换登录的公共账号列表 * @description 此端点用于查询当前登录用户可切换登录的公共账号列表,如果没有可切换登录的公共账号,则返回空数组。 * @returns GetPublicAccountDataRespDto

func (*AuthenticationClient) MfaOtpVerify added in v3.0.6

func (client *AuthenticationClient) MfaOtpVerify(reqDto *dto.MfaOtpVerityDto) *dto.MfaOtpVerityRespDto

func (*AuthenticationClient) ParseIDToken

func (client *AuthenticationClient) ParseIDToken(tokenStr string) (*IDTokenClaims, error)

func (*AuthenticationClient) PreCheckCode

func (client *AuthenticationClient) PreCheckCode(reqDto *dto.PreCheckCodeDto) *dto.PreCheckCodeRespDto

func (*AuthenticationClient) PubEvent added in v3.0.10

func (client *AuthenticationClient) PubEvent(eventCode string, data interface{}) *dto.IsSuccessRespDto

* @summary 事件发布 * @description 根据事件编码发布一个自定义事件 * @param eventCode 事件编码 * @param body 事件消息 * @returns IsSuccessRespDto

func (*AuthenticationClient) QrCodeAppLogin added in v3.0.14

func (client *AuthenticationClient) QrCodeAppLogin(reqDto *dto.AppQRCodeLoginDto) *dto.LoginTokenRespDto

func (*AuthenticationClient) RegisterNewUser added in v3.0.14

func (client *AuthenticationClient) RegisterNewUser(reqDto *dto.BindByRegiserInputApi) *dto.WechatLoginTokenRespDto

func (*AuthenticationClient) RemoveAllCredentials added in v3.0.14

func (client *AuthenticationClient) RemoveAllCredentials(reqDto *dto.RemoveDeviceCredentialDto) *dto.IsSuccessRespDto

func (*AuthenticationClient) RemoveCredential added in v3.0.14

func (client *AuthenticationClient) RemoveCredential(reqDto *dto.WebAuthnRemoveCredentialDto) *dto.IsSuccessRespDto

func (*AuthenticationClient) ResetFactor

func (client *AuthenticationClient) ResetFactor(reqDto *dto.ResetFactorDto) *dto.ResetFactorRespDto

func (*AuthenticationClient) ResetPassword

func (client *AuthenticationClient) ResetPassword(reqDto *dto.ResetPasswordDto) *dto.IsSuccessRespDto

func (*AuthenticationClient) Revoke added in v3.0.14

func (*AuthenticationClient) RevokeToken

func (client *AuthenticationClient) RevokeToken(token string) (bool, error)

RevokeToken 撤回 Access token 或 Refresh token

func (*AuthenticationClient) SelectAccount added in v3.0.14

func (*AuthenticationClient) SendEmail

func (client *AuthenticationClient) SendEmail(reqDto *dto.SendEmailDto) *dto.SendEmailRespDto

func (*AuthenticationClient) SendEnrollFactorRequest

func (client *AuthenticationClient) SendEnrollFactorRequest(reqDto *dto.SendEnrollFactorRequestDto) *dto.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

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

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

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) SignInByPush added in v3.0.14

func (client *AuthenticationClient) SignInByPush(reqDto *dto.SignInByPushDto) *dto.GenePushCodeRespDto

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

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) SubEvent added in v3.0.10

func (client *AuthenticationClient) SubEvent(eventCode string, onSuccess func(msg []byte), onError func(err error))

* @summary 事件订阅 * @description 根据事件编码订阅一个自定义事件 * @param eventCode 事件编码 * @param onSuccess 成功的消息 * @param onError 异常处理

func (*AuthenticationClient) SubEventByReceiver added in v3.0.10

func (client *AuthenticationClient) SubEventByReceiver(eventCode string, receiver util.EventReceiver)

* @summary 事件订阅 * @description 根据事件编码订阅一个自定义事件 * @param eventCode 事件编码 * @param receiver 消息处理器

func (*AuthenticationClient) SwitchLoginByUser added in v3.0.14

func (client *AuthenticationClient) SwitchLoginByUser(reqDto *dto.PublicAccountSwitchLoginDto) *dto.LoginTokenRespDto

func (*AuthenticationClient) Unbind added in v3.0.14

func (*AuthenticationClient) UnbindEmail

func (client *AuthenticationClient) UnbindEmail(reqDto *dto.UnbindEmailDto) *dto.CommonResponseDto

func (*AuthenticationClient) UnbindPhone

func (client *AuthenticationClient) UnbindPhone(reqDto *dto.UnbindPhoneDto) *dto.CommonResponseDto

func (*AuthenticationClient) UnlinkExtIdp

func (client *AuthenticationClient) UnlinkExtIdp(reqDto *dto.UnlinkExtIdpDto) *dto.CommonResponseDto

func (*AuthenticationClient) UpdateEmail

func (client *AuthenticationClient) UpdateEmail(reqDto *dto.UpdateEmailDto) *dto.CommonResponseDto

func (*AuthenticationClient) UpdatePassword

func (client *AuthenticationClient) UpdatePassword(reqDto *dto.UpdatePasswordDto) *dto.CommonResponseDto

func (*AuthenticationClient) UpdatePhone

func (client *AuthenticationClient) UpdatePhone(reqDto *dto.UpdatePhoneDto) *dto.CommonResponseDto

func (*AuthenticationClient) UpdateProfile

func (client *AuthenticationClient) UpdateProfile(reqDto *dto.UpdateUserProfileDto) *dto.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) VerifyAuthentication added in v3.0.14

func (*AuthenticationClient) VerifyDeleteAccountRequest

func (*AuthenticationClient) VerifyMfaToken added in v3.0.14

func (*AuthenticationClient) VerifyRegister added in v3.0.14

func (*AuthenticationClient) VerifyResetPasswordRequest

func (client *AuthenticationClient) VerifyResetPasswordRequest(reqDto *dto.VerifyResetPasswordRequestDto) *dto.PasswordResetVerifyResp

func (*AuthenticationClient) VerifyUpdateEmailRequest

func (client *AuthenticationClient) VerifyUpdateEmailRequest(reqDto *dto.VerifyUpdateEmailRequestDto) *dto.VerifyUpdateEmailRequestRespDto

func (*AuthenticationClient) VerifyUpdatePhoneRequest

func (client *AuthenticationClient) VerifyUpdatePhoneRequest(reqDto *dto.VerifyUpdatePhoneRequestDto) *dto.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

	/**
	请求超时时间
	*/
	//Deprecated: Use ReadTimeout instead
	Timeout int

	ReadTimeout time.Duration

	/**
	是否跳过 HTTPS 证书检测,默认为 false;如果是私有化部署的场景且证书不被信任,可以设置为 true
	*/
	InsecureSkipVerify bool
	/**
	 * 订阅事件 WebSocket 地址
	 */
	WssHost string
}

type BuildLogoutURLParams

type BuildLogoutURLParams struct {
	PostLogoutRedirectUri string // 可选
	IDTokenHint           string // 可选
	State                 string // 可选
}

type ClientCredentialInput

type ClientCredentialInput struct {
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
}

type CodeToTokenParams

type CodeToTokenParams struct {
	Code        string
	RedirectUri string
	Nonce       string
}

type ContentType

type ContentType int
const (
	Default ContentType = iota // 开始生成枚举值, 默认为0
	Json
)

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 IDTokenExtended struct {
	Nonce  string `json:"nonce,omitempty"`
	AtHash string `json:"at_hash,omitempty"`
	SHash  string `json:"s_hash,omitempty"`
}

type OAuth2AuthURLParams

type OAuth2AuthURLParams struct {
	RedirectUri string
	State       string
	/**
	默认为 openid profile email phone address
	*/
	Scope        string
	ResponseType string
}

type OIDCAuthURLParams

type OIDCAuthURLParams struct {
	RedirectUri  string
	State        string
	Nonce        string
	Scope        string
	ResponseType string
	ResponseMode string
	Forced       bool
}

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 ProtocolRequestOption struct {
	Url         string
	Method      string
	ReqDto      map[string]string
	Headers     map[string]string
	ContentType ContentType
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL