Documentation ¶
Index ¶
- Variables
- func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer)
- type AuthClient
- type AuthRequest
- func (*AuthRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AuthRequest) GetClientId() string
- func (x *AuthRequest) GetRedirectUri() string
- func (x *AuthRequest) GetResponseType() string
- func (x *AuthRequest) GetScope() string
- func (*AuthRequest) ProtoMessage()
- func (x *AuthRequest) ProtoReflect() protoreflect.Message
- func (x *AuthRequest) Reset()
- func (x *AuthRequest) String() string
- type AuthResponse
- type AuthServer
- type GetTokenRequest
- func (*GetTokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetTokenRequest) GetClientId() string
- func (x *GetTokenRequest) GetClientSecret() string
- func (x *GetTokenRequest) GetCode() string
- func (x *GetTokenRequest) GetGrantType() string
- func (x *GetTokenRequest) GetRedirectUri() string
- func (x *GetTokenRequest) GetRefreshToken() string
- func (*GetTokenRequest) ProtoMessage()
- func (x *GetTokenRequest) ProtoReflect() protoreflect.Message
- func (x *GetTokenRequest) Reset()
- func (x *GetTokenRequest) String() string
- type GetTokenResponse
- type TokenInfo
- func (*TokenInfo) Descriptor() ([]byte, []int)deprecated
- func (x *TokenInfo) GetAccessToken() string
- func (x *TokenInfo) GetExpiresIn() int64
- func (x *TokenInfo) GetInfo() map[string]string
- func (x *TokenInfo) GetRefreshToken() string
- func (x *TokenInfo) GetScope() string
- func (x *TokenInfo) GetTokenType() string
- func (x *TokenInfo) GetUid() string
- func (*TokenInfo) ProtoMessage()
- func (x *TokenInfo) ProtoReflect() protoreflect.Message
- func (x *TokenInfo) Reset()
- func (x *TokenInfo) String() string
- type UnimplementedAuthServer
- type UnsafeAuthServer
Constants ¶
This section is empty.
Variables ¶
var Auth_ServiceDesc = grpc.ServiceDesc{ ServiceName: "auth.v1.Auth", HandlerType: (*AuthServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Auth", Handler: _Auth_Auth_Handler, }, { MethodName: "GetToken", Handler: _Auth_GetToken_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "auth/auth.proto", }
Auth_ServiceDesc is the grpc.ServiceDesc for Auth service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_auth_auth_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAuthServer ¶
func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer)
Types ¶
type AuthClient ¶
type AuthClient interface { Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error) GetToken(ctx context.Context, in *GetTokenRequest, opts ...grpc.CallOption) (*GetTokenResponse, error) }
AuthClient is the client API for Auth service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewAuthClient ¶
func NewAuthClient(cc grpc.ClientConnInterface) AuthClient
type AuthRequest ¶
type AuthRequest struct { ResponseType string `protobuf:"bytes,1,opt,name=response_type,json=responseType,proto3" json:"response_type,omitempty"` // 枚举值 code 表示要求返回授权码 ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // 客户端唯一id RedirectUri string `protobuf:"bytes,3,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` //下一步要跳转的网站, 请求者指定的网站 追加 code=AUTHORIZATION_CODE query 参数 Scope string `protobuf:"bytes,4,opt,name=scope,proto3" json:"scope,omitempty"` // 表示授权范围 // contains filtered or unexported fields }
func (*AuthRequest) Descriptor
deprecated
func (*AuthRequest) Descriptor() ([]byte, []int)
Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.
func (*AuthRequest) GetClientId ¶
func (x *AuthRequest) GetClientId() string
func (*AuthRequest) GetRedirectUri ¶
func (x *AuthRequest) GetRedirectUri() string
func (*AuthRequest) GetResponseType ¶
func (x *AuthRequest) GetResponseType() string
func (*AuthRequest) GetScope ¶
func (x *AuthRequest) GetScope() string
func (*AuthRequest) ProtoMessage ¶
func (*AuthRequest) ProtoMessage()
func (*AuthRequest) ProtoReflect ¶
func (x *AuthRequest) ProtoReflect() protoreflect.Message
func (*AuthRequest) Reset ¶
func (x *AuthRequest) Reset()
func (*AuthRequest) String ¶
func (x *AuthRequest) String() string
type AuthResponse ¶
type AuthResponse struct {
// contains filtered or unexported fields
}
func (*AuthResponse) Descriptor
deprecated
func (*AuthResponse) Descriptor() ([]byte, []int)
Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead.
func (*AuthResponse) ProtoMessage ¶
func (*AuthResponse) ProtoMessage()
func (*AuthResponse) ProtoReflect ¶
func (x *AuthResponse) ProtoReflect() protoreflect.Message
func (*AuthResponse) Reset ¶
func (x *AuthResponse) Reset()
func (*AuthResponse) String ¶
func (x *AuthResponse) String() string
type AuthServer ¶
type AuthServer interface { Auth(context.Context, *AuthRequest) (*AuthResponse, error) GetToken(context.Context, *GetTokenRequest) (*GetTokenResponse, error) // contains filtered or unexported methods }
AuthServer is the server API for Auth service. All implementations must embed UnimplementedAuthServer for forward compatibility
type GetTokenRequest ¶
type GetTokenRequest struct { ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` ClientSecret string `protobuf:"bytes,2,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"` // client_id 和 client_secret 是单个应用 唯一id GrantType string `protobuf:"bytes,3,opt,name=grant_type,json=grantType,proto3" json:"grant_type,omitempty"` // authorization_code 表示使用授权码方式 换取token, 和 refresh_token 用于刷新token Code string `protobuf:"bytes,4,opt,name=code,proto3" json:"code,omitempty"` // 授权码 RedirectUri string `protobuf:"bytes,5,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` // 成功, 会让此uri 追加 一段json RefreshToken string `protobuf:"bytes,6,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` // 用于从此token, 拿到新的 token // contains filtered or unexported fields }
func (*GetTokenRequest) Descriptor
deprecated
func (*GetTokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetTokenRequest.ProtoReflect.Descriptor instead.
func (*GetTokenRequest) GetClientId ¶
func (x *GetTokenRequest) GetClientId() string
func (*GetTokenRequest) GetClientSecret ¶
func (x *GetTokenRequest) GetClientSecret() string
func (*GetTokenRequest) GetCode ¶
func (x *GetTokenRequest) GetCode() string
func (*GetTokenRequest) GetGrantType ¶
func (x *GetTokenRequest) GetGrantType() string
func (*GetTokenRequest) GetRedirectUri ¶
func (x *GetTokenRequest) GetRedirectUri() string
func (*GetTokenRequest) GetRefreshToken ¶
func (x *GetTokenRequest) GetRefreshToken() string
func (*GetTokenRequest) ProtoMessage ¶
func (*GetTokenRequest) ProtoMessage()
func (*GetTokenRequest) ProtoReflect ¶
func (x *GetTokenRequest) ProtoReflect() protoreflect.Message
func (*GetTokenRequest) Reset ¶
func (x *GetTokenRequest) Reset()
func (*GetTokenRequest) String ¶
func (x *GetTokenRequest) String() string
type GetTokenResponse ¶
type GetTokenResponse struct {
// contains filtered or unexported fields
}
func (*GetTokenResponse) Descriptor
deprecated
func (*GetTokenResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetTokenResponse.ProtoReflect.Descriptor instead.
func (*GetTokenResponse) ProtoMessage ¶
func (*GetTokenResponse) ProtoMessage()
func (*GetTokenResponse) ProtoReflect ¶
func (x *GetTokenResponse) ProtoReflect() protoreflect.Message
func (*GetTokenResponse) Reset ¶
func (x *GetTokenResponse) Reset()
func (*GetTokenResponse) String ¶
func (x *GetTokenResponse) String() string
type TokenInfo ¶
type TokenInfo struct { AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` // 每个api 请求都放在请求头 Authorization: Bearer {access_token} TokenType string `protobuf:"bytes,2,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"` // bearer类型的token(只签名, 需要加密配置tls使用) 和mac 类型的token(应对不安全的网络http协议, 相比bearer 还需要时间戳, nonce, 客户度mac信息) ExpiresIn int64 `protobuf:"varint,3,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"` RefreshToken string `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` Scope string `protobuf:"bytes,5,opt,name=scope,proto3" json:"scope,omitempty"` Uid string `protobuf:"bytes,6,opt,name=uid,proto3" json:"uid,omitempty"` // 需要这个? Info map[string]string `` /* 149-byte string literal not displayed */ // contains filtered or unexported fields }
func (*TokenInfo) Descriptor
deprecated
func (*TokenInfo) GetAccessToken ¶
func (*TokenInfo) GetExpiresIn ¶
func (*TokenInfo) GetRefreshToken ¶
func (*TokenInfo) GetTokenType ¶
func (*TokenInfo) ProtoMessage ¶
func (*TokenInfo) ProtoMessage()
func (*TokenInfo) ProtoReflect ¶
func (x *TokenInfo) ProtoReflect() protoreflect.Message
type UnimplementedAuthServer ¶
type UnimplementedAuthServer struct { }
UnimplementedAuthServer must be embedded to have forward compatible implementations.
func (UnimplementedAuthServer) Auth ¶
func (UnimplementedAuthServer) Auth(context.Context, *AuthRequest) (*AuthResponse, error)
func (UnimplementedAuthServer) GetToken ¶
func (UnimplementedAuthServer) GetToken(context.Context, *GetTokenRequest) (*GetTokenResponse, error)
type UnsafeAuthServer ¶
type UnsafeAuthServer interface {
// contains filtered or unexported methods
}
UnsafeAuthServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthServer will result in compilation errors.