Documentation ¶
Index ¶
- Constants
- Variables
- func GetTokenFromHTTPHeader(r *http.Request) string
- func MakeBearer(lenth int) string
- func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
- type BLOCK_TYPE
- func (BLOCK_TYPE) Descriptor() protoreflect.EnumDescriptor
- func (x BLOCK_TYPE) Enum() *BLOCK_TYPE
- func (BLOCK_TYPE) EnumDescriptor() ([]byte, []int)deprecated
- func (t BLOCK_TYPE) Equal(target BLOCK_TYPE) bool
- func (t BLOCK_TYPE) IsIn(targets ...BLOCK_TYPE) bool
- func (t BLOCK_TYPE) MarshalJSON() ([]byte, error)
- func (x BLOCK_TYPE) Number() protoreflect.EnumNumber
- func (x BLOCK_TYPE) String() string
- func (BLOCK_TYPE) Type() protoreflect.EnumType
- func (t *BLOCK_TYPE) UnmarshalJSON(b []byte) error
- type ChangeNamespaceRequest
- func (*ChangeNamespaceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ChangeNamespaceRequest) GetNamespace() string
- func (x *ChangeNamespaceRequest) GetToken() string
- func (*ChangeNamespaceRequest) ProtoMessage()
- func (x *ChangeNamespaceRequest) ProtoReflect() protoreflect.Message
- func (x *ChangeNamespaceRequest) Reset()
- func (x *ChangeNamespaceRequest) String() string
- type GRANT_TYPE
- func (GRANT_TYPE) Descriptor() protoreflect.EnumDescriptor
- func (x GRANT_TYPE) Enum() *GRANT_TYPE
- func (GRANT_TYPE) EnumDescriptor() ([]byte, []int)deprecated
- func (t GRANT_TYPE) Equal(target GRANT_TYPE) bool
- func (t GRANT_TYPE) IsIn(targets ...GRANT_TYPE) bool
- func (t GRANT_TYPE) MarshalJSON() ([]byte, error)
- func (x GRANT_TYPE) Number() protoreflect.EnumNumber
- func (x GRANT_TYPE) String() string
- func (GRANT_TYPE) Type() protoreflect.EnumType
- func (t *GRANT_TYPE) UnmarshalJSON(b []byte) error
- type IPLocation
- func (*IPLocation) Descriptor() ([]byte, []int)deprecated
- func (x *IPLocation) GetCity() string
- func (x *IPLocation) GetCityId() int64
- func (x *IPLocation) GetCountry() string
- func (x *IPLocation) GetIsp() string
- func (x *IPLocation) GetProvince() string
- func (x *IPLocation) GetRegion() string
- func (x *IPLocation) GetRemoteIp() string
- func (*IPLocation) ProtoMessage()
- func (x *IPLocation) ProtoReflect() protoreflect.Message
- func (x *IPLocation) Reset()
- func (x *IPLocation) String() string
- type IssueTokenRequest
- func (*IssueTokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *IssueTokenRequest) GetAccessToken() string
- func (x *IssueTokenRequest) GetAuthCode() string
- func (x *IssueTokenRequest) GetDescription() string
- func (x *IssueTokenRequest) GetDryRun() bool
- func (x *IssueTokenRequest) GetExpiredAt() int64
- func (x *IssueTokenRequest) GetGrantType() GRANT_TYPE
- func (x *IssueTokenRequest) GetLocation() *Location
- func (x *IssueTokenRequest) GetNamespace() string
- func (x *IssueTokenRequest) GetPassword() string
- func (x *IssueTokenRequest) GetRefreshToken() string
- func (x *IssueTokenRequest) GetScope() string
- func (x *IssueTokenRequest) GetState() string
- func (x *IssueTokenRequest) GetType() TOKEN_TYPE
- func (x *IssueTokenRequest) GetUsername() string
- func (x *IssueTokenRequest) GetVerifyCode() string
- func (*IssueTokenRequest) ProtoMessage()
- func (x *IssueTokenRequest) ProtoReflect() protoreflect.Message
- func (x *IssueTokenRequest) Reset()
- func (x *IssueTokenRequest) String() string
- type Location
- type PLATFORM
- func (PLATFORM) Descriptor() protoreflect.EnumDescriptor
- func (x PLATFORM) Enum() *PLATFORM
- func (PLATFORM) EnumDescriptor() ([]byte, []int)deprecated
- func (t PLATFORM) Equal(target PLATFORM) bool
- func (t PLATFORM) IsIn(targets ...PLATFORM) bool
- func (t PLATFORM) MarshalJSON() ([]byte, error)
- func (x PLATFORM) Number() protoreflect.EnumNumber
- func (x PLATFORM) String() string
- func (PLATFORM) Type() protoreflect.EnumType
- func (t *PLATFORM) UnmarshalJSON(b []byte) error
- type QueryTokenRequest
- func (*QueryTokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryTokenRequest) GetAccessToken() string
- func (x *QueryTokenRequest) GetBlockType() BLOCK_TYPE
- func (x *QueryTokenRequest) GetDescription() string
- func (x *QueryTokenRequest) GetDomain() string
- func (x *QueryTokenRequest) GetGrantType() GRANT_TYPE
- func (x *QueryTokenRequest) GetIsBlock() bool
- func (x *QueryTokenRequest) GetNamespace() string
- func (x *QueryTokenRequest) GetPage() *request.PageRequest
- func (x *QueryTokenRequest) GetPlatform() PLATFORM
- func (x *QueryTokenRequest) GetRefreshToken() string
- func (x *QueryTokenRequest) GetType() TOKEN_TYPE
- func (x *QueryTokenRequest) GetUserId() string
- func (x *QueryTokenRequest) GetUserType() user.TYPE
- func (x *QueryTokenRequest) GetUsername() string
- func (*QueryTokenRequest) ProtoMessage()
- func (x *QueryTokenRequest) ProtoReflect() protoreflect.Message
- func (x *QueryTokenRequest) Reset()
- func (x *QueryTokenRequest) String() string
- type RPCClient
- type RPCServer
- type RevolkTokenRequest
- func (*RevolkTokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RevolkTokenRequest) GetAccessToken() string
- func (x *RevolkTokenRequest) GetRefreshToken() string
- func (*RevolkTokenRequest) ProtoMessage()
- func (x *RevolkTokenRequest) ProtoReflect() protoreflect.Message
- func (x *RevolkTokenRequest) Reset()
- func (x *RevolkTokenRequest) String() string
- type Service
- type Status
- func (*Status) Descriptor() ([]byte, []int)deprecated
- func (x *Status) GetBlockAt() int64
- func (x *Status) GetBlockReason() string
- func (x *Status) GetBlockType() BLOCK_TYPE
- func (x *Status) GetIsBlock() bool
- func (*Status) ProtoMessage()
- func (x *Status) ProtoReflect() protoreflect.Message
- func (x *Status) Reset()
- func (x *Status) String() string
- type TOKEN_TYPE
- func (TOKEN_TYPE) Descriptor() protoreflect.EnumDescriptor
- func (x TOKEN_TYPE) Enum() *TOKEN_TYPE
- func (TOKEN_TYPE) EnumDescriptor() ([]byte, []int)deprecated
- func (t TOKEN_TYPE) Equal(target TOKEN_TYPE) bool
- func (t TOKEN_TYPE) IsIn(targets ...TOKEN_TYPE) bool
- func (t TOKEN_TYPE) MarshalJSON() ([]byte, error)
- func (x TOKEN_TYPE) Number() protoreflect.EnumNumber
- func (x TOKEN_TYPE) String() string
- func (TOKEN_TYPE) Type() protoreflect.EnumType
- func (t *TOKEN_TYPE) UnmarshalJSON(b []byte) error
- type Token
- func (*Token) Descriptor() ([]byte, []int)deprecated
- func (x *Token) GetAccessExpiredAt() int64
- func (x *Token) GetAccessToken() string
- func (x *Token) GetAvailableNamespace() []string
- func (x *Token) GetDescription() string
- func (x *Token) GetDomain() string
- func (x *Token) GetGrantType() GRANT_TYPE
- func (x *Token) GetIssueAt() int64
- func (x *Token) GetLocation() *Location
- func (x *Token) GetNamespace() string
- func (x *Token) GetPlatform() PLATFORM
- func (x *Token) GetRefreshExpiredAt() int64
- func (x *Token) GetRefreshToken() string
- func (x *Token) GetScope() string
- func (x *Token) GetStatus() *Status
- func (x *Token) GetType() TOKEN_TYPE
- func (x *Token) GetUserId() string
- func (x *Token) GetUserType() user.TYPE
- func (x *Token) GetUsername() string
- func (t *Token) IsAccessTokenExpired() bool
- func (*Token) ProtoMessage()
- func (x *Token) ProtoReflect() protoreflect.Message
- func (x *Token) Reset()
- func (x *Token) String() string
- type TokenSet
- type UnimplementedRPCServer
- type UnsafeRPCServer
- type UserAgent
- func (*UserAgent) Descriptor() ([]byte, []int)deprecated
- func (x *UserAgent) GetBrowserName() string
- func (x *UserAgent) GetBrowserVersion() string
- func (x *UserAgent) GetEngineName() string
- func (x *UserAgent) GetEngineVersion() string
- func (x *UserAgent) GetOs() string
- func (x *UserAgent) GetPlatform() string
- func (*UserAgent) ProtoMessage()
- func (x *UserAgent) ProtoReflect() protoreflect.Message
- func (x *UserAgent) Reset()
- func (x *UserAgent) String() string
- type ValidateTokenRequest
- func (*ValidateTokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ValidateTokenRequest) GetAccessToken() string
- func (*ValidateTokenRequest) ProtoMessage()
- func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message
- func (x *ValidateTokenRequest) Reset()
- func (x *ValidateTokenRequest) String() string
Constants ¶
const ( ACCESS_TOKEN_HEADER_KEY = "Authorization" VALIDATE_TOKEN_HEADER_KEY = "X-VALIDATE-TOKEN" )
const (
AppName = "token"
)
Variables ¶
var ( PLATFORM_name = map[int32]string{ 0: "WEB", 1: "API", } PLATFORM_value = map[string]int32{ "WEB": 0, "API": 1, } )
Enum value maps for PLATFORM.
var ( GRANT_TYPE_name = map[int32]string{ 0: "PASSWORD", 1: "LDAP", 2: "REFRESH", 3: "PRIVATE_TOKEN", 4: "CLIENT", 5: "AUTH_CODE", 6: "IMPLICIT", 7: "WECHAT_WORK", } GRANT_TYPE_value = map[string]int32{ "PASSWORD": 0, "LDAP": 1, "REFRESH": 2, "PRIVATE_TOKEN": 3, "CLIENT": 4, "AUTH_CODE": 5, "IMPLICIT": 6, "WECHAT_WORK": 7, } )
Enum value maps for GRANT_TYPE.
var ( TOKEN_TYPE_name = map[int32]string{ 0: "BEARER", 1: "MAC", 2: "JWT", } TOKEN_TYPE_value = map[string]int32{ "BEARER": 0, "MAC": 1, "JWT": 2, } )
Enum value maps for TOKEN_TYPE.
var ( BLOCK_TYPE_name = map[int32]string{ 0: "REFRESH_TOKEN_EXPIRED", 1: "OTHER_PLACE_LOGGED_IN", 2: "OTHER_IP_LOGGED_IN", } BLOCK_TYPE_value = map[string]int32{ "REFRESH_TOKEN_EXPIRED": 0, "OTHER_PLACE_LOGGED_IN": 1, "OTHER_IP_LOGGED_IN": 2, } )
Enum value maps for BLOCK_TYPE.
var File_apps_token_pb_rpc_proto protoreflect.FileDescriptor
var File_apps_token_pb_token_proto protoreflect.FileDescriptor
var RPC_ServiceDesc = grpc.ServiceDesc{ ServiceName: "devcloud.mcenter.token.RPC", HandlerType: (*RPCServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ValidateToken", Handler: _RPC_ValidateToken_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/token/pb/rpc.proto", }
RPC_ServiceDesc is the grpc.ServiceDesc for RPC service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func GetTokenFromHTTPHeader ¶
Authorization xxxxxxx
func MakeBearer ¶
MakeBearer https://tools.ietf.org/html/rfc6750#section-2.1 b64token = 1*( ALPHA / DIGIT /"-" / "." / "_" / "~" / "+" / "/" ) *"="
func RegisterRPCServer ¶
func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
Types ¶
type BLOCK_TYPE ¶
type BLOCK_TYPE int32
冻结类型
const ( // 刷新Token过期, 回话中断 BLOCK_TYPE_REFRESH_TOKEN_EXPIRED BLOCK_TYPE = 0 // 异地登陆 BLOCK_TYPE_OTHER_PLACE_LOGGED_IN BLOCK_TYPE = 1 // 异常Ip登陆 BLOCK_TYPE_OTHER_IP_LOGGED_IN BLOCK_TYPE = 2 )
func ParseBLOCK_TYPEFromString ¶
func ParseBLOCK_TYPEFromString(str string) (BLOCK_TYPE, error)
ParseBLOCK_TYPEFromString Parse BLOCK_TYPE from string
func (BLOCK_TYPE) Descriptor ¶
func (BLOCK_TYPE) Descriptor() protoreflect.EnumDescriptor
func (BLOCK_TYPE) Enum ¶
func (x BLOCK_TYPE) Enum() *BLOCK_TYPE
func (BLOCK_TYPE) EnumDescriptor
deprecated
func (BLOCK_TYPE) EnumDescriptor() ([]byte, []int)
Deprecated: Use BLOCK_TYPE.Descriptor instead.
func (BLOCK_TYPE) Number ¶
func (x BLOCK_TYPE) Number() protoreflect.EnumNumber
func (BLOCK_TYPE) String ¶
func (x BLOCK_TYPE) String() string
func (BLOCK_TYPE) Type ¶
func (BLOCK_TYPE) Type() protoreflect.EnumType
func (*BLOCK_TYPE) UnmarshalJSON ¶
func (t *BLOCK_TYPE) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type ChangeNamespaceRequest ¶
type ChangeNamespaceRequest struct { // 需要切换空间令牌 // @gotags: json:"token" validate:"required" Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token" validate:"required"` // 空间名称 // @gotags: json:"namespace" validate:"required" Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" validate:"required"` // contains filtered or unexported fields }
func (*ChangeNamespaceRequest) Descriptor
deprecated
func (*ChangeNamespaceRequest) Descriptor() ([]byte, []int)
Deprecated: Use ChangeNamespaceRequest.ProtoReflect.Descriptor instead.
func (*ChangeNamespaceRequest) GetNamespace ¶
func (x *ChangeNamespaceRequest) GetNamespace() string
func (*ChangeNamespaceRequest) GetToken ¶
func (x *ChangeNamespaceRequest) GetToken() string
func (*ChangeNamespaceRequest) ProtoMessage ¶
func (*ChangeNamespaceRequest) ProtoMessage()
func (*ChangeNamespaceRequest) ProtoReflect ¶
func (x *ChangeNamespaceRequest) ProtoReflect() protoreflect.Message
func (*ChangeNamespaceRequest) Reset ¶
func (x *ChangeNamespaceRequest) Reset()
func (*ChangeNamespaceRequest) String ¶
func (x *ChangeNamespaceRequest) String() string
type GRANT_TYPE ¶
type GRANT_TYPE int32
授权类型
const ( // 用户密码授权 GRANT_TYPE_PASSWORD GRANT_TYPE = 0 // LDAP授权 GRANT_TYPE_LDAP GRANT_TYPE = 1 // 刷新授权 GRANT_TYPE_REFRESH GRANT_TYPE = 2 // 私有令牌, 用于编程使用 GRANT_TYPE_PRIVATE_TOKEN GRANT_TYPE = 3 // 客户端授权 GRANT_TYPE_CLIENT GRANT_TYPE = 4 // Oauth2.0 Auth Code授权 GRANT_TYPE_AUTH_CODE GRANT_TYPE = 5 // 隐式授权 GRANT_TYPE_IMPLICIT GRANT_TYPE = 6 // 微信授权 GRANT_TYPE_WECHAT_WORK GRANT_TYPE = 7 )
func ParseGRANT_TYPEFromString ¶
func ParseGRANT_TYPEFromString(str string) (GRANT_TYPE, error)
ParseGRANT_TYPEFromString Parse GRANT_TYPE from string
func (GRANT_TYPE) Descriptor ¶
func (GRANT_TYPE) Descriptor() protoreflect.EnumDescriptor
func (GRANT_TYPE) Enum ¶
func (x GRANT_TYPE) Enum() *GRANT_TYPE
func (GRANT_TYPE) EnumDescriptor
deprecated
func (GRANT_TYPE) EnumDescriptor() ([]byte, []int)
Deprecated: Use GRANT_TYPE.Descriptor instead.
func (GRANT_TYPE) Number ¶
func (x GRANT_TYPE) Number() protoreflect.EnumNumber
func (GRANT_TYPE) String ¶
func (x GRANT_TYPE) String() string
func (GRANT_TYPE) Type ¶
func (GRANT_TYPE) Type() protoreflect.EnumType
func (*GRANT_TYPE) UnmarshalJSON ¶
func (t *GRANT_TYPE) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type IPLocation ¶
type IPLocation struct { // 令牌申请者IP地址 // @gotags: bson:"remote_ip" json:"remote_ip" RemoteIp string `protobuf:"bytes,1,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip" bson:"remote_ip"` // 城市编号 // @gotags: bson:"city_id" json:"city_id" CityId int64 `protobuf:"varint,2,opt,name=city_id,json=cityId,proto3" json:"city_id" bson:"city_id"` // 国家 // @gotags: bson:"country" json:"country" Country string `protobuf:"bytes,3,opt,name=country,proto3" json:"country" bson:"country"` // 地区 // @gotags: bson:"region" json:"region" Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region" bson:"region"` // 省 // @gotags: bson:"province" json:"province" Province string `protobuf:"bytes,5,opt,name=province,proto3" json:"province" bson:"province"` // 城 // @gotags: bson:"city" json:"city" City string `protobuf:"bytes,6,opt,name=city,proto3" json:"city" bson:"city"` // 服务商 // @gotags: bson:"isp" json:"isp" Isp string `protobuf:"bytes,7,opt,name=isp,proto3" json:"isp" bson:"isp"` // contains filtered or unexported fields }
IPLocation 客户端地理位置信息
func (*IPLocation) Descriptor
deprecated
func (*IPLocation) Descriptor() ([]byte, []int)
Deprecated: Use IPLocation.ProtoReflect.Descriptor instead.
func (*IPLocation) GetCity ¶
func (x *IPLocation) GetCity() string
func (*IPLocation) GetCityId ¶
func (x *IPLocation) GetCityId() int64
func (*IPLocation) GetCountry ¶
func (x *IPLocation) GetCountry() string
func (*IPLocation) GetIsp ¶
func (x *IPLocation) GetIsp() string
func (*IPLocation) GetProvince ¶
func (x *IPLocation) GetProvince() string
func (*IPLocation) GetRegion ¶
func (x *IPLocation) GetRegion() string
func (*IPLocation) GetRemoteIp ¶
func (x *IPLocation) GetRemoteIp() string
func (*IPLocation) ProtoMessage ¶
func (*IPLocation) ProtoMessage()
func (*IPLocation) ProtoReflect ¶
func (x *IPLocation) ProtoReflect() protoreflect.Message
func (*IPLocation) Reset ¶
func (x *IPLocation) Reset()
func (*IPLocation) String ¶
func (x *IPLocation) String() string
type IssueTokenRequest ¶
type IssueTokenRequest struct { // 测试颁发, 不会持久化 // @gotags: json:"dry_run" DryRun bool `protobuf:"varint,15,opt,name=dry_run,json=dryRun,proto3" json:"dry_run"` // 授权类型 // @gotags: json:"grant_type" GrantType GRANT_TYPE `protobuf:"varint,1,opt,name=grant_type,json=grantType,proto3,enum=devcloud.mcenter.token.GRANT_TYPE" json:"grant_type"` // 令牌类型 // @gotags: json:"type" Type TOKEN_TYPE `protobuf:"varint,2,opt,name=type,proto3,enum=devcloud.mcenter.token.TOKEN_TYPE" json:"type"` // 令牌过期时间 // @gotags: json:"expired_at" ExpiredAt int64 `protobuf:"varint,3,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at"` // 令牌访问空间 // @gotags: json:"namespace" Namespace string `protobuf:"bytes,4,opt,name=namespace,proto3" json:"namespace"` // 空间内的过滤条件, 格式key=value // @gotags: json:"scope,omitempty" Scope string `protobuf:"bytes,5,opt,name=scope,proto3" json:"scope,omitempty"` // PASSWORD授权时, 用户名 // @gotags: json:"username,omitempty" Username string `protobuf:"bytes,6,opt,name=username,proto3" json:"username,omitempty"` // PASSWORD授权时, 用户密码 // @gotags: json:"password,omitempty" Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"` // REFRESH授权时, 刷新令牌 // @gotags: json:"refresh_token,omitempty" RefreshToken string `protobuf:"bytes,8,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` // PRIVATE_TOKEN授权时, 访问令牌 // @gotags: json:"access_token,omitempty" AccessToken string `protobuf:"bytes,9,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` // PRIVATE_TOKEN授权时, 描述信息 // @gotags: json:"description" Description string `protobuf:"bytes,10,opt,name=description,proto3" json:"description"` // AUTH_CODE授权时, Code // @gotags: json:"auth_code" AuthCode string `protobuf:"bytes,11,opt,name=auth_code,json=authCode,proto3" json:"auth_code"` // AUTH_CODE授权时, State // @gotags: json:"state" State string `protobuf:"bytes,12,opt,name=state,proto3" json:"state"` // 二次认证时验证码 // @gotags: json:"verify_code" VerifyCode string `protobuf:"bytes,13,opt,name=verify_code,json=verifyCode,proto3" json:"verify_code"` // 令牌办法给客户端信息 // @gotags: json:"location,omitempty" Location *Location `protobuf:"bytes,14,opt,name=location,proto3" json:"location,omitempty"` // contains filtered or unexported fields }
func NewIssueTokenRequest ¶
func NewIssueTokenRequest() *IssueTokenRequest
NewIssueTokenRequest 默认请求
func (*IssueTokenRequest) Descriptor
deprecated
func (*IssueTokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use IssueTokenRequest.ProtoReflect.Descriptor instead.
func (*IssueTokenRequest) GetAccessToken ¶
func (x *IssueTokenRequest) GetAccessToken() string
func (*IssueTokenRequest) GetAuthCode ¶
func (x *IssueTokenRequest) GetAuthCode() string
func (*IssueTokenRequest) GetDescription ¶
func (x *IssueTokenRequest) GetDescription() string
func (*IssueTokenRequest) GetDryRun ¶
func (x *IssueTokenRequest) GetDryRun() bool
func (*IssueTokenRequest) GetExpiredAt ¶
func (x *IssueTokenRequest) GetExpiredAt() int64
func (*IssueTokenRequest) GetGrantType ¶
func (x *IssueTokenRequest) GetGrantType() GRANT_TYPE
func (*IssueTokenRequest) GetLocation ¶
func (x *IssueTokenRequest) GetLocation() *Location
func (*IssueTokenRequest) GetNamespace ¶
func (x *IssueTokenRequest) GetNamespace() string
func (*IssueTokenRequest) GetPassword ¶
func (x *IssueTokenRequest) GetPassword() string
func (*IssueTokenRequest) GetRefreshToken ¶
func (x *IssueTokenRequest) GetRefreshToken() string
func (*IssueTokenRequest) GetScope ¶
func (x *IssueTokenRequest) GetScope() string
func (*IssueTokenRequest) GetState ¶
func (x *IssueTokenRequest) GetState() string
func (*IssueTokenRequest) GetType ¶
func (x *IssueTokenRequest) GetType() TOKEN_TYPE
func (*IssueTokenRequest) GetUsername ¶
func (x *IssueTokenRequest) GetUsername() string
func (*IssueTokenRequest) GetVerifyCode ¶
func (x *IssueTokenRequest) GetVerifyCode() string
func (*IssueTokenRequest) ProtoMessage ¶
func (*IssueTokenRequest) ProtoMessage()
func (*IssueTokenRequest) ProtoReflect ¶
func (x *IssueTokenRequest) ProtoReflect() protoreflect.Message
func (*IssueTokenRequest) Reset ¶
func (x *IssueTokenRequest) Reset()
func (*IssueTokenRequest) String ¶
func (x *IssueTokenRequest) String() string
type Location ¶
type Location struct { // 令牌申请者IP地址 // @gotags: bson:"ip_location" json:"ip_location" IpLocation *IPLocation `protobuf:"bytes,1,opt,name=ip_location,json=ipLocation,proto3" json:"ip_location" bson:"ip_location"` // 令牌申请者UA // @gotags: bson:"user_agent" json:"user_agent" UserAgent *UserAgent `protobuf:"bytes,2,opt,name=user_agent,json=userAgent,proto3" json:"user_agent" bson:"user_agent"` // contains filtered or unexported fields }
func NewLocation ¶
func NewLocation() *Location
func (*Location) Descriptor
deprecated
func (*Location) GetIpLocation ¶
func (x *Location) GetIpLocation() *IPLocation
func (*Location) GetUserAgent ¶
func (*Location) ProtoMessage ¶
func (*Location) ProtoMessage()
func (*Location) ProtoReflect ¶
func (x *Location) ProtoReflect() protoreflect.Message
type PLATFORM ¶
type PLATFORM int32
func ParsePLATFORMFromString ¶
ParsePLATFORMFromString Parse PLATFORM from string
func (PLATFORM) Descriptor ¶
func (PLATFORM) Descriptor() protoreflect.EnumDescriptor
func (PLATFORM) EnumDescriptor
deprecated
func (PLATFORM) Number ¶
func (x PLATFORM) Number() protoreflect.EnumNumber
func (PLATFORM) Type ¶
func (PLATFORM) Type() protoreflect.EnumType
func (*PLATFORM) UnmarshalJSON ¶
UnmarshalJSON todo
type QueryTokenRequest ¶
type QueryTokenRequest struct { // 分页参数 // @gotags: json:"page" Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"` // 颁发平台, 根据授权方式判断 // @gotags: bson:"platform" json:"platform" Platform *PLATFORM `protobuf:"varint,2,opt,name=platform,proto3,enum=devcloud.mcenter.token.PLATFORM,oneof" json:"platform" bson:"platform"` // 访问令牌 // @gotags: json:"access_token" AccessToken string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token"` // 刷新令牌, 当访问令牌过期时, 可以刷新令牌进行刷新 // @gotags: json:"refresh_token" RefreshToken string `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token"` // 用户类型 // @gotags: json:"user_type" UserType *user.TYPE `protobuf:"varint,5,opt,name=user_type,json=userType,proto3,enum=devcloud.mcenter.user.TYPE,oneof" json:"user_type"` // 用户当前所处域 // @gotags: json:"domain" Domain string `protobuf:"bytes,6,opt,name=domain,proto3" json:"domain"` // 用户名 // @gotags: json:"username" Username string `protobuf:"bytes,7,opt,name=username,proto3" json:"username"` // 用户Id // @gotags: json:"user_id" UserId string `protobuf:"bytes,8,opt,name=user_id,json=userId,proto3" json:"user_id"` // 授权类型 // @gotags: json:"grant_type" GrantType *GRANT_TYPE `protobuf:"varint,9,opt,name=grant_type,json=grantType,proto3,enum=devcloud.mcenter.token.GRANT_TYPE,oneof" json:"grant_type"` // 令牌类型 // @gotags: json:"type" Type *TOKEN_TYPE `protobuf:"varint,10,opt,name=type,proto3,enum=devcloud.mcenter.token.TOKEN_TYPE,oneof" json:"type"` // 当前空间 // @gotags: json:"namespace" Namespace string `protobuf:"bytes,11,opt,name=namespace,proto3" json:"namespace"` // 令牌描述信息, 当授权类型为Private Token时, 做描述使用 // @gotags: json:"description" Description string `protobuf:"bytes,12,opt,name=description,proto3" json:"description"` // 是否冻结 // @gotags: json:"is_block" IsBlock *bool `protobuf:"varint,13,opt,name=is_block,json=isBlock,proto3,oneof" json:"is_block"` // 冻结类型 // @gotags: json:"block_type" BlockType *BLOCK_TYPE `protobuf:"varint,14,opt,name=block_type,json=blockType,proto3,enum=devcloud.mcenter.token.BLOCK_TYPE,oneof" json:"block_type"` // contains filtered or unexported fields }
token查询
func (*QueryTokenRequest) Descriptor
deprecated
func (*QueryTokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryTokenRequest.ProtoReflect.Descriptor instead.
func (*QueryTokenRequest) GetAccessToken ¶
func (x *QueryTokenRequest) GetAccessToken() string
func (*QueryTokenRequest) GetBlockType ¶
func (x *QueryTokenRequest) GetBlockType() BLOCK_TYPE
func (*QueryTokenRequest) GetDescription ¶
func (x *QueryTokenRequest) GetDescription() string
func (*QueryTokenRequest) GetDomain ¶
func (x *QueryTokenRequest) GetDomain() string
func (*QueryTokenRequest) GetGrantType ¶
func (x *QueryTokenRequest) GetGrantType() GRANT_TYPE
func (*QueryTokenRequest) GetIsBlock ¶
func (x *QueryTokenRequest) GetIsBlock() bool
func (*QueryTokenRequest) GetNamespace ¶
func (x *QueryTokenRequest) GetNamespace() string
func (*QueryTokenRequest) GetPage ¶
func (x *QueryTokenRequest) GetPage() *request.PageRequest
func (*QueryTokenRequest) GetPlatform ¶
func (x *QueryTokenRequest) GetPlatform() PLATFORM
func (*QueryTokenRequest) GetRefreshToken ¶
func (x *QueryTokenRequest) GetRefreshToken() string
func (*QueryTokenRequest) GetType ¶
func (x *QueryTokenRequest) GetType() TOKEN_TYPE
func (*QueryTokenRequest) GetUserId ¶
func (x *QueryTokenRequest) GetUserId() string
func (*QueryTokenRequest) GetUserType ¶
func (x *QueryTokenRequest) GetUserType() user.TYPE
func (*QueryTokenRequest) GetUsername ¶
func (x *QueryTokenRequest) GetUsername() string
func (*QueryTokenRequest) ProtoMessage ¶
func (*QueryTokenRequest) ProtoMessage()
func (*QueryTokenRequest) ProtoReflect ¶
func (x *QueryTokenRequest) ProtoReflect() protoreflect.Message
func (*QueryTokenRequest) Reset ¶
func (x *QueryTokenRequest) Reset()
func (*QueryTokenRequest) String ¶
func (x *QueryTokenRequest) String() string
type RPCClient ¶
type RPCClient interface { // 校验Token, Grante Type Password, username:password ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*Token, error) }
RPCClient is the client API for RPC 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 NewRPCClient ¶
func NewRPCClient(cc grpc.ClientConnInterface) RPCClient
type RPCServer ¶
type RPCServer interface { // 校验Token, Grante Type Password, username:password ValidateToken(context.Context, *ValidateTokenRequest) (*Token, error) // contains filtered or unexported methods }
RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility
type RevolkTokenRequest ¶
type RevolkTokenRequest struct { // 令牌 // @gotags: json:"access_token" AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token"` // 刷新令牌 // @gotags: json:"refresh_token" RefreshToken string `protobuf:"bytes,5,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token"` // contains filtered or unexported fields }
func NewRevolkTokenRequest ¶
func NewRevolkTokenRequest() *RevolkTokenRequest
NewRevolkTokenRequest 撤销Token请求
func (*RevolkTokenRequest) Descriptor
deprecated
func (*RevolkTokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use RevolkTokenRequest.ProtoReflect.Descriptor instead.
func (*RevolkTokenRequest) GetAccessToken ¶
func (x *RevolkTokenRequest) GetAccessToken() string
func (*RevolkTokenRequest) GetRefreshToken ¶
func (x *RevolkTokenRequest) GetRefreshToken() string
func (*RevolkTokenRequest) ProtoMessage ¶
func (*RevolkTokenRequest) ProtoMessage()
func (*RevolkTokenRequest) ProtoReflect ¶
func (x *RevolkTokenRequest) ProtoReflect() protoreflect.Message
func (*RevolkTokenRequest) Reset ¶
func (x *RevolkTokenRequest) Reset()
func (*RevolkTokenRequest) String ¶
func (x *RevolkTokenRequest) String() string
type Service ¶
type Service interface { // 颁发Token IssueToken(context.Context, *IssueTokenRequest) (*Token, error) // 撤销Token RevolkToken(context.Context, *RevolkTokenRequest) (*Token, error) // 切换Token空间 ChangeNamespace(context.Context, *ChangeNamespaceRequest) (*Token, error) // 查询Token, 用于查询Token颁发记录, 也就是登陆日志 QueryToken(context.Context, *QueryTokenRequest) (*TokenSet, error) // RPC RPCServer }
type Status ¶
type Status struct { // 是否冻结 // @gotags: bson:"is_block" json:"is_block" IsBlock bool `protobuf:"varint,1,opt,name=is_block,json=isBlock,proto3" json:"is_block" bson:"is_block"` // 冻结类型 // @gotags: bson:"block_type" json:"block_type" BlockType *BLOCK_TYPE `` /* 142-byte string literal not displayed */ // 冻结时间 // @gotags: bson:"block_at" json:"block_at" BlockAt int64 `protobuf:"varint,3,opt,name=block_at,json=blockAt,proto3" json:"block_at" bson:"block_at"` // 冻结原因 // @gotags: bson:"block_reason" json:"block_reason" BlockReason string `protobuf:"bytes,4,opt,name=block_reason,json=blockReason,proto3" json:"block_reason" bson:"block_reason"` // contains filtered or unexported fields }
func (*Status) Descriptor
deprecated
func (*Status) GetBlockAt ¶
func (*Status) GetBlockReason ¶
func (*Status) GetBlockType ¶
func (x *Status) GetBlockType() BLOCK_TYPE
func (*Status) GetIsBlock ¶
func (*Status) ProtoMessage ¶
func (*Status) ProtoMessage()
func (*Status) ProtoReflect ¶
func (x *Status) ProtoReflect() protoreflect.Message
type TOKEN_TYPE ¶
type TOKEN_TYPE int32
令牌类型
const ( // Bearer Token TOKEN_TYPE_BEARER TOKEN_TYPE = 0 // 基于Mac的Token TOKEN_TYPE_MAC TOKEN_TYPE = 1 // Json Web Token TOKEN_TYPE_JWT TOKEN_TYPE = 2 )
func ParseTOKEN_TYPEFromString ¶
func ParseTOKEN_TYPEFromString(str string) (TOKEN_TYPE, error)
ParseTOKEN_TYPEFromString Parse TOKEN_TYPE from string
func (TOKEN_TYPE) Descriptor ¶
func (TOKEN_TYPE) Descriptor() protoreflect.EnumDescriptor
func (TOKEN_TYPE) Enum ¶
func (x TOKEN_TYPE) Enum() *TOKEN_TYPE
func (TOKEN_TYPE) EnumDescriptor
deprecated
func (TOKEN_TYPE) EnumDescriptor() ([]byte, []int)
Deprecated: Use TOKEN_TYPE.Descriptor instead.
func (TOKEN_TYPE) Number ¶
func (x TOKEN_TYPE) Number() protoreflect.EnumNumber
func (TOKEN_TYPE) String ¶
func (x TOKEN_TYPE) String() string
func (TOKEN_TYPE) Type ¶
func (TOKEN_TYPE) Type() protoreflect.EnumType
func (*TOKEN_TYPE) UnmarshalJSON ¶
func (t *TOKEN_TYPE) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type Token ¶
type Token struct { // 颁发平台, 根据授权方式判断 // @gotags: bson:"platform" json:"platform" Platform PLATFORM `protobuf:"varint,1,opt,name=platform,proto3,enum=devcloud.mcenter.token.PLATFORM" json:"platform" bson:"platform"` // 访问令牌 // @gotags: bson:"_id" json:"access_token" AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token" bson:"_id"` // 刷新令牌, 当访问令牌过期时, 可以刷新令牌进行刷新 // @gotags: bson:"refresh_token" json:"refresh_token" RefreshToken string `protobuf:"bytes,3,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token" bson:"refresh_token"` // 颁发时间 // @gotags: bson:"issue_at" json:"issue_at" IssueAt int64 `protobuf:"varint,4,opt,name=issue_at,json=issueAt,proto3" json:"issue_at" bson:"issue_at"` // 访问令牌过期时间 // @gotags: bson:"access_expired_at" json:"access_expired_at" AccessExpiredAt int64 `protobuf:"varint,5,opt,name=access_expired_at,json=accessExpiredAt,proto3" json:"access_expired_at" bson:"access_expired_at"` // 刷新令牌过期时间 // @gotags: bson:"refresh_expired_at" json:"refresh_expired_at" RefreshExpiredAt int64 `` /* 128-byte string literal not displayed */ // 用户类型 // @gotags: bson:"user_type" json:"user_type" UserType user.TYPE `protobuf:"varint,7,opt,name=user_type,json=userType,proto3,enum=devcloud.mcenter.user.TYPE" json:"user_type" bson:"user_type"` // 用户当前所处域 // @gotags: bson:"domain" json:"domain" Domain string `protobuf:"bytes,8,opt,name=domain,proto3" json:"domain" bson:"domain"` // 用户名 // @gotags: bson:"username" json:"username" Username string `protobuf:"bytes,9,opt,name=username,proto3" json:"username" bson:"username"` // 用户Id // @gotags: bson:"user_id" json:"user_id" UserId string `protobuf:"bytes,10,opt,name=user_id,json=userId,proto3" json:"user_id" bson:"user_id"` // 授权类型 // @gotags: bson:"grant_type" json:"grant_type" GrantType GRANT_TYPE `` /* 137-byte string literal not displayed */ // 令牌类型 // @gotags: bson:"type" json:"type" Type TOKEN_TYPE `protobuf:"varint,12,opt,name=type,proto3,enum=devcloud.mcenter.token.TOKEN_TYPE" json:"type" bson:"type"` // 当前空间 // @gotags: bson:"namespace" json:"namespace" Namespace string `protobuf:"bytes,13,opt,name=namespace,proto3" json:"namespace" bson:"namespace"` // 空间内的过来条件, 格式key=value // @gotags: bson:"scope" json:"scope,omitempty" Scope string `protobuf:"bytes,14,opt,name=scope,proto3" json:"scope,omitempty" bson:"scope"` // 令牌描述信息, 当授权类型为Private Token时, 做描述使用 // @gotags: bson:"description" json:"description,omitempty" Description string `protobuf:"bytes,15,opt,name=description,proto3" json:"description,omitempty" bson:"description"` // 可选名称空间 // @gotags: bson:"-" json:"available_namespace,omitempty" AvailableNamespace []string `protobuf:"bytes,16,rep,name=available_namespace,json=availableNamespace,proto3" json:"available_namespace,omitempty" bson:"-"` // 令牌状态 // @gotags: bson:"status" json:"status,omitempty" Status *Status `protobuf:"bytes,17,opt,name=status,proto3" json:"status,omitempty" bson:"status"` // 令牌办法给客户端信息 // @gotags: bson:"location" json:"location,omitempty" Location *Location `protobuf:"bytes,18,opt,name=location,proto3" json:"location,omitempty" bson:"location"` // contains filtered or unexported fields }
令牌, 访问凭证
func NewDefaultToken ¶
func NewDefaultToken() *Token
func NewToken ¶
func NewToken(req *IssueTokenRequest) *Token
func (*Token) Descriptor
deprecated
func (*Token) GetAccessExpiredAt ¶
func (*Token) GetAccessToken ¶
func (*Token) GetAvailableNamespace ¶
func (*Token) GetDescription ¶
func (*Token) GetGrantType ¶
func (x *Token) GetGrantType() GRANT_TYPE
func (*Token) GetIssueAt ¶
func (*Token) GetLocation ¶
func (*Token) GetNamespace ¶
func (*Token) GetPlatform ¶
func (*Token) GetRefreshExpiredAt ¶
func (*Token) GetRefreshToken ¶
func (*Token) GetType ¶
func (x *Token) GetType() TOKEN_TYPE
func (*Token) GetUserType ¶
func (*Token) GetUsername ¶
func (*Token) IsAccessTokenExpired ¶
func (*Token) ProtoMessage ¶
func (*Token) ProtoMessage()
func (*Token) ProtoReflect ¶
func (x *Token) ProtoReflect() protoreflect.Message
type TokenSet ¶
type TokenSet struct { // 总数量 // @gotags: bson:"total" json:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"` // 列表 // @gotags: bson:"items" json:"items" Items []*Token `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"` // contains filtered or unexported fields }
func (*TokenSet) Descriptor
deprecated
func (*TokenSet) ProtoMessage ¶
func (*TokenSet) ProtoMessage()
func (*TokenSet) ProtoReflect ¶
func (x *TokenSet) ProtoReflect() protoreflect.Message
type UnimplementedRPCServer ¶
type UnimplementedRPCServer struct { }
UnimplementedRPCServer must be embedded to have forward compatible implementations.
func (UnimplementedRPCServer) ValidateToken ¶
func (UnimplementedRPCServer) ValidateToken(context.Context, *ValidateTokenRequest) (*Token, error)
type UnsafeRPCServer ¶
type UnsafeRPCServer interface {
// contains filtered or unexported methods
}
UnsafeRPCServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RPCServer will result in compilation errors.
type UserAgent ¶
type UserAgent struct { // 系统OS // @gotags: bson:"os" json:"os" Os string `protobuf:"bytes,1,opt,name=os,proto3" json:"os" bson:"os"` // 客户端平台 // @gotags: bson:"platform" json:"platform" Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform" bson:"platform"` // 内核名称 // @gotags: bson:"engine_name" json:"engine_name" EngineName string `protobuf:"bytes,3,opt,name=engine_name,json=engineName,proto3" json:"engine_name" bson:"engine_name"` // 内核版本 // @gotags: bson:"engine_version" json:"engine_version" EngineVersion string `protobuf:"bytes,4,opt,name=engine_version,json=engineVersion,proto3" json:"engine_version" bson:"engine_version"` // 浏览器名称 // @gotags: bson:"browser_name" json:"browser_name" BrowserName string `protobuf:"bytes,5,opt,name=browser_name,json=browserName,proto3" json:"browser_name" bson:"browser_name"` // 浏览器版本 // @gotags: bson:"browser_version" json:"browser_version" BrowserVersion string `protobuf:"bytes,6,opt,name=browser_version,json=browserVersion,proto3" json:"browser_version" bson:"browser_version"` // contains filtered or unexported fields }
UserAgent todo
func (*UserAgent) Descriptor
deprecated
func (*UserAgent) GetBrowserName ¶
func (*UserAgent) GetBrowserVersion ¶
func (*UserAgent) GetEngineName ¶
func (*UserAgent) GetEngineVersion ¶
func (*UserAgent) GetPlatform ¶
func (*UserAgent) ProtoMessage ¶
func (*UserAgent) ProtoMessage()
func (*UserAgent) ProtoReflect ¶
func (x *UserAgent) ProtoReflect() protoreflect.Message
type ValidateTokenRequest ¶
type ValidateTokenRequest struct { // 令牌 // @gotags: json:"access_token" AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token"` // contains filtered or unexported fields }
func NewValidateTokenRequest ¶
func NewValidateTokenRequest(ak string) *ValidateTokenRequest
func (*ValidateTokenRequest) Descriptor
deprecated
func (*ValidateTokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use ValidateTokenRequest.ProtoReflect.Descriptor instead.
func (*ValidateTokenRequest) GetAccessToken ¶
func (x *ValidateTokenRequest) GetAccessToken() string
func (*ValidateTokenRequest) ProtoMessage ¶
func (*ValidateTokenRequest) ProtoMessage()
func (*ValidateTokenRequest) ProtoReflect ¶
func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message
func (*ValidateTokenRequest) Reset ¶
func (x *ValidateTokenRequest) Reset()
func (*ValidateTokenRequest) String ¶
func (x *ValidateTokenRequest) String() string