token

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AppName = "token"
)

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",
		9: "WECHAT_WORK",
	}
	GrantType_value = map[string]int32{
		"NULL":        0,
		"UNKNOWN":     1,
		"PASSWORD":    2,
		"LDAP":        3,
		"REFRESH":     4,
		"ACCESS":      5,
		"CLIENT":      6,
		"AUTH_CODE":   7,
		"IMPLICIT":    8,
		"WECHAT_WORK": 9,
	}
)

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_apps_token_pb_request_proto protoreflect.FileDescriptor
View Source
var File_apps_token_pb_service_proto protoreflect.FileDescriptor
View Source
var File_apps_token_pb_token_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.keyauth.token.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "IssueToken",
			Handler:    _Service_IssueToken_Handler,
		},
		{
			MethodName: "ValidateToken",
			Handler:    _Service_ValidateToken_Handler,
		},
		{
			MethodName: "DescribeToken",
			Handler:    _Service_DescribeToken_Handler,
		},
		{
			MethodName: "RevolkToken",
			Handler:    _Service_RevolkToken_Handler,
		},
		{
			MethodName: "BlockToken",
			Handler:    _Service_BlockToken_Handler,
		},
		{
			MethodName: "ChangeNamespace",
			Handler:    _Service_ChangeNamespace_Handler,
		},
		{
			MethodName: "QueryToken",
			Handler:    _Service_QueryToken_Handler,
		},
		{
			MethodName: "DeleteToken",
			Handler:    _Service_DeleteToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/token/pb/service.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service 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

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 RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type BlockTokenRequest

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 `` /* 129-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewBlockTokenRequest

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

NewBlockTokenRequest todo

func (*BlockTokenRequest) Descriptor deprecated

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

Deprecated: Use BlockTokenRequest.ProtoReflect.Descriptor instead.

func (*BlockTokenRequest) GetAccessToken

func (x *BlockTokenRequest) GetAccessToken() string

func (*BlockTokenRequest) GetBlockReason

func (x *BlockTokenRequest) GetBlockReason() string

func (*BlockTokenRequest) GetBlockType

func (x *BlockTokenRequest) GetBlockType() BlockType

func (*BlockTokenRequest) ProtoMessage

func (*BlockTokenRequest) ProtoMessage()

func (*BlockTokenRequest) ProtoReflect

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

func (*BlockTokenRequest) Reset

func (x *BlockTokenRequest) Reset()

func (*BlockTokenRequest) String

func (x *BlockTokenRequest) String() string

type BlockType

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

func ParseBlockTypeFromString(str string) (BlockType, error)

ParseBlockTypeFromString Parse BlockType from string

func (BlockType) Descriptor

func (BlockType) Descriptor() protoreflect.EnumDescriptor

func (BlockType) Enum

func (x BlockType) Enum() *BlockType

func (BlockType) EnumDescriptor deprecated

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

Deprecated: Use BlockType.Descriptor instead.

func (BlockType) Equal

func (t BlockType) Equal(target BlockType) bool

Equal type compare

func (BlockType) IsIn

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

IsIn todo

func (BlockType) MarshalJSON

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

MarshalJSON todo

func (BlockType) Number

func (x BlockType) Number() protoreflect.EnumNumber

func (BlockType) String

func (x BlockType) String() string

func (BlockType) Type

func (*BlockType) UnmarshalJSON

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

UnmarshalJSON todo

type ChangeNamespaceRequest

type ChangeNamespaceRequest struct {

	// @gotags: json:"namespace" validate:"required"
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace" validate:"required"`
	// @gotags: json:"token" validate:"required"
	Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token" validate:"required"`
	// contains filtered or unexported fields
}

func NewChangeNamespaceRequest

func NewChangeNamespaceRequest() *ChangeNamespaceRequest

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

func (*ChangeNamespaceRequest) Validate

func (req *ChangeNamespaceRequest) Validate() error

type DeleteTokenRequest

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

func NewDeleteTokenRequest

func NewDeleteTokenRequest() *DeleteTokenRequest

func (*DeleteTokenRequest) Descriptor deprecated

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

Deprecated: Use DeleteTokenRequest.ProtoReflect.Descriptor instead.

func (*DeleteTokenRequest) GetAccessToken

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

func (*DeleteTokenRequest) GetAccount

func (x *DeleteTokenRequest) GetAccount() string

func (*DeleteTokenRequest) GetDomain

func (x *DeleteTokenRequest) GetDomain() string

func (*DeleteTokenRequest) ProtoMessage

func (*DeleteTokenRequest) ProtoMessage()

func (*DeleteTokenRequest) ProtoReflect

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

func (*DeleteTokenRequest) Reset

func (x *DeleteTokenRequest) Reset()

func (*DeleteTokenRequest) String

func (x *DeleteTokenRequest) String() string

func (*DeleteTokenRequest) Validate

func (req *DeleteTokenRequest) Validate() error

type DeleteTokenResponse

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

func NewDeleteTokenResponse() *DeleteTokenResponse

func (*DeleteTokenResponse) Descriptor deprecated

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

Deprecated: Use DeleteTokenResponse.ProtoReflect.Descriptor instead.

func (*DeleteTokenResponse) GetFailed

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

func (*DeleteTokenResponse) GetMessage

func (x *DeleteTokenResponse) GetMessage() string

func (*DeleteTokenResponse) GetSuccess

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

func (*DeleteTokenResponse) ProtoMessage

func (*DeleteTokenResponse) ProtoMessage()

func (*DeleteTokenResponse) ProtoReflect

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

func (*DeleteTokenResponse) Reset

func (x *DeleteTokenResponse) Reset()

func (*DeleteTokenResponse) String

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

func NewDescribeTokenRequestWithAccessToken(at string) *DescribeTokenRequest

NewDescribeTokenRequestWithAccessToken 实例化

func (*DescribeTokenRequest) Descriptor deprecated

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

Deprecated: Use DescribeTokenRequest.ProtoReflect.Descriptor instead.

func (*DescribeTokenRequest) GetAccessToken

func (x *DescribeTokenRequest) GetAccessToken() string

func (*DescribeTokenRequest) GetRefreshToken

func (x *DescribeTokenRequest) GetRefreshToken() string

func (*DescribeTokenRequest) ProtoMessage

func (*DescribeTokenRequest) ProtoMessage()

func (*DescribeTokenRequest) ProtoReflect

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

func (*DescribeTokenRequest) Reset

func (x *DescribeTokenRequest) Reset()

func (*DescribeTokenRequest) String

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
	GrantType_WECHAT_WORK GrantType = 9
)

func ParseGrantTypeFromString

func ParseGrantTypeFromString(str string) (GrantType, error)

ParseGrantTypeFromString Parse GrantType from string

func (GrantType) Descriptor

func (GrantType) Descriptor() protoreflect.EnumDescriptor

func (GrantType) Enum

func (x GrantType) Enum() *GrantType

func (GrantType) EnumDescriptor deprecated

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

Deprecated: Use GrantType.Descriptor instead.

func (GrantType) Equal

func (t GrantType) Equal(target GrantType) bool

Equal type compare

func (GrantType) IsIn

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

IsIn todo

func (GrantType) MarshalJSON

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

MarshalJSON todo

func (GrantType) Number

func (x GrantType) Number() protoreflect.EnumNumber

func (GrantType) String

func (x GrantType) String() string

func (GrantType) Type

func (*GrantType) UnmarshalJSON

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 `` /* 130-byte string literal not displayed */
	Type            TokenType `protobuf:"varint,11,opt,name=type,proto3,enum=infraboard.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"`
	Service         string    `protobuf:"bytes,17,opt,name=service,proto3" json:"service,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

func (m *IssueTokenRequest) AbnormalUserCheckKey() string

AbnormalUserCheckKey todo

func (*IssueTokenRequest) Descriptor deprecated

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

Deprecated: Use IssueTokenRequest.ProtoReflect.Descriptor instead.

func (*IssueTokenRequest) GetAccessExpiredAt

func (x *IssueTokenRequest) GetAccessExpiredAt() int64

func (*IssueTokenRequest) GetAccessToken

func (x *IssueTokenRequest) GetAccessToken() string

func (*IssueTokenRequest) GetAuthCode

func (x *IssueTokenRequest) GetAuthCode() string

func (*IssueTokenRequest) GetClientId

func (x *IssueTokenRequest) GetClientId() string

func (*IssueTokenRequest) GetClientSecret

func (x *IssueTokenRequest) GetClientSecret() string

func (*IssueTokenRequest) GetDescription

func (x *IssueTokenRequest) GetDescription() string

func (*IssueTokenRequest) GetDomainNameFromAccount

func (m *IssueTokenRequest) GetDomainNameFromAccount() string

GetDomainNameFromAccount todo

func (*IssueTokenRequest) GetGrantType

func (x *IssueTokenRequest) GetGrantType() GrantType

func (*IssueTokenRequest) GetPassword

func (x *IssueTokenRequest) GetPassword() string

func (*IssueTokenRequest) GetRefreshToken

func (x *IssueTokenRequest) GetRefreshToken() string

func (*IssueTokenRequest) GetRemoteIp

func (x *IssueTokenRequest) GetRemoteIp() string

func (*IssueTokenRequest) GetScope

func (x *IssueTokenRequest) GetScope() string

func (*IssueTokenRequest) GetService

func (x *IssueTokenRequest) GetService() string

func (*IssueTokenRequest) GetState

func (x *IssueTokenRequest) GetState() string

func (*IssueTokenRequest) GetType

func (x *IssueTokenRequest) GetType() TokenType

func (*IssueTokenRequest) GetUserAgent

func (x *IssueTokenRequest) GetUserAgent() string

func (*IssueTokenRequest) GetUsername

func (x *IssueTokenRequest) GetUsername() string

func (*IssueTokenRequest) GetVerifyCode

func (x *IssueTokenRequest) GetVerifyCode() string

func (*IssueTokenRequest) IsLoginRequest

func (m *IssueTokenRequest) IsLoginRequest() bool

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

func (*IssueTokenRequest) Validate

func (m *IssueTokenRequest) Validate() error

Validate 校验请求

func (*IssueTokenRequest) WithRemoteIP

func (m *IssueTokenRequest) WithRemoteIP(ip string)

WithRemoteIP todo

func (*IssueTokenRequest) WithRemoteIPFromHTTP

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

WithRemoteIPFromHTTP todo

func (*IssueTokenRequest) WithUserAgent

func (m *IssueTokenRequest) WithUserAgent(userAgent string)

WithUserAgent todo

type QueryTokenRequest

type QueryTokenRequest struct {
	Page          *request.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            `` /* 129-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewQueryTokenRequest

func NewQueryTokenRequest(page *request.PageRequest) *QueryTokenRequest

NewQueryTokenRequest 请求实例

func NewQueryTokenRequestFromHTTP

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

NewQueryDepartmentRequestFromHTTP 列表查询请求

func (*QueryTokenRequest) Descriptor deprecated

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

Deprecated: Use QueryTokenRequest.ProtoReflect.Descriptor instead.

func (*QueryTokenRequest) GetAccount

func (x *QueryTokenRequest) GetAccount() string

func (*QueryTokenRequest) GetApplicationId

func (x *QueryTokenRequest) GetApplicationId() string

func (*QueryTokenRequest) GetGrantType

func (x *QueryTokenRequest) GetGrantType() GrantType

func (*QueryTokenRequest) GetPage

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

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 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

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

Deprecated: Use RevolkTokenRequest.ProtoReflect.Descriptor instead.

func (*RevolkTokenRequest) GetAccessToken

func (x *RevolkTokenRequest) GetAccessToken() string

func (*RevolkTokenRequest) GetClientId

func (x *RevolkTokenRequest) GetClientId() string

func (*RevolkTokenRequest) GetClientSecret

func (x *RevolkTokenRequest) GetClientSecret() string

func (*RevolkTokenRequest) GetLogoutSession

func (x *RevolkTokenRequest) GetLogoutSession() bool

func (*RevolkTokenRequest) GetRefreshToken

func (x *RevolkTokenRequest) GetRefreshToken() string

func (*RevolkTokenRequest) MakeDescribeTokenRequest

func (m *RevolkTokenRequest) MakeDescribeTokenRequest() *DescribeTokenRequest

MakeDescribeTokenRequest todo

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

func (*RevolkTokenRequest) Validate

func (m *RevolkTokenRequest) Validate() error

Validate todo

type ServiceClient

type ServiceClient 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)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer 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
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Set

type Set 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 NewTokenSet

func NewTokenSet() *Set

NewTokenSet 实例化

func (*Set) Add

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

Add todo

func (*Set) Descriptor deprecated

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

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems

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

func (*Set) GetTotal

func (x *Set) GetTotal() int64

func (*Set) ProtoMessage

func (*Set) ProtoMessage()

func (*Set) ProtoReflect

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

func (*Set) Reset

func (x *Set) Reset()

func (*Set) String

func (x *Set) String() string

type Token

type Token struct {

	// @gotags: bson:"session_id" json:"session_id"
	SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id" bson:"session_id"`
	// @gotags: bson:"_id" json:"access_token"
	AccessToken string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token" bson:"_id"`
	// @gotags: bson:"refresh_token" json:"refresh_token,omitempty"
	RefreshToken string `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty" bson:"refresh_token"`
	// @gotags: bson:"create_at" json:"create_at,omitempty"
	CreateAt int64 `protobuf:"varint,5,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty" bson:"create_at"`
	// @gotags: bson:"access_expired_at" json:"access_expired_at,omitempty"
	AccessExpiredAt int64 `` /* 134-byte string literal not displayed */
	// @gotags: bson:"refresh_expired_at" json:"refresh_expired_at,omitempty"
	RefreshExpiredAt int64 `` /* 138-byte string literal not displayed */
	// @gotags: bson:"domain" json:"domain,omitempty"
	Domain string `protobuf:"bytes,8,opt,name=domain,proto3" json:"domain,omitempty" bson:"domain"`
	// @gotags: bson:"user_type" json:"user_type"
	UserType types.UserType `` /* 131-byte string literal not displayed */
	// @gotags: bson:"account" json:"account"
	Account string `protobuf:"bytes,10,opt,name=account,proto3" json:"account" bson:"account"`
	// @gotags: bson:"application_id" json:"application_id"
	ApplicationId string `protobuf:"bytes,11,opt,name=application_id,json=applicationId,proto3" json:"application_id" bson:"application_id"`
	// @gotags: bson:"application_name" json:"application_name"
	ApplicationName string `protobuf:"bytes,12,opt,name=application_name,json=applicationName,proto3" json:"application_name" bson:"application_name"`
	// @gotags: bson:"client_id" json:"client_id"
	ClientId string `protobuf:"bytes,13,opt,name=client_id,json=clientId,proto3" json:"client_id" bson:"client_id"`
	// @gotags: bson:"start_grant_type" json:"start_grant_type"
	StartGrantType GrantType `` /* 161-byte string literal not displayed */
	// @gotags: bson:"grant_type" json:"grant_type"
	GrantType GrantType `` /* 138-byte string literal not displayed */
	// @gotags: bson:"type" json:"type"
	Type TokenType `protobuf:"varint,16,opt,name=type,proto3,enum=infraboard.keyauth.token.TokenType" json:"type" bson:"type"`
	// @gotags: bson:"namespace_id" json:"namespace_id"
	NamespaceId string `protobuf:"bytes,25,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id" bson:"namespace_id"`
	// @gotags: bson:"namespace_name" json:"namespace_name"
	NamespaceName string `protobuf:"bytes,27,opt,name=namespace_name,json=namespaceName,proto3" json:"namespace_name" bson:"namespace_name"`
	// @gotags: bson:"scope" json:"scope"
	Scope string `protobuf:"bytes,17,opt,name=scope,proto3" json:"scope" bson:"scope"`
	// @gotags: bson:"description" json:"description"
	Description string `protobuf:"bytes,18,opt,name=description,proto3" json:"description" bson:"description"`
	// @gotags: bson:"is_block" json:"is_block"
	IsBlock bool `protobuf:"varint,19,opt,name=is_block,json=isBlock,proto3" json:"is_block" bson:"is_block"`
	// @gotags: bson:"block_type" json:"block_type"
	BlockType BlockType `` /* 138-byte string literal not displayed */
	// @gotags: bson:"block_at" json:"block_at"
	BlockAt int64 `protobuf:"varint,21,opt,name=block_at,json=blockAt,proto3" json:"block_at" bson:"block_at"`
	// @gotags: bson:"block_reason" json:"block_reason"
	BlockReason string `protobuf:"bytes,22,opt,name=block_reason,json=blockReason,proto3" json:"block_reason" bson:"block_reason"`
	// @gotags: bson:"-" json:"-"
	RemoteIp string `protobuf:"bytes,23,opt,name=remote_ip,json=remoteIp,proto3" json:"-" bson:"-"`
	// @gotags: bson:"-" json:"-"
	UserAgent string `protobuf:"bytes,24,opt,name=user_agent,json=userAgent,proto3" json:"-" bson:"-"`
	// @gotags: bson:"-" json:"available_namespace"
	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

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

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) Desensitize

func (t *Token) Desensitize()

Desensitize 数据脱敏

func (*Token) EndAt

func (t *Token) EndAt() int64

EndAt token结束时间

func (*Token) GetAccessExpiredAt

func (x *Token) GetAccessExpiredAt() int64

func (*Token) GetAccessToken

func (x *Token) GetAccessToken() string

func (*Token) GetAccount

func (x *Token) GetAccount() string

func (*Token) GetApplicationId

func (x *Token) GetApplicationId() string

func (*Token) GetApplicationName

func (x *Token) GetApplicationName() string

func (*Token) GetAvailableNamespace

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

func (*Token) GetBlockAt

func (x *Token) GetBlockAt() int64

func (*Token) GetBlockReason

func (x *Token) GetBlockReason() string

func (*Token) GetBlockType

func (x *Token) GetBlockType() BlockType

func (*Token) GetClientId

func (x *Token) GetClientId() string

func (*Token) GetCreateAt

func (x *Token) GetCreateAt() int64

func (*Token) GetDescription

func (x *Token) GetDescription() string

func (*Token) GetDomain

func (x *Token) GetDomain() string

func (*Token) GetGrantType

func (x *Token) GetGrantType() GrantType

func (*Token) GetIsBlock

func (x *Token) GetIsBlock() bool

func (*Token) GetNamespaceId added in v0.7.2

func (x *Token) GetNamespaceId() string

func (*Token) GetNamespaceName added in v0.7.2

func (x *Token) GetNamespaceName() string

func (*Token) GetRefreshExpiredAt

func (x *Token) GetRefreshExpiredAt() int64

func (*Token) GetRefreshToken

func (x *Token) GetRefreshToken() string

func (*Token) GetRemoteIP

func (t *Token) GetRemoteIP() string

GetRemoteIP todo

func (*Token) GetRemoteIp

func (x *Token) GetRemoteIp() string

func (*Token) GetScope

func (x *Token) GetScope() string

func (*Token) GetSessionId

func (x *Token) GetSessionId() string

func (*Token) GetStartGrantType

func (x *Token) GetStartGrantType() GrantType

func (*Token) GetType

func (x *Token) GetType() TokenType

func (*Token) GetUserAgent

func (x *Token) GetUserAgent() string

func (*Token) GetUserType

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

func (*Token) HasNamespace

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

func (*Token) IsAvailable

func (t *Token) IsAvailable() error

IsAvailable 判断一个token的可用性

func (*Token) IsOwner

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

IsOwner todo

func (*Token) IsRefresh

func (t *Token) IsRefresh() bool

IsRefresh todo

func (*Token) ProtoMessage

func (*Token) ProtoMessage()

func (*Token) ProtoReflect

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

func (*Token) Reset

func (x *Token) Reset()

func (*Token) String

func (x *Token) String() string

func (*Token) WithRemoteIP

func (t *Token) WithRemoteIP(ip string)

WithRemoteIP todo

func (*Token) WithUerAgent

func (t *Token) WithUerAgent(ua string)

WithUerAgent todo

type TokenType

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

func ParseTokenTypeFromString

func ParseTokenTypeFromString(str string) (TokenType, error)

ParseTokenTypeFromString Parse TokenType from string

func (TokenType) Descriptor

func (TokenType) Descriptor() protoreflect.EnumDescriptor

func (TokenType) Enum

func (x TokenType) Enum() *TokenType

func (TokenType) EnumDescriptor deprecated

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

Deprecated: Use TokenType.Descriptor instead.

func (TokenType) Equal

func (t TokenType) Equal(target TokenType) bool

Equal type compare

func (TokenType) IsIn

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

IsIn todo

func (TokenType) MarshalJSON

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

MarshalJSON todo

func (TokenType) Number

func (x TokenType) Number() protoreflect.EnumNumber

func (TokenType) String

func (x TokenType) String() string

func (TokenType) Type

func (*TokenType) UnmarshalJSON

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

UnmarshalJSON todo

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) BlockToken

func (UnimplementedServiceServer) ChangeNamespace

func (UnimplementedServiceServer) DeleteToken

func (UnimplementedServiceServer) DescribeToken

func (UnimplementedServiceServer) IssueToken

func (UnimplementedServiceServer) QueryToken

func (UnimplementedServiceServer) RevolkToken

func (UnimplementedServiceServer) ValidateToken

type UnsafeServiceServer

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

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer 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

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

Deprecated: Use ValidateTokenRequest.ProtoReflect.Descriptor instead.

func (*ValidateTokenRequest) GetAccessToken

func (x *ValidateTokenRequest) GetAccessToken() string

func (*ValidateTokenRequest) GetEndpointId

func (x *ValidateTokenRequest) GetEndpointId() string

func (*ValidateTokenRequest) GetNamespaceId

func (x *ValidateTokenRequest) GetNamespaceId() string

func (*ValidateTokenRequest) GetRefreshToken

func (x *ValidateTokenRequest) GetRefreshToken() string

func (*ValidateTokenRequest) MakeDescribeTokenRequest

func (m *ValidateTokenRequest) MakeDescribeTokenRequest() *DescribeTokenRequest

MakeDescribeTokenRequest todo

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

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