token

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName          = "token"
	DefaulDomain     = "default"
	DefaultNamespace = "default"
)

Variables

View Source
var (
	GrantType_name = map[int32]string{
		0: "PASSWORD",
		1: "REFRESH",
		2: "LDAP",
		3: "ACCESS",
	}
	GrantType_value = map[string]int32{
		"PASSWORD": 0,
		"REFRESH":  1,
		"LDAP":     2,
		"ACCESS":   3,
	}
)

Enum value maps for GrantType.

View Source
var (
	DescribeBy_name = map[int32]string{
		0: "ACCESS_ID",
		1: "USER_NAME",
	}
	DescribeBy_value = map[string]int32{
		"ACCESS_ID": 0,
		"USER_NAME": 1,
	}
)

Enum value maps for DescribeBy.

View Source
var File_apps_token_pb_token_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "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: "QueryToken",
			Handler:    _Service_QueryToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/token/pb/token.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 RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type DescribeBy

type DescribeBy int32
const (
	DescribeBy_ACCESS_ID DescribeBy = 0
	DescribeBy_USER_NAME DescribeBy = 1
)

func (DescribeBy) Descriptor

func (DescribeBy) Descriptor() protoreflect.EnumDescriptor

func (DescribeBy) Enum

func (x DescribeBy) Enum() *DescribeBy

func (DescribeBy) EnumDescriptor deprecated

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

Deprecated: Use DescribeBy.Descriptor instead.

func (DescribeBy) Number

func (x DescribeBy) Number() protoreflect.EnumNumber

func (DescribeBy) String

func (x DescribeBy) String() string

func (DescribeBy) Type

type DescribeTokenRequest

type DescribeTokenRequest struct {

	// token id
	// @gotags: json:"access_token"
	AccessId string `protobuf:"bytes,1,opt,name=access_id,json=accessId,proto3" json:"access_token"`
	// @gotags: json:"describe_type"
	DescribeType DescribeBy `protobuf:"varint,2,opt,name=describe_type,json=describeType,proto3,enum=keyauth.token.DescribeBy" json:"describe_type"`
	// @gotags: json:"user_domain"
	UserDomain string `protobuf:"bytes,3,opt,name=user_domain,json=userDomain,proto3" json:"user_domain"`
	// @gotags: json:"user_name"
	UserName string `protobuf:"bytes,4,opt,name=user_name,json=userName,proto3" json:"user_name"`
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// contains filtered or unexported fields
}

func (*DescribeTokenRequest) Descriptor deprecated

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

Deprecated: Use DescribeTokenRequest.ProtoReflect.Descriptor instead.

func (*DescribeTokenRequest) GetAccessId

func (x *DescribeTokenRequest) GetAccessId() string

func (*DescribeTokenRequest) GetDescribeType

func (x *DescribeTokenRequest) GetDescribeType() DescribeBy

func (*DescribeTokenRequest) GetNamespace added in v1.1.0

func (x *DescribeTokenRequest) GetNamespace() string

func (*DescribeTokenRequest) GetUserDomain

func (x *DescribeTokenRequest) GetUserDomain() string

func (*DescribeTokenRequest) GetUserName

func (x *DescribeTokenRequest) GetUserName() 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

type GrantType

type GrantType int32
const (
	GrantType_PASSWORD GrantType = 0
	GrantType_REFRESH  GrantType = 1
	GrantType_LDAP     GrantType = 2
	GrantType_ACCESS   GrantType = 3
)

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

func (x GrantType) Number() protoreflect.EnumNumber

func (GrantType) String

func (x GrantType) String() string

func (GrantType) Type

type IssueTokenRequest

type IssueTokenRequest struct {

	// @gotags: bson:"access_token" json:"access_token,omitempty"
	AccessId string `protobuf:"bytes,1,opt,name=access_id,json=accessId,proto3" json:"access_token,omitempty" bson:"access_token"`
	// @gotags: bson:"user_name" json:"user_name,omitempty"
	UserName string `protobuf:"bytes,2,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty" bson:"user_name"`
	// @gotags: json:"password,omitempty"
	Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
	// @gotags: bson:"user_domain" json:"user_domain,omitempty"
	UserDomain string `protobuf:"bytes,8,opt,name=user_domain,json=userDomain,proto3" json:"user_domain,omitempty" bson:"user_domain"`
	// @gotags: bson:"refresh_token" json:"refresh_token,omitempty"
	GrantType GrantType `` /* 143-byte string literal not displayed */
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// contains filtered or unexported fields
}

func NewIssueToken

func NewIssueToken() *IssueTokenRequest

func (*IssueTokenRequest) Descriptor deprecated

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

Deprecated: Use IssueTokenRequest.ProtoReflect.Descriptor instead.

func (*IssueTokenRequest) GetAccessId

func (x *IssueTokenRequest) GetAccessId() string

func (*IssueTokenRequest) GetGrantType

func (x *IssueTokenRequest) GetGrantType() GrantType

func (*IssueTokenRequest) GetNamespace added in v1.1.0

func (x *IssueTokenRequest) GetNamespace() string

func (*IssueTokenRequest) GetPassword

func (x *IssueTokenRequest) GetPassword() string

func (*IssueTokenRequest) GetUserDomain

func (x *IssueTokenRequest) GetUserDomain() string

func (*IssueTokenRequest) GetUserName

func (x *IssueTokenRequest) GetUserName() 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

func (*IssueTokenRequest) Validate

func (i *IssueTokenRequest) Validate() error

type QueryTokenRequest

type QueryTokenRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 关键字参数
	// @gotags: json:"keywords"
	Keywords string `protobuf:"bytes,2,opt,name=keywords,proto3" json:"keywords"`
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// contains filtered or unexported fields
}

func (*QueryTokenRequest) Descriptor deprecated

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

Deprecated: Use QueryTokenRequest.ProtoReflect.Descriptor instead.

func (*QueryTokenRequest) GetKeywords

func (x *QueryTokenRequest) GetKeywords() string

func (*QueryTokenRequest) GetNamespace added in v1.1.0

func (x *QueryTokenRequest) GetNamespace() string

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 {

	// token id
	// @gotags: json:"access_token"
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token"`
	// @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:"domain" json:"domain,omitempty"
	Domain string `protobuf:"bytes,8,opt,name=domain,proto3" json:"domain,omitempty" bson:"domain"`
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// contains filtered or unexported fields
}

吊销token请求

func NewRevolkTokenRequest

func NewRevolkTokenRequest() *RevolkTokenRequest

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

func (x *RevolkTokenRequest) GetDomain() string

func (*RevolkTokenRequest) GetNamespace added in v1.1.0

func (x *RevolkTokenRequest) GetNamespace() 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 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)
	QueryToken(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*TokenSet, 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)
	QueryToken(context.Context, *QueryTokenRequest) (*TokenSet, error)
	// contains filtered or unexported methods
}

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

type Token

type Token struct {

	// 录入时间
	// @gotags: bson:"_id" json:"access_token,omitempty"
	AccessToken string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty" 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:"issue_at" json:"issue_at,omitempty"
	IssueAt int64 `protobuf:"varint,5,opt,name=issue_at,json=issueAt,proto3" json:"issue_at,omitempty" bson:"issue_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:"grant_type" json:"grant_type"
	GrantType GrantType `` /* 127-byte string literal not displayed */
	// @gotags: bson:"user_name" json:"user_name"
	UserName string `protobuf:"bytes,8,opt,name=user_name,json=userName,proto3" json:"user_name" bson:"user_name"`
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	Domain    string `protobuf:"bytes,16,opt,name=domain,proto3" json:"domain,omitempty"`
	// contains filtered or unexported fields
}

Token todo

func NewDefaultToken

func NewDefaultToken(domain, username string) *Token

func NewToken

func NewToken() *Token

func (*Token) AccesstTokenValidate

func (t *Token) AccesstTokenValidate() error

func (*Token) CheckRefreshToken

func (t *Token) CheckRefreshToken(id string) bool

func (*Token) Descriptor deprecated

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetAccessExpiredAt

func (x *Token) GetAccessExpiredAt() int64

func (*Token) GetAccessToken

func (x *Token) GetAccessToken() string

func (*Token) GetDomain

func (x *Token) GetDomain() string

func (*Token) GetGrantType

func (x *Token) GetGrantType() GrantType

func (*Token) GetIssueAt

func (x *Token) GetIssueAt() int64

func (*Token) GetNamespace added in v1.1.0

func (x *Token) GetNamespace() string

func (*Token) GetRefreshExpiredAt

func (x *Token) GetRefreshExpiredAt() int64

func (*Token) GetRefreshToken

func (x *Token) GetRefreshToken() string

func (*Token) GetUserName added in v1.1.0

func (x *Token) GetUserName() string

func (*Token) ProtoMessage

func (*Token) ProtoMessage()

func (*Token) ProtoReflect

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

func (*Token) RefreshTokenOperator

func (s *Token) RefreshTokenOperator()

func (*Token) RefreshTokenValidate

func (t *Token) RefreshTokenValidate() error

func (*Token) Reset

func (x *Token) Reset()

func (*Token) String

func (x *Token) String() string

type TokenSet

type TokenSet struct {

	// 分页时,返回总数量
	// @gotags: json:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
	// 一页的数据
	// @gotags: json:"items"
	Items []*Token `protobuf:"bytes,2,rep,name=items,proto3" json:"items"`
	// contains filtered or unexported fields
}

TokenSet todo

func (*TokenSet) Descriptor deprecated

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

Deprecated: Use TokenSet.ProtoReflect.Descriptor instead.

func (*TokenSet) GetItems

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

func (*TokenSet) GetTotal

func (x *TokenSet) GetTotal() int64

func (*TokenSet) ProtoMessage

func (*TokenSet) ProtoMessage()

func (*TokenSet) ProtoReflect

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

func (*TokenSet) Reset

func (x *TokenSet) Reset()

func (*TokenSet) String

func (x *TokenSet) String() string

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

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 UpdateTokenRequest

type UpdateTokenRequest struct {

	// token id
	AccessToken string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// @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:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// @gotags: bson:"grant_type" json:"grant_type"
	GrantType GrantType `` /* 127-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*UpdateTokenRequest) Descriptor deprecated

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

Deprecated: Use UpdateTokenRequest.ProtoReflect.Descriptor instead.

func (*UpdateTokenRequest) GetAccessExpiredAt

func (x *UpdateTokenRequest) GetAccessExpiredAt() int64

func (*UpdateTokenRequest) GetAccessToken

func (x *UpdateTokenRequest) GetAccessToken() string

func (*UpdateTokenRequest) GetCreateAt

func (x *UpdateTokenRequest) GetCreateAt() int64

func (*UpdateTokenRequest) GetDomain

func (x *UpdateTokenRequest) GetDomain() string

func (*UpdateTokenRequest) GetGrantType

func (x *UpdateTokenRequest) GetGrantType() GrantType

func (*UpdateTokenRequest) GetNamespace added in v1.1.0

func (x *UpdateTokenRequest) GetNamespace() string

func (*UpdateTokenRequest) GetRefreshExpiredAt

func (x *UpdateTokenRequest) GetRefreshExpiredAt() int64

func (*UpdateTokenRequest) GetRefreshToken

func (x *UpdateTokenRequest) GetRefreshToken() string

func (*UpdateTokenRequest) ProtoMessage

func (*UpdateTokenRequest) ProtoMessage()

func (*UpdateTokenRequest) ProtoReflect

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

func (*UpdateTokenRequest) Reset

func (x *UpdateTokenRequest) Reset()

func (*UpdateTokenRequest) String

func (x *UpdateTokenRequest) String() string

type ValidateTokenRequest

type ValidateTokenRequest struct {

	// @gotags: json:"id"
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"id"`
	// @gotags: bson:"domain" json:"domain,omitempty"
	Domain string `protobuf:"bytes,8,opt,name=domain,proto3" json:"domain,omitempty" bson:"domain"`
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// contains filtered or unexported fields
}

func NewValidateTokenRequest

func NewValidateTokenRequest(id, domain string) *ValidateTokenRequest

func NewValidateTokenRequestHttp

func NewValidateTokenRequestHttp(r *http.Request) *ValidateTokenRequest

func NewValidateTokenReuquestWithID

func NewValidateTokenReuquestWithID(id, domain 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) GetDomain

func (x *ValidateTokenRequest) GetDomain() string

func (*ValidateTokenRequest) GetNamespace added in v1.1.0

func (x *ValidateTokenRequest) GetNamespace() 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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