token

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GrantType_name = map[int32]string{
		0: "NULL",
		1: "UNKNOWN",
		2: "PASSWORD",
		3: "LDAP",
		4: "REFRESH",
		5: "ACCESS",
		6: "CLIENT",
		7: "AUTH_CODE",
		8: "IMPLICIT",
	}
	GrantType_value = map[string]int32{
		"NULL":      0,
		"UNKNOWN":   1,
		"PASSWORD":  2,
		"LDAP":      3,
		"REFRESH":   4,
		"ACCESS":    5,
		"CLIENT":    6,
		"AUTH_CODE": 7,
		"IMPLICIT":  8,
	}
)

Enum value maps for GrantType.

View Source
var (
	TokenType_name = map[int32]string{
		0: "BEARER",
		1: "MAC",
		2: "JWT",
	}
	TokenType_value = map[string]int32{
		"BEARER": 0,
		"MAC":    1,
		"JWT":    2,
	}
)

Enum value maps for TokenType.

View Source
var (
	BlockType_name = map[int32]string{
		0: "SESSION_TERMINATED",
		1: "OTHER_CLIENT_LOGGED_IN",
		2: "OTHER_PLACE_LOGGED_IN",
		3: "OTHER_IP_LOGGED_IN",
	}
	BlockType_value = map[string]int32{
		"SESSION_TERMINATED":     0,
		"OTHER_CLIENT_LOGGED_IN": 1,
		"OTHER_PLACE_LOGGED_IN":  2,
		"OTHER_IP_LOGGED_IN":     3,
	}
)

Enum value maps for BlockType.

View Source
var File_pkg_token_pb_request_proto protoreflect.FileDescriptor
View Source
var File_pkg_token_pb_service_proto protoreflect.FileDescriptor
View Source
var File_pkg_token_pb_token_proto protoreflect.FileDescriptor
View Source
var TokenService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "keyauth.token.TokenService",
	HandlerType: (*TokenServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "IssueToken",
			Handler:    _TokenService_IssueToken_Handler,
		},
		{
			MethodName: "ValidateToken",
			Handler:    _TokenService_ValidateToken_Handler,
		},
		{
			MethodName: "DescribeToken",
			Handler:    _TokenService_DescribeToken_Handler,
		},
		{
			MethodName: "RevolkToken",
			Handler:    _TokenService_RevolkToken_Handler,
		},
		{
			MethodName: "BlockToken",
			Handler:    _TokenService_BlockToken_Handler,
		},
		{
			MethodName: "ChangeNamespace",
			Handler:    _TokenService_ChangeNamespace_Handler,
		},
		{
			MethodName: "QueryToken",
			Handler:    _TokenService_QueryToken_Handler,
		},
		{
			MethodName: "DeleteToken",
			Handler:    _TokenService_DeleteToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/token/pb/service.proto",
}

TokenService_ServiceDesc is the grpc.ServiceDesc for TokenService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func HttpEntry added in v0.2.0

func HttpEntry() *http.EntrySet

HttpEntry todo

func MakeBearer

func MakeBearer(lenth int) string

MakeBearer https://tools.ietf.org/html/rfc6750#section-2.1 b64token = 1*( ALPHA / DIGIT /"-" / "." / "_" / "~" / "+" / "/" ) *"="

func RegisterTokenServiceServer added in v0.2.0

func RegisterTokenServiceServer(s grpc.ServiceRegistrar, srv TokenServiceServer)

Types

type BlockTokenRequest added in v0.2.0

type BlockTokenRequest struct {
	AccessToken string    `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	BlockReason string    `protobuf:"bytes,2,opt,name=block_reason,json=blockReason,proto3" json:"block_reason,omitempty"`
	BlockType   BlockType `protobuf:"varint,3,opt,name=block_type,json=blockType,proto3,enum=keyauth.token.BlockType" json:"block_type,omitempty"`
	// contains filtered or unexported fields
}

func NewBlockTokenRequest added in v0.2.0

func NewBlockTokenRequest(accessToken string, bt BlockType, reason string) *BlockTokenRequest

NewBlockTokenRequest todo

func (*BlockTokenRequest) Descriptor deprecated added in v0.2.0

func (*BlockTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use BlockTokenRequest.ProtoReflect.Descriptor instead.

func (*BlockTokenRequest) GetAccessToken added in v0.2.0

func (x *BlockTokenRequest) GetAccessToken() string

func (*BlockTokenRequest) GetBlockReason added in v0.2.0

func (x *BlockTokenRequest) GetBlockReason() string

func (*BlockTokenRequest) GetBlockType added in v0.2.0

func (x *BlockTokenRequest) GetBlockType() BlockType

func (*BlockTokenRequest) ProtoMessage added in v0.2.0

func (*BlockTokenRequest) ProtoMessage()

func (*BlockTokenRequest) ProtoReflect added in v0.2.0

func (x *BlockTokenRequest) ProtoReflect() protoreflect.Message

func (*BlockTokenRequest) Reset added in v0.2.0

func (x *BlockTokenRequest) Reset()

func (*BlockTokenRequest) String added in v0.2.0

func (x *BlockTokenRequest) String() string

type BlockType added in v0.2.0

type BlockType int32
const (
	BlockType_SESSION_TERMINATED     BlockType = 0
	BlockType_OTHER_CLIENT_LOGGED_IN BlockType = 1
	BlockType_OTHER_PLACE_LOGGED_IN  BlockType = 2
	BlockType_OTHER_IP_LOGGED_IN     BlockType = 3
)

func ParseBlockTypeFromString added in v0.2.0

func ParseBlockTypeFromString(str string) (BlockType, error)

ParseBlockTypeFromString Parse BlockType from string

func (BlockType) Descriptor added in v0.2.0

func (BlockType) Descriptor() protoreflect.EnumDescriptor

func (BlockType) Enum added in v0.2.0

func (x BlockType) Enum() *BlockType

func (BlockType) EnumDescriptor deprecated added in v0.2.0

func (BlockType) EnumDescriptor() ([]byte, []int)

Deprecated: Use BlockType.Descriptor instead.

func (BlockType) Equal added in v0.2.0

func (t BlockType) Equal(target BlockType) bool

Equal type compare

func (BlockType) IsIn added in v0.2.0

func (t BlockType) IsIn(targets ...BlockType) bool

IsIn todo

func (BlockType) MarshalJSON added in v0.2.0

func (t BlockType) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (BlockType) Number added in v0.2.0

func (x BlockType) Number() protoreflect.EnumNumber

func (BlockType) String added in v0.2.0

func (x BlockType) String() string

func (BlockType) Type added in v0.2.0

func (*BlockType) UnmarshalJSON added in v0.2.0

func (t *BlockType) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type ChangeNamespaceRequest added in v0.3.2

type ChangeNamespaceRequest struct {
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// contains filtered or unexported fields
}

func NewChangeNamespaceRequest added in v0.3.2

func NewChangeNamespaceRequest() *ChangeNamespaceRequest

func (*ChangeNamespaceRequest) Descriptor deprecated added in v0.3.2

func (*ChangeNamespaceRequest) Descriptor() ([]byte, []int)

Deprecated: Use ChangeNamespaceRequest.ProtoReflect.Descriptor instead.

func (*ChangeNamespaceRequest) GetNamespace added in v0.3.2

func (x *ChangeNamespaceRequest) GetNamespace() string

func (*ChangeNamespaceRequest) ProtoMessage added in v0.3.2

func (*ChangeNamespaceRequest) ProtoMessage()

func (*ChangeNamespaceRequest) ProtoReflect added in v0.3.2

func (x *ChangeNamespaceRequest) ProtoReflect() protoreflect.Message

func (*ChangeNamespaceRequest) Reset added in v0.3.2

func (x *ChangeNamespaceRequest) Reset()

func (*ChangeNamespaceRequest) String added in v0.3.2

func (x *ChangeNamespaceRequest) String() string

type DeleteTokenRequest added in v0.3.2

type DeleteTokenRequest struct {
	AccessToken []string `protobuf:"bytes,1,rep,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// contains filtered or unexported fields
}

func NewDeleteTokenRequest added in v0.3.2

func NewDeleteTokenRequest() *DeleteTokenRequest

func (*DeleteTokenRequest) Descriptor deprecated added in v0.3.2

func (*DeleteTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteTokenRequest.ProtoReflect.Descriptor instead.

func (*DeleteTokenRequest) GetAccessToken added in v0.3.2

func (x *DeleteTokenRequest) GetAccessToken() []string

func (*DeleteTokenRequest) ProtoMessage added in v0.3.2

func (*DeleteTokenRequest) ProtoMessage()

func (*DeleteTokenRequest) ProtoReflect added in v0.3.2

func (x *DeleteTokenRequest) ProtoReflect() protoreflect.Message

func (*DeleteTokenRequest) Reset added in v0.3.2

func (x *DeleteTokenRequest) Reset()

func (*DeleteTokenRequest) String added in v0.3.2

func (x *DeleteTokenRequest) String() string

func (*DeleteTokenRequest) Validate added in v0.3.2

func (req *DeleteTokenRequest) Validate() error

type DeleteTokenResponse added in v0.3.2

type DeleteTokenResponse struct {
	Message string   `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Success []string `protobuf:"bytes,2,rep,name=success,proto3" json:"success,omitempty"`
	Failed  []string `protobuf:"bytes,3,rep,name=failed,proto3" json:"failed,omitempty"`
	// contains filtered or unexported fields
}

func NewDeleteTokenResponse added in v0.3.2

func NewDeleteTokenResponse() *DeleteTokenResponse

func (*DeleteTokenResponse) Descriptor deprecated added in v0.3.2

func (*DeleteTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteTokenResponse.ProtoReflect.Descriptor instead.

func (*DeleteTokenResponse) GetFailed added in v0.3.2

func (x *DeleteTokenResponse) GetFailed() []string

func (*DeleteTokenResponse) GetMessage added in v0.3.2

func (x *DeleteTokenResponse) GetMessage() string

func (*DeleteTokenResponse) GetSuccess added in v0.3.2

func (x *DeleteTokenResponse) GetSuccess() []string

func (*DeleteTokenResponse) ProtoMessage added in v0.3.2

func (*DeleteTokenResponse) ProtoMessage()

func (*DeleteTokenResponse) ProtoReflect added in v0.3.2

func (x *DeleteTokenResponse) ProtoReflect() protoreflect.Message

func (*DeleteTokenResponse) Reset added in v0.3.2

func (x *DeleteTokenResponse) Reset()

func (*DeleteTokenResponse) String added in v0.3.2

func (x *DeleteTokenResponse) String() string

type DescribeTokenRequest

type DescribeTokenRequest struct {
	AccessToken  string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func NewDescribeTokenRequest

func NewDescribeTokenRequest() *DescribeTokenRequest

NewDescribeTokenRequest 实例化

func NewDescribeTokenRequestWithAccessToken added in v0.2.0

func NewDescribeTokenRequestWithAccessToken(at string) *DescribeTokenRequest

NewDescribeTokenRequestWithAccessToken 实例化

func (*DescribeTokenRequest) Descriptor deprecated added in v0.2.0

func (*DescribeTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use DescribeTokenRequest.ProtoReflect.Descriptor instead.

func (*DescribeTokenRequest) GetAccessToken added in v0.2.0

func (x *DescribeTokenRequest) GetAccessToken() string

func (*DescribeTokenRequest) GetRefreshToken added in v0.2.0

func (x *DescribeTokenRequest) GetRefreshToken() string

func (*DescribeTokenRequest) ProtoMessage added in v0.2.0

func (*DescribeTokenRequest) ProtoMessage()

func (*DescribeTokenRequest) ProtoReflect added in v0.2.0

func (x *DescribeTokenRequest) ProtoReflect() protoreflect.Message

func (*DescribeTokenRequest) Reset added in v0.2.0

func (x *DescribeTokenRequest) Reset()

func (*DescribeTokenRequest) String added in v0.2.0

func (x *DescribeTokenRequest) String() string

func (*DescribeTokenRequest) Validate

func (m *DescribeTokenRequest) Validate() error

Validate 校验

type GrantType

type GrantType int32
const (
	GrantType_NULL      GrantType = 0
	GrantType_UNKNOWN   GrantType = 1
	GrantType_PASSWORD  GrantType = 2
	GrantType_LDAP      GrantType = 3
	GrantType_REFRESH   GrantType = 4
	GrantType_ACCESS    GrantType = 5
	GrantType_CLIENT    GrantType = 6
	GrantType_AUTH_CODE GrantType = 7
	GrantType_IMPLICIT  GrantType = 8
)

func ParseGrantTypeFromString added in v0.2.0

func ParseGrantTypeFromString(str string) (GrantType, error)

ParseGrantTypeFromString Parse GrantType from string

func (GrantType) Descriptor added in v0.2.0

func (GrantType) Descriptor() protoreflect.EnumDescriptor

func (GrantType) Enum added in v0.2.0

func (x GrantType) Enum() *GrantType

func (GrantType) EnumDescriptor deprecated added in v0.2.0

func (GrantType) EnumDescriptor() ([]byte, []int)

Deprecated: Use GrantType.Descriptor instead.

func (GrantType) Equal added in v0.2.0

func (t GrantType) Equal(target GrantType) bool

Equal type compare

func (GrantType) IsIn added in v0.2.0

func (t GrantType) IsIn(targets ...GrantType) bool

IsIn todo

func (GrantType) MarshalJSON added in v0.2.0

func (t GrantType) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (GrantType) Number added in v0.2.0

func (x GrantType) Number() protoreflect.EnumNumber

func (GrantType) String added in v0.2.0

func (x GrantType) String() string

func (GrantType) Type added in v0.2.0

func (*GrantType) UnmarshalJSON added in v0.2.0

func (t *GrantType) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type IssueTokenRequest

type IssueTokenRequest 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"`
	VerifyCode      string    `protobuf:"bytes,3,opt,name=verify_code,json=verifyCode,proto3" json:"verify_code,omitempty"`
	Username        string    `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
	Password        string    `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"`
	RefreshToken    string    `protobuf:"bytes,6,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	AccessToken     string    `protobuf:"bytes,7,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	AuthCode        string    `protobuf:"bytes,8,opt,name=auth_code,json=authCode,proto3" json:"auth_code,omitempty"`
	State           string    `protobuf:"bytes,9,opt,name=state,proto3" json:"state,omitempty"`
	GrantType       GrantType `protobuf:"varint,10,opt,name=grant_type,json=grantType,proto3,enum=keyauth.token.GrantType" json:"grant_type,omitempty"`
	Type            TokenType `protobuf:"varint,11,opt,name=type,proto3,enum=keyauth.token.TokenType" json:"type,omitempty"`
	AccessExpiredAt int64     `protobuf:"varint,15,opt,name=access_expired_at,json=accessExpiredAt,proto3" json:"access_expired_at,omitempty"`
	Description     string    `protobuf:"bytes,16,opt,name=description,proto3" json:"description,omitempty"`
	Scope           string    `protobuf:"bytes,12,opt,name=scope,proto3" json:"scope,omitempty"`
	UserAgent       string    `protobuf:"bytes,13,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"`
	RemoteIp        string    `protobuf:"bytes,14,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip,omitempty"`
	// contains filtered or unexported fields
}

func NewIssueTokenByPassword

func NewIssueTokenByPassword(clientID, clientSecret, user, pass string) *IssueTokenRequest

NewIssueTokenByPassword todo

func NewIssueTokenRequest

func NewIssueTokenRequest() *IssueTokenRequest

NewIssueTokenRequest 默认请求

func (*IssueTokenRequest) AbnormalUserCheckKey added in v0.2.0

func (m *IssueTokenRequest) AbnormalUserCheckKey() string

AbnormalUserCheckKey todo

func (*IssueTokenRequest) Descriptor deprecated added in v0.2.0

func (*IssueTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use IssueTokenRequest.ProtoReflect.Descriptor instead.

func (*IssueTokenRequest) GetAccessExpiredAt added in v0.3.2

func (x *IssueTokenRequest) GetAccessExpiredAt() int64

func (*IssueTokenRequest) GetAccessToken added in v0.2.0

func (x *IssueTokenRequest) GetAccessToken() string

func (*IssueTokenRequest) GetAuthCode added in v0.2.0

func (x *IssueTokenRequest) GetAuthCode() string

func (*IssueTokenRequest) GetClientId added in v0.2.0

func (x *IssueTokenRequest) GetClientId() string

func (*IssueTokenRequest) GetClientSecret added in v0.2.0

func (x *IssueTokenRequest) GetClientSecret() string

func (*IssueTokenRequest) GetDescription added in v0.3.2

func (x *IssueTokenRequest) GetDescription() string

func (*IssueTokenRequest) GetDomainNameFromAccount added in v0.2.0

func (m *IssueTokenRequest) GetDomainNameFromAccount() string

GetDomainNameFromAccount todo

func (*IssueTokenRequest) GetGrantType added in v0.2.0

func (x *IssueTokenRequest) GetGrantType() GrantType

func (*IssueTokenRequest) GetPassword added in v0.2.0

func (x *IssueTokenRequest) GetPassword() string

func (*IssueTokenRequest) GetRefreshToken added in v0.2.0

func (x *IssueTokenRequest) GetRefreshToken() string

func (*IssueTokenRequest) GetRemoteIp added in v0.2.0

func (x *IssueTokenRequest) GetRemoteIp() string

func (*IssueTokenRequest) GetScope added in v0.2.0

func (x *IssueTokenRequest) GetScope() string

func (*IssueTokenRequest) GetState added in v0.2.0

func (x *IssueTokenRequest) GetState() string

func (*IssueTokenRequest) GetType added in v0.2.0

func (x *IssueTokenRequest) GetType() TokenType

func (*IssueTokenRequest) GetUserAgent added in v0.2.0

func (x *IssueTokenRequest) GetUserAgent() string

func (*IssueTokenRequest) GetUsername added in v0.2.0

func (x *IssueTokenRequest) GetUsername() string

func (*IssueTokenRequest) GetVerifyCode added in v0.2.0

func (x *IssueTokenRequest) GetVerifyCode() string

func (*IssueTokenRequest) IsLoginRequest added in v0.3.2

func (m *IssueTokenRequest) IsLoginRequest() bool

func (*IssueTokenRequest) ProtoMessage added in v0.2.0

func (*IssueTokenRequest) ProtoMessage()

func (*IssueTokenRequest) ProtoReflect added in v0.2.0

func (x *IssueTokenRequest) ProtoReflect() protoreflect.Message

func (*IssueTokenRequest) Reset added in v0.2.0

func (x *IssueTokenRequest) Reset()

func (*IssueTokenRequest) String added in v0.2.0

func (x *IssueTokenRequest) String() string

func (*IssueTokenRequest) Validate

func (m *IssueTokenRequest) Validate() error

Validate 校验请求

func (*IssueTokenRequest) WithRemoteIP added in v0.2.0

func (m *IssueTokenRequest) WithRemoteIP(ip string)

WithRemoteIP todo

func (*IssueTokenRequest) WithRemoteIPFromHTTP added in v0.2.0

func (m *IssueTokenRequest) WithRemoteIPFromHTTP(r *http.Request)

WithRemoteIPFromHTTP todo

func (*IssueTokenRequest) WithUserAgent added in v0.2.0

func (m *IssueTokenRequest) WithUserAgent(userAgent string)

WithUserAgent todo

type QueryTokenRequest

type QueryTokenRequest struct {
	Page          *page.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page,omitempty"`
	ApplicationId string            `protobuf:"bytes,2,opt,name=application_id,json=applicationId,proto3" json:"application_id,omitempty"`
	Account       string            `protobuf:"bytes,4,opt,name=account,proto3" json:"account,omitempty"`
	GrantType     GrantType         `protobuf:"varint,3,opt,name=grant_type,json=grantType,proto3,enum=keyauth.token.GrantType" json:"grant_type,omitempty"`
	// contains filtered or unexported fields
}

func NewQueryTokenRequest

func NewQueryTokenRequest(page *page.PageRequest) *QueryTokenRequest

NewQueryTokenRequest 请求实例

func NewQueryTokenRequestFromHTTP added in v0.3.2

func NewQueryTokenRequestFromHTTP(r *http.Request) (*QueryTokenRequest, error)

NewQueryDepartmentRequestFromHTTP 列表查询请求

func (*QueryTokenRequest) Descriptor deprecated added in v0.2.0

func (*QueryTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryTokenRequest.ProtoReflect.Descriptor instead.

func (*QueryTokenRequest) GetAccount added in v0.3.2

func (x *QueryTokenRequest) GetAccount() string

func (*QueryTokenRequest) GetApplicationId added in v0.2.0

func (x *QueryTokenRequest) GetApplicationId() string

func (*QueryTokenRequest) GetGrantType added in v0.2.0

func (x *QueryTokenRequest) GetGrantType() GrantType

func (*QueryTokenRequest) GetPage added in v0.2.0

func (x *QueryTokenRequest) GetPage() *page.PageRequest

func (*QueryTokenRequest) ProtoMessage added in v0.2.0

func (*QueryTokenRequest) ProtoMessage()

func (*QueryTokenRequest) ProtoReflect added in v0.2.0

func (x *QueryTokenRequest) ProtoReflect() protoreflect.Message

func (*QueryTokenRequest) Reset added in v0.2.0

func (x *QueryTokenRequest) Reset()

func (*QueryTokenRequest) String added in v0.2.0

func (x *QueryTokenRequest) String() string

type RevolkTokenRequest

type RevolkTokenRequest 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"`
	LogoutSession bool   `protobuf:"varint,3,opt,name=logout_session,json=logoutSession,proto3" json:"logout_session,omitempty"`
	AccessToken   string `protobuf:"bytes,4,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken  string `protobuf:"bytes,5,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func NewRevolkTokenRequest

func NewRevolkTokenRequest(clientID, clientSecret string) *RevolkTokenRequest

NewRevolkTokenRequest 撤销Token请求

func (*RevolkTokenRequest) Descriptor deprecated added in v0.2.0

func (*RevolkTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use RevolkTokenRequest.ProtoReflect.Descriptor instead.

func (*RevolkTokenRequest) GetAccessToken added in v0.2.0

func (x *RevolkTokenRequest) GetAccessToken() string

func (*RevolkTokenRequest) GetClientId added in v0.2.0

func (x *RevolkTokenRequest) GetClientId() string

func (*RevolkTokenRequest) GetClientSecret added in v0.2.0

func (x *RevolkTokenRequest) GetClientSecret() string

func (*RevolkTokenRequest) GetLogoutSession added in v0.2.0

func (x *RevolkTokenRequest) GetLogoutSession() bool

func (*RevolkTokenRequest) GetRefreshToken added in v0.2.0

func (x *RevolkTokenRequest) GetRefreshToken() string

func (*RevolkTokenRequest) MakeDescribeTokenRequest added in v0.2.0

func (m *RevolkTokenRequest) MakeDescribeTokenRequest() *DescribeTokenRequest

MakeDescribeTokenRequest todo

func (*RevolkTokenRequest) ProtoMessage added in v0.2.0

func (*RevolkTokenRequest) ProtoMessage()

func (*RevolkTokenRequest) ProtoReflect added in v0.2.0

func (x *RevolkTokenRequest) ProtoReflect() protoreflect.Message

func (*RevolkTokenRequest) Reset added in v0.2.0

func (x *RevolkTokenRequest) Reset()

func (*RevolkTokenRequest) String added in v0.2.0

func (x *RevolkTokenRequest) String() string

func (*RevolkTokenRequest) Validate added in v0.2.0

func (m *RevolkTokenRequest) Validate() error

Validate todo

type Set

type Set struct {
	Total int64    `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
	Items []*Token `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewTokenSet

func NewTokenSet() *Set

NewTokenSet 实例化

func (*Set) Add

func (m *Set) Add(item *Token)

Add todo

func (*Set) Descriptor deprecated added in v0.2.0

func (*Set) Descriptor() ([]byte, []int)

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems added in v0.2.0

func (x *Set) GetItems() []*Token

func (*Set) GetTotal added in v0.2.0

func (x *Set) GetTotal() int64

func (*Set) ProtoMessage added in v0.2.0

func (*Set) ProtoMessage()

func (*Set) ProtoReflect added in v0.2.0

func (x *Set) ProtoReflect() protoreflect.Message

func (*Set) Reset added in v0.2.0

func (x *Set) Reset()

func (*Set) String added in v0.2.0

func (x *Set) String() string

type Token

type Token struct {
	SessionId          string         `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id" bson:"session_id"`
	AccessToken        string         `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token" bson:"_id"`
	RefreshToken       string         `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty" bson:"refresh_token"`
	CreateAt           int64          `protobuf:"varint,5,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty" bson:"create_at"`
	AccessExpiredAt    int64          `` /* 134-byte string literal not displayed */
	RefreshExpiredAt   int64          `` /* 138-byte string literal not displayed */
	Domain             string         `protobuf:"bytes,8,opt,name=domain,proto3" json:"domain,omitempty" bson:"domain"`
	UserType           types.UserType `protobuf:"varint,9,opt,name=user_type,json=userType,proto3,enum=keyauth.user.UserType" json:"user_type" bson:"user_type"`
	Account            string         `protobuf:"bytes,10,opt,name=account,proto3" json:"account" bson:"account"`
	ApplicationId      string         `protobuf:"bytes,11,opt,name=application_id,json=applicationId,proto3" json:"application_id" bson:"application_id"`
	ApplicationName    string         `protobuf:"bytes,12,opt,name=application_name,json=applicationName,proto3" json:"application_name" bson:"application_name"`
	ClientId           string         `protobuf:"bytes,13,opt,name=client_id,json=clientId,proto3" json:"client_id" bson:"client_id"`
	StartGrantType     GrantType      `` /* 150-byte string literal not displayed */
	GrantType          GrantType      `` /* 127-byte string literal not displayed */
	Type               TokenType      `protobuf:"varint,16,opt,name=type,proto3,enum=keyauth.token.TokenType" json:"type" bson:"type"`
	Namespace          string         `protobuf:"bytes,25,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	Scope              string         `protobuf:"bytes,17,opt,name=scope,proto3" json:"scope" bson:"scope"`
	Description        string         `protobuf:"bytes,18,opt,name=description,proto3" json:"description" bson:"description"`
	IsBlock            bool           `protobuf:"varint,19,opt,name=is_block,json=isBlock,proto3" json:"is_block" bson:"is_block"`
	BlockType          BlockType      `` /* 127-byte string literal not displayed */
	BlockAt            int64          `protobuf:"varint,21,opt,name=block_at,json=blockAt,proto3" json:"block_at" bson:"block_at"`
	BlockReason        string         `protobuf:"bytes,22,opt,name=block_reason,json=blockReason,proto3" json:"block_reason" bson:"block_reason"`
	RemoteIp           string         `protobuf:"bytes,23,opt,name=remote_ip,json=remoteIp,proto3" json:"-" bson:"-"`
	UserAgent          string         `protobuf:"bytes,24,opt,name=user_agent,json=userAgent,proto3" json:"-" bson:"-"`
	AvailableNamespace []string       `protobuf:"bytes,26,rep,name=available_namespace,json=availableNamespace,proto3" json:"available_namespace" bson:"-"`
	// contains filtered or unexported fields
}

func NewDefaultToken

func NewDefaultToken() *Token

NewDefaultToken todo

func (*Token) BlockMessage added in v0.2.0

func (t *Token) BlockMessage() string

BlockMessage todo

func (*Token) CheckAccessIsExpired

func (t *Token) CheckAccessIsExpired() bool

CheckAccessIsExpired 检测token是否过期

func (*Token) CheckRefreshIsExpired

func (t *Token) CheckRefreshIsExpired() bool

CheckRefreshIsExpired 检测刷新token是否过期

func (*Token) CheckTokenApplication

func (t *Token) CheckTokenApplication(applicationID string) error

CheckTokenApplication 判断token是否属于该应用

func (*Token) Descriptor deprecated added in v0.2.0

func (*Token) Descriptor() ([]byte, []int)

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) Desensitize

func (t *Token) Desensitize()

Desensitize 数据脱敏

func (*Token) EndAt added in v0.2.0

func (t *Token) EndAt() int64

EndAt token结束时间

func (*Token) GetAccessExpiredAt added in v0.2.0

func (x *Token) GetAccessExpiredAt() int64

func (*Token) GetAccessToken added in v0.2.0

func (x *Token) GetAccessToken() string

func (*Token) GetAccount added in v0.2.0

func (x *Token) GetAccount() string

func (*Token) GetApplicationId added in v0.2.0

func (x *Token) GetApplicationId() string

func (*Token) GetApplicationName added in v0.2.0

func (x *Token) GetApplicationName() string

func (*Token) GetAvailableNamespace added in v0.3.2

func (x *Token) GetAvailableNamespace() []string

func (*Token) GetBlockAt added in v0.2.0

func (x *Token) GetBlockAt() int64

func (*Token) GetBlockReason added in v0.2.0

func (x *Token) GetBlockReason() string

func (*Token) GetBlockType added in v0.2.0

func (x *Token) GetBlockType() BlockType

func (*Token) GetClientId added in v0.2.0

func (x *Token) GetClientId() string

func (*Token) GetCreateAt added in v0.2.0

func (x *Token) GetCreateAt() int64

func (*Token) GetDescription added in v0.2.0

func (x *Token) GetDescription() string

func (*Token) GetDomain added in v0.2.0

func (x *Token) GetDomain() string

func (*Token) GetGrantType added in v0.2.0

func (x *Token) GetGrantType() GrantType

func (*Token) GetIsBlock added in v0.2.0

func (x *Token) GetIsBlock() bool

func (*Token) GetNamespace added in v0.3.2

func (x *Token) GetNamespace() string

func (*Token) GetRefreshExpiredAt added in v0.2.0

func (x *Token) GetRefreshExpiredAt() int64

func (*Token) GetRefreshToken added in v0.2.0

func (x *Token) GetRefreshToken() string

func (*Token) GetRemoteIP added in v0.2.0

func (t *Token) GetRemoteIP() string

GetRemoteIP todo

func (*Token) GetRemoteIp added in v0.2.0

func (x *Token) GetRemoteIp() string

func (*Token) GetScope added in v0.2.0

func (x *Token) GetScope() string

func (*Token) GetSessionId added in v0.2.0

func (x *Token) GetSessionId() string

func (*Token) GetStartGrantType added in v0.2.0

func (x *Token) GetStartGrantType() GrantType

func (*Token) GetType added in v0.2.0

func (x *Token) GetType() TokenType

func (*Token) GetUserAgent added in v0.2.0

func (x *Token) GetUserAgent() string

func (*Token) GetUserType added in v0.2.0

func (x *Token) GetUserType() types.UserType

func (*Token) HasNamespace added in v0.3.2

func (t *Token) HasNamespace(ns string) bool

func (*Token) IsAvailable added in v0.2.0

func (t *Token) IsAvailable() error

IsAvailable 判断一个token的可用性

func (*Token) IsOwner added in v0.2.0

func (t *Token) IsOwner(account string) bool

IsOwner todo

func (*Token) IsRefresh added in v0.2.0

func (t *Token) IsRefresh() bool

IsRefresh todo

func (*Token) ProtoMessage added in v0.2.0

func (*Token) ProtoMessage()

func (*Token) ProtoReflect added in v0.2.0

func (x *Token) ProtoReflect() protoreflect.Message

func (*Token) Reset added in v0.2.0

func (x *Token) Reset()

func (*Token) String added in v0.2.0

func (x *Token) String() string

func (*Token) WithRemoteIP added in v0.2.0

func (t *Token) WithRemoteIP(ip string)

WithRemoteIP todo

func (*Token) WithUerAgent added in v0.2.0

func (t *Token) WithUerAgent(ua string)

WithUerAgent todo

type TokenServiceClient added in v0.2.0

type TokenServiceClient interface {
	IssueToken(ctx context.Context, in *IssueTokenRequest, opts ...grpc.CallOption) (*Token, error)
	ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*Token, error)
	DescribeToken(ctx context.Context, in *DescribeTokenRequest, opts ...grpc.CallOption) (*Token, error)
	RevolkToken(ctx context.Context, in *RevolkTokenRequest, opts ...grpc.CallOption) (*Token, error)
	BlockToken(ctx context.Context, in *BlockTokenRequest, opts ...grpc.CallOption) (*Token, error)
	ChangeNamespace(ctx context.Context, in *ChangeNamespaceRequest, opts ...grpc.CallOption) (*Token, error)
	QueryToken(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*Set, error)
	DeleteToken(ctx context.Context, in *DeleteTokenRequest, opts ...grpc.CallOption) (*DeleteTokenResponse, error)
}

TokenServiceClient is the client API for TokenService 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 NewTokenServiceClient added in v0.2.0

func NewTokenServiceClient(cc grpc.ClientConnInterface) TokenServiceClient

type TokenServiceServer added in v0.2.0

type TokenServiceServer interface {
	IssueToken(context.Context, *IssueTokenRequest) (*Token, error)
	ValidateToken(context.Context, *ValidateTokenRequest) (*Token, error)
	DescribeToken(context.Context, *DescribeTokenRequest) (*Token, error)
	RevolkToken(context.Context, *RevolkTokenRequest) (*Token, error)
	BlockToken(context.Context, *BlockTokenRequest) (*Token, error)
	ChangeNamespace(context.Context, *ChangeNamespaceRequest) (*Token, error)
	QueryToken(context.Context, *QueryTokenRequest) (*Set, error)
	DeleteToken(context.Context, *DeleteTokenRequest) (*DeleteTokenResponse, error)
	// contains filtered or unexported methods
}

TokenServiceServer is the server API for TokenService service. All implementations must embed UnimplementedTokenServiceServer for forward compatibility

type TokenType added in v0.2.0

type TokenType int32
const (
	TokenType_BEARER TokenType = 0
	TokenType_MAC    TokenType = 1
	TokenType_JWT    TokenType = 2
)

func ParseTokenTypeFromString added in v0.2.0

func ParseTokenTypeFromString(str string) (TokenType, error)

ParseTokenTypeFromString Parse TokenType from string

func (TokenType) Descriptor added in v0.2.0

func (TokenType) Descriptor() protoreflect.EnumDescriptor

func (TokenType) Enum added in v0.2.0

func (x TokenType) Enum() *TokenType

func (TokenType) EnumDescriptor deprecated added in v0.2.0

func (TokenType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TokenType.Descriptor instead.

func (TokenType) Equal added in v0.2.0

func (t TokenType) Equal(target TokenType) bool

Equal type compare

func (TokenType) IsIn added in v0.2.0

func (t TokenType) IsIn(targets ...TokenType) bool

IsIn todo

func (TokenType) MarshalJSON added in v0.2.0

func (t TokenType) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (TokenType) Number added in v0.2.0

func (x TokenType) Number() protoreflect.EnumNumber

func (TokenType) String added in v0.2.0

func (x TokenType) String() string

func (TokenType) Type added in v0.2.0

func (*TokenType) UnmarshalJSON added in v0.2.0

func (t *TokenType) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type UnimplementedTokenServiceServer added in v0.2.0

type UnimplementedTokenServiceServer struct {
}

UnimplementedTokenServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedTokenServiceServer) BlockToken added in v0.2.0

func (UnimplementedTokenServiceServer) ChangeNamespace added in v0.3.2

func (UnimplementedTokenServiceServer) DeleteToken added in v0.3.2

func (UnimplementedTokenServiceServer) DescribeToken added in v0.2.0

func (UnimplementedTokenServiceServer) IssueToken added in v0.2.0

func (UnimplementedTokenServiceServer) QueryToken added in v0.2.0

func (UnimplementedTokenServiceServer) RevolkToken added in v0.2.0

func (UnimplementedTokenServiceServer) ValidateToken added in v0.2.0

type UnsafeTokenServiceServer added in v0.2.0

type UnsafeTokenServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeTokenServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TokenServiceServer will result in compilation errors.

type ValidateTokenRequest

type ValidateTokenRequest struct {
	NamespaceId  string `protobuf:"bytes,1,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"`
	EndpointId   string `protobuf:"bytes,2,opt,name=endpoint_id,json=endpointId,proto3" json:"endpoint_id,omitempty"`
	AccessToken  string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken string `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func NewValidateTokenRequest

func NewValidateTokenRequest() *ValidateTokenRequest

NewValidateTokenRequest 实例化

func (*ValidateTokenRequest) Descriptor deprecated added in v0.2.0

func (*ValidateTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use ValidateTokenRequest.ProtoReflect.Descriptor instead.

func (*ValidateTokenRequest) GetAccessToken added in v0.2.0

func (x *ValidateTokenRequest) GetAccessToken() string

func (*ValidateTokenRequest) GetEndpointId added in v0.2.0

func (x *ValidateTokenRequest) GetEndpointId() string

func (*ValidateTokenRequest) GetNamespaceId added in v0.2.0

func (x *ValidateTokenRequest) GetNamespaceId() string

func (*ValidateTokenRequest) GetRefreshToken added in v0.2.0

func (x *ValidateTokenRequest) GetRefreshToken() string

func (*ValidateTokenRequest) MakeDescribeTokenRequest added in v0.2.0

func (m *ValidateTokenRequest) MakeDescribeTokenRequest() *DescribeTokenRequest

MakeDescribeTokenRequest todo

func (*ValidateTokenRequest) ProtoMessage added in v0.2.0

func (*ValidateTokenRequest) ProtoMessage()

func (*ValidateTokenRequest) ProtoReflect added in v0.2.0

func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message

func (*ValidateTokenRequest) Reset added in v0.2.0

func (x *ValidateTokenRequest) Reset()

func (*ValidateTokenRequest) String added in v0.2.0

func (x *ValidateTokenRequest) String() string

func (*ValidateTokenRequest) Validate

func (m *ValidateTokenRequest) Validate() error

Validate 校验参数

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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