Documentation
¶
Overview ¶
Package client 提供认证相关 gRPC 客户端能力。
Index ¶
- type Client
- func (c *Client) ChallengeRaw() authnv2.AuthChallengeServiceClient
- func (c *Client) GetJWKS(ctx context.Context, req *authnv2.GetJWKSRequest) (*authnv2.GetJWKSResponse, error)
- func (c *Client) IssueServiceToken(ctx context.Context, req *authnv2.IssueServiceTokenRequest) (*authnv2.IssueServiceTokenResponse, error)
- func (c *Client) JWKSRaw() authnv2.JWKSServiceClient
- func (c *Client) LinkPhone(ctx context.Context, req *authnv2.LinkPhoneRequest) (*authnv2.LinkLoginIdentityResponse, error)
- func (c *Client) LinkWechatMiniProgram(ctx context.Context, req *authnv2.LinkWechatMiniProgramRequest) (*authnv2.LinkLoginIdentityResponse, error)
- func (c *Client) LinkWecom(ctx context.Context, req *authnv2.LinkWecomRequest) (*authnv2.LinkLoginIdentityResponse, error)
- func (c *Client) ListLoginIdentities(ctx context.Context, req *authnv2.ListLoginIdentitiesRequest) (*authnv2.ListLoginIdentitiesResponse, error)
- func (c *Client) Login(ctx context.Context, req *authnv2.LoginRequest) (*authnv2.LoginResponse, error)
- func (c *Client) LoginIdentityRaw() authnv2.LoginIdentityServiceClient
- func (c *Client) Raw() authnv2.AuthServiceClient
- func (c *Client) RefreshToken(ctx context.Context, req *authnv2.RefreshTokenRequest) (*authnv2.RefreshTokenResponse, error)
- func (c *Client) RevokeRefreshToken(ctx context.Context, req *authnv2.RevokeRefreshTokenRequest) (*authnv2.RevokeRefreshTokenResponse, error)
- func (c *Client) RevokeToken(ctx context.Context, req *authnv2.RevokeTokenRequest) (*authnv2.RevokeTokenResponse, error)
- func (c *Client) SendLoginPhoneOTP(ctx context.Context, req *authnv2.SendLoginPhoneOTPRequest) (*authnv2.MessageResponse, error)
- func (c *Client) SendPhoneLinkChallenge(ctx context.Context, req *authnv2.SendPhoneLinkChallengeRequest) (*authnv2.MessageResponse, error)
- func (c *Client) SignUpWithWechatMiniProgram(ctx context.Context, req *authnv2.SignUpWithWechatMiniProgramRequest) (*authnv2.SignupResult, error)
- func (c *Client) SignupRaw() authnv2.AuthSignupServiceClient
- func (c *Client) UnlinkLoginIdentity(ctx context.Context, req *authnv2.UnlinkLoginIdentityRequest) (*authnv2.MessageResponse, error)
- func (c *Client) VerifyToken(ctx context.Context, req *authnv2.VerifyTokenRequest) (*authnv2.VerifyTokenResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 认证服务客户端。
提供认证相关功能,包括:
- Token 验证和管理(VerifyToken、RefreshToken、RevokeToken、RevokeRefreshToken)
- 服务间认证(IssueServiceToken)
- 生产 AuthN 契约(Signup、Challenge、LoginIdentity)
- JWKS 管理(GetJWKS)
func NewClient ¶
func NewClient( authService authnv2.AuthServiceClient, jwksService authnv2.JWKSServiceClient, optionalServices ...any, ) *Client
NewClient 创建认证服务客户端。
func (*Client) ChallengeRaw ¶ added in v2.0.6
func (c *Client) ChallengeRaw() authnv2.AuthChallengeServiceClient
ChallengeRaw 返回原始 challenge gRPC 客户端。
func (*Client) GetJWKS ¶
func (c *Client) GetJWKS(ctx context.Context, req *authnv2.GetJWKSRequest) (*authnv2.GetJWKSResponse, error)
GetJWKS 获取 JSON Web Key Set (JWKS)。
func (*Client) IssueServiceToken ¶
func (c *Client) IssueServiceToken(ctx context.Context, req *authnv2.IssueServiceTokenRequest) (*authnv2.IssueServiceTokenResponse, error)
IssueServiceToken 签发服务间认证 Token。
func (*Client) JWKSRaw ¶
func (c *Client) JWKSRaw() authnv2.JWKSServiceClient
JWKSRaw 返回原始 JWKS 服务 gRPC 客户端。
func (*Client) LinkPhone ¶ added in v2.0.6
func (c *Client) LinkPhone(ctx context.Context, req *authnv2.LinkPhoneRequest) (*authnv2.LinkLoginIdentityResponse, error)
LinkPhone 绑定手机号登录身份。
func (*Client) LinkWechatMiniProgram ¶ added in v2.0.6
func (c *Client) LinkWechatMiniProgram(ctx context.Context, req *authnv2.LinkWechatMiniProgramRequest) (*authnv2.LinkLoginIdentityResponse, error)
LinkWechatMiniProgram 绑定微信小程序登录身份。
func (*Client) LinkWecom ¶ added in v2.0.6
func (c *Client) LinkWecom(ctx context.Context, req *authnv2.LinkWecomRequest) (*authnv2.LinkLoginIdentityResponse, error)
LinkWecom 绑定企业微信登录身份。
func (*Client) ListLoginIdentities ¶ added in v2.0.6
func (c *Client) ListLoginIdentities(ctx context.Context, req *authnv2.ListLoginIdentitiesRequest) (*authnv2.ListLoginIdentitiesResponse, error)
ListLoginIdentities 列出已绑定登录身份。
func (*Client) Login ¶ added in v2.0.2
func (c *Client) Login(ctx context.Context, req *authnv2.LoginRequest) (*authnv2.LoginResponse, error)
Login 使用 v2 explicit auth_method + method_payload 契约登录。
func (*Client) LoginIdentityRaw ¶ added in v2.0.6
func (c *Client) LoginIdentityRaw() authnv2.LoginIdentityServiceClient
LoginIdentityRaw 返回原始 login identity gRPC 客户端。
func (*Client) RefreshToken ¶
func (c *Client) RefreshToken(ctx context.Context, req *authnv2.RefreshTokenRequest) (*authnv2.RefreshTokenResponse, error)
RefreshToken 使用 Refresh Token 刷新获取新的 Access Token。
func (*Client) RevokeRefreshToken ¶
func (c *Client) RevokeRefreshToken(ctx context.Context, req *authnv2.RevokeRefreshTokenRequest) (*authnv2.RevokeRefreshTokenResponse, error)
RevokeRefreshToken 撤销 Refresh Token。
func (*Client) RevokeToken ¶
func (c *Client) RevokeToken(ctx context.Context, req *authnv2.RevokeTokenRequest) (*authnv2.RevokeTokenResponse, error)
RevokeToken 撤销 Access Token。
func (*Client) SendLoginPhoneOTP ¶ added in v2.0.6
func (c *Client) SendLoginPhoneOTP(ctx context.Context, req *authnv2.SendLoginPhoneOTPRequest) (*authnv2.MessageResponse, error)
SendLoginPhoneOTP 发送手机号登录验证码。
func (*Client) SendPhoneLinkChallenge ¶ added in v2.0.6
func (c *Client) SendPhoneLinkChallenge(ctx context.Context, req *authnv2.SendPhoneLinkChallengeRequest) (*authnv2.MessageResponse, error)
SendPhoneLinkChallenge 发送手机号绑定验证码。
func (*Client) SignUpWithWechatMiniProgram ¶ added in v2.0.6
func (c *Client) SignUpWithWechatMiniProgram(ctx context.Context, req *authnv2.SignUpWithWechatMiniProgramRequest) (*authnv2.SignupResult, error)
SignUpWithWechatMiniProgram 通过微信小程序开通 User + LoginIdentity。
func (*Client) SignupRaw ¶ added in v2.0.6
func (c *Client) SignupRaw() authnv2.AuthSignupServiceClient
SignupRaw 返回原始 signup gRPC 客户端。
func (*Client) UnlinkLoginIdentity ¶ added in v2.0.6
func (c *Client) UnlinkLoginIdentity(ctx context.Context, req *authnv2.UnlinkLoginIdentityRequest) (*authnv2.MessageResponse, error)
UnlinkLoginIdentity 解绑登录身份。
func (*Client) VerifyToken ¶
func (c *Client) VerifyToken(ctx context.Context, req *authnv2.VerifyTokenRequest) (*authnv2.VerifyTokenResponse, error)
VerifyToken 在线验证 Access Token。