application

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AdminWebApplicationName 颁发给后台管理Web端的凭证
	AdminWebApplicationName = "admin-web"
	// AdminServiceApplicationName 颁发给服务管理的应用凭证
	AdminServiceApplicationName = "admin-micro"
)
View Source
const (
	// DefaultAccessTokenExpireSecond token默认过期时长
	DefaultAccessTokenExpireSecond = 3600
	// DefaultRefreshTokenExpiredSecond 刷新token默认过期时间
	DefaultRefreshTokenExpiredSecond = DefaultAccessTokenExpireSecond * 4
)

Variables

View Source
var (
	ClientType_name = map[int32]string{
		0: "CONFIDENTIAL",
		1: "PUBLIC",
	}
	ClientType_value = map[string]int32{
		"CONFIDENTIAL": 0,
		"PUBLIC":       1,
	}
)

Enum value maps for ClientType.

View Source
var ApplicationService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "keyauth.application.ApplicationService",
	HandlerType: (*ApplicationServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateApplication",
			Handler:    _ApplicationService_CreateApplication_Handler,
		},
		{
			MethodName: "DescribeApplication",
			Handler:    _ApplicationService_DescribeApplication_Handler,
		},
		{
			MethodName: "QueryApplication",
			Handler:    _ApplicationService_QueryApplication_Handler,
		},
		{
			MethodName: "DeleteApplication",
			Handler:    _ApplicationService_DeleteApplication_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/application/pb/service.proto",
}

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

View Source
var File_pkg_application_pb_application_proto protoreflect.FileDescriptor
View Source
var File_pkg_application_pb_request_proto protoreflect.FileDescriptor
View Source
var File_pkg_application_pb_service_proto protoreflect.FileDescriptor

Functions

func HttpEntry added in v0.2.0

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterApplicationServiceServer added in v0.5.5

func RegisterApplicationServiceServer(s grpc.ServiceRegistrar, srv ApplicationServiceServer)

Types

type Application

type Application struct {

	// 唯一ID
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// 是否是内建应用
	BuildIn bool `protobuf:"varint,2,opt,name=build_in,json=buildIn,proto3" json:"build_in" bson:"build_in"`
	// 所处于域
	Domain string `protobuf:"bytes,3,opt,name=domain,proto3" json:"domain" bson:"domain"`
	// 应用属于那个用户
	CreateBy string `protobuf:"bytes,4,opt,name=create_by,json=createBy,proto3" json:"create_by" bson:"user"`
	// 应用创建的时间
	CreateAt int64 `protobuf:"varint,5,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"`
	// 应用更新的时间
	UpdateAt int64 `protobuf:"varint,6,opt,name=update_at,json=updateAt,proto3" json:"update_at" bson:"update_at"`
	// 应用客户端ID
	ClientId string `protobuf:"bytes,7,opt,name=client_id,json=clientId,proto3" json:"client_id" bson:"client_id"`
	// 应用客户端秘钥
	ClientSecret string `protobuf:"bytes,8,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret" bson:"client_secret"`
	// 是否冻结应用, 冻结应用后, 该应用无法通过凭证获取访问凭证(token)
	Locked bool `protobuf:"varint,9,opt,name=locked,proto3" json:"locked" bson:"locked"`
	// 应用名称
	Name string `protobuf:"bytes,10,opt,name=name,proto3" json:"name" bson:"name"`
	// 应用的网站地址
	Website string `protobuf:"bytes,11,opt,name=website,proto3" json:"website" bson:"website"`
	// 应用的LOGO
	LogoImage string `protobuf:"bytes,12,opt,name=logo_image,json=logoImage,proto3" json:"logo_image" bson:"logo_image"`
	// 应用简单的描述
	Description string `protobuf:"bytes,13,opt,name=description,proto3" json:"description" bson:"description"`
	// 应用重定向URI, Oauht2时需要该参数
	RedirectUri string `protobuf:"bytes,14,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri" bson:"redirect_uri"`
	// 应用申请的token的过期时间
	AccessTokenExpireSecond int64 `` /* 160-byte string literal not displayed */
	// 刷新token过期时间
	RefreshTokenExpireSecond int64 `` /* 164-byte string literal not displayed */
	// 客户端类型
	ClientType ClientType `` /* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

Application is oauth2's client: https://tools.ietf.org/html/rfc6749#section-2

func NewBuildInApplication

func NewBuildInApplication(account string, req *CreateApplicatonRequest) (*Application, error)

NewBuildInApplication 构建内建应用

func NewUserApplicartion

func NewUserApplicartion(account string, req *CreateApplicatonRequest) (*Application, error)

NewUserApplicartion 新建实例

func (*Application) CheckClientSecret

func (a *Application) CheckClientSecret(secret string) error

CheckClientSecret 判断凭证是否合法

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

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

Deprecated: Use Application.ProtoReflect.Descriptor instead.

func (*Application) GetAccessTokenExpireSecond added in v0.2.0

func (x *Application) GetAccessTokenExpireSecond() int64

func (*Application) GetBuildIn added in v0.2.0

func (x *Application) GetBuildIn() bool

func (*Application) GetClientId added in v0.2.0

func (x *Application) GetClientId() string

func (*Application) GetClientSecret added in v0.2.0

func (x *Application) GetClientSecret() string

func (*Application) GetClientType added in v0.2.0

func (x *Application) GetClientType() ClientType

func (*Application) GetCreateAt added in v0.2.0

func (x *Application) GetCreateAt() int64

func (*Application) GetCreateBy added in v0.5.5

func (x *Application) GetCreateBy() string

func (*Application) GetDescription added in v0.2.0

func (x *Application) GetDescription() string

func (*Application) GetDomain added in v0.2.0

func (x *Application) GetDomain() string

func (*Application) GetId added in v0.2.0

func (x *Application) GetId() string

func (*Application) GetLocked added in v0.2.0

func (x *Application) GetLocked() bool

func (*Application) GetLogoImage added in v0.2.0

func (x *Application) GetLogoImage() string

func (*Application) GetName added in v0.2.0

func (x *Application) GetName() string

func (*Application) GetRedirectUri added in v0.2.0

func (x *Application) GetRedirectUri() string

func (*Application) GetRefreshTokenExpireSecond added in v0.2.0

func (x *Application) GetRefreshTokenExpireSecond() int64

func (*Application) GetUpdateAt added in v0.2.0

func (x *Application) GetUpdateAt() int64

func (*Application) GetWebsite added in v0.2.0

func (x *Application) GetWebsite() string

func (*Application) IsOwner added in v0.5.5

func (a *Application) IsOwner(account string) bool

func (*Application) ProtoMessage added in v0.2.0

func (*Application) ProtoMessage()

func (*Application) ProtoReflect added in v0.2.0

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

func (*Application) Reset added in v0.2.0

func (x *Application) Reset()

func (*Application) String added in v0.2.0

func (x *Application) String() string

type ApplicationServiceClient added in v0.5.5

type ApplicationServiceClient interface {
	CreateApplication(ctx context.Context, in *CreateApplicatonRequest, opts ...grpc.CallOption) (*Application, error)
	DescribeApplication(ctx context.Context, in *DescribeApplicationRequest, opts ...grpc.CallOption) (*Application, error)
	QueryApplication(ctx context.Context, in *QueryApplicationRequest, opts ...grpc.CallOption) (*Set, error)
	DeleteApplication(ctx context.Context, in *DeleteApplicationRequest, opts ...grpc.CallOption) (*Application, error)
}

ApplicationServiceClient is the client API for ApplicationService 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 NewApplicationServiceClient added in v0.5.5

func NewApplicationServiceClient(cc grpc.ClientConnInterface) ApplicationServiceClient

type ApplicationServiceServer added in v0.5.5

type ApplicationServiceServer interface {
	CreateApplication(context.Context, *CreateApplicatonRequest) (*Application, error)
	DescribeApplication(context.Context, *DescribeApplicationRequest) (*Application, error)
	QueryApplication(context.Context, *QueryApplicationRequest) (*Set, error)
	DeleteApplication(context.Context, *DeleteApplicationRequest) (*Application, error)
	// contains filtered or unexported methods
}

ApplicationServiceServer is the server API for ApplicationService service. All implementations must embed UnimplementedApplicationServiceServer for forward compatibility

type ClientType

type ClientType int32
const (
	ClientType_CONFIDENTIAL ClientType = 0
	ClientType_PUBLIC       ClientType = 1
)

func ParseClientTypeFromString added in v0.2.0

func ParseClientTypeFromString(str string) (ClientType, error)

ParseClientTypeFromString Parse ClientType from string

func (ClientType) Descriptor added in v0.2.0

func (ClientType) Descriptor() protoreflect.EnumDescriptor

func (ClientType) Enum added in v0.2.0

func (x ClientType) Enum() *ClientType

func (ClientType) EnumDescriptor deprecated added in v0.2.0

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

Deprecated: Use ClientType.Descriptor instead.

func (ClientType) Equal added in v0.2.0

func (t ClientType) Equal(target ClientType) bool

Equal type compare

func (ClientType) IsIn added in v0.2.0

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

IsIn todo

func (ClientType) MarshalJSON added in v0.2.0

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

MarshalJSON todo

func (ClientType) Number added in v0.2.0

func (x ClientType) Number() protoreflect.EnumNumber

func (ClientType) String added in v0.2.0

func (x ClientType) String() string

func (ClientType) Type added in v0.2.0

func (*ClientType) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON todo

type CreateApplicatonRequest

type CreateApplicatonRequest struct {

	// 是否是内建应用
	BuildIn bool `protobuf:"varint,9,opt,name=build_in,json=buildIn,proto3" json:"build_in"`
	// 所处于域
	Domain string `protobuf:"bytes,10,opt,name=domain,proto3" json:"domain" validate:"required"`
	// 应用属于那个用户
	CreateBy string `protobuf:"bytes,11,opt,name=create_by,json=createBy,proto3" json:"create_by"`
	// 应用名称
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" validate:"required"`
	// 应用的网站地址
	Website string `protobuf:"bytes,2,opt,name=website,proto3" json:"website"`
	// 应用的LOGO
	LogoImage string `protobuf:"bytes,3,opt,name=logo_image,json=logoImage,proto3" json:"logo_image"`
	// 应用简单的描述
	Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description"`
	// 应用重定向URI, Oauht2时需要该参数
	RedirectUri string `protobuf:"bytes,5,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri"`
	// 应用申请的token的过期时间
	AccessTokenExpireSecond int64 `protobuf:"varint,6,opt,name=access_token_expire_second,json=accessTokenExpireSecond,proto3" json:"access_token_expire_second"`
	// 刷新token过期时间
	RefreshTokenExpireSecond int64 `` /* 128-byte string literal not displayed */
	// 客户端类型
	ClientType ClientType `protobuf:"varint,8,opt,name=client_type,json=clientType,proto3,enum=keyauth.application.ClientType" json:"client_type"`
	// contains filtered or unexported fields
}

CreateApplicatonRequest 创建应用请求

func NewCreateApplicatonRequest

func NewCreateApplicatonRequest() *CreateApplicatonRequest

NewCreateApplicatonRequest 请求

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

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

Deprecated: Use CreateApplicatonRequest.ProtoReflect.Descriptor instead.

func (*CreateApplicatonRequest) GetAccessTokenExpireSecond added in v0.2.0

func (x *CreateApplicatonRequest) GetAccessTokenExpireSecond() int64

func (*CreateApplicatonRequest) GetBuildIn added in v0.5.5

func (x *CreateApplicatonRequest) GetBuildIn() bool

func (*CreateApplicatonRequest) GetClientType added in v0.2.0

func (x *CreateApplicatonRequest) GetClientType() ClientType

func (*CreateApplicatonRequest) GetCreateBy added in v0.5.5

func (x *CreateApplicatonRequest) GetCreateBy() string

func (*CreateApplicatonRequest) GetDescription added in v0.2.0

func (x *CreateApplicatonRequest) GetDescription() string

func (*CreateApplicatonRequest) GetDomain added in v0.5.5

func (x *CreateApplicatonRequest) GetDomain() string

func (*CreateApplicatonRequest) GetLogoImage added in v0.2.0

func (x *CreateApplicatonRequest) GetLogoImage() string

func (*CreateApplicatonRequest) GetName added in v0.2.0

func (x *CreateApplicatonRequest) GetName() string

func (*CreateApplicatonRequest) GetRedirectUri added in v0.2.0

func (x *CreateApplicatonRequest) GetRedirectUri() string

func (*CreateApplicatonRequest) GetRefreshTokenExpireSecond added in v0.2.0

func (x *CreateApplicatonRequest) GetRefreshTokenExpireSecond() int64

func (*CreateApplicatonRequest) GetWebsite added in v0.2.0

func (x *CreateApplicatonRequest) GetWebsite() string

func (*CreateApplicatonRequest) ProtoMessage added in v0.2.0

func (*CreateApplicatonRequest) ProtoMessage()

func (*CreateApplicatonRequest) ProtoReflect added in v0.2.0

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

func (*CreateApplicatonRequest) Reset added in v0.2.0

func (x *CreateApplicatonRequest) Reset()

func (*CreateApplicatonRequest) String added in v0.2.0

func (x *CreateApplicatonRequest) String() string

func (*CreateApplicatonRequest) UpdateOwner added in v0.5.5

func (req *CreateApplicatonRequest) UpdateOwner(tk *token.Token)

func (*CreateApplicatonRequest) Validate

func (req *CreateApplicatonRequest) Validate() error

Validate 请求校验

type DeleteApplicationRequest added in v0.2.0

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

DeleteApplicationRequest 查询应用详情

func NewDeleteApplicationRequestWithID added in v0.2.0

func NewDeleteApplicationRequestWithID(id string) *DeleteApplicationRequest

NewDeleteApplicationRequestWithID todo

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

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

Deprecated: Use DeleteApplicationRequest.ProtoReflect.Descriptor instead.

func (*DeleteApplicationRequest) GetId added in v0.2.0

func (x *DeleteApplicationRequest) GetId() string

func (*DeleteApplicationRequest) ProtoMessage added in v0.2.0

func (*DeleteApplicationRequest) ProtoMessage()

func (*DeleteApplicationRequest) ProtoReflect added in v0.2.0

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

func (*DeleteApplicationRequest) Reset added in v0.2.0

func (x *DeleteApplicationRequest) Reset()

func (*DeleteApplicationRequest) String added in v0.2.0

func (x *DeleteApplicationRequest) String() string

type DescribeApplicationRequest added in v0.2.0

type DescribeApplicationRequest struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	// contains filtered or unexported fields
}

DescribeApplicationRequest 查询应用详情

func NewDescriptApplicationRequest

func NewDescriptApplicationRequest() *DescribeApplicationRequest

NewDescriptApplicationRequest new实例

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

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

Deprecated: Use DescribeApplicationRequest.ProtoReflect.Descriptor instead.

func (*DescribeApplicationRequest) GetClientId added in v0.2.0

func (x *DescribeApplicationRequest) GetClientId() string

func (*DescribeApplicationRequest) GetId added in v0.2.0

func (*DescribeApplicationRequest) ProtoMessage added in v0.2.0

func (*DescribeApplicationRequest) ProtoMessage()

func (*DescribeApplicationRequest) ProtoReflect added in v0.2.0

func (*DescribeApplicationRequest) Reset added in v0.2.0

func (x *DescribeApplicationRequest) Reset()

func (*DescribeApplicationRequest) String added in v0.2.0

func (x *DescribeApplicationRequest) String() string

func (*DescribeApplicationRequest) Validate added in v0.2.0

func (req *DescribeApplicationRequest) Validate() error

Validate 校验详情查询请求

type GetBuildInApplicationRequest added in v0.2.0

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

GetBuildInApplicationRequest 获取内建应用

func NewGetBuildInAdminApplicationRequest added in v0.2.0

func NewGetBuildInAdminApplicationRequest() *GetBuildInApplicationRequest

NewGetBuildInAdminApplicationRequest todo

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

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

Deprecated: Use GetBuildInApplicationRequest.ProtoReflect.Descriptor instead.

func (*GetBuildInApplicationRequest) GetName added in v0.2.0

func (x *GetBuildInApplicationRequest) GetName() string

func (*GetBuildInApplicationRequest) ProtoMessage added in v0.2.0

func (*GetBuildInApplicationRequest) ProtoMessage()

func (*GetBuildInApplicationRequest) ProtoReflect added in v0.2.0

func (*GetBuildInApplicationRequest) Reset added in v0.2.0

func (x *GetBuildInApplicationRequest) Reset()

func (*GetBuildInApplicationRequest) String added in v0.2.0

type QueryApplicationRequest

type QueryApplicationRequest struct {
	Page    *page.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page,omitempty"`
	Account string            `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"`
	// contains filtered or unexported fields
}

QueryApplicationRequest 查询应用列表

func NewQueryApplicationRequest

func NewQueryApplicationRequest(pageReq *request.PageRequest) *QueryApplicationRequest

NewQueryApplicationRequest 列表查询请求

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

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

Deprecated: Use QueryApplicationRequest.ProtoReflect.Descriptor instead.

func (*QueryApplicationRequest) GetAccount added in v0.2.0

func (x *QueryApplicationRequest) GetAccount() string

func (*QueryApplicationRequest) GetPage added in v0.2.0

func (*QueryApplicationRequest) ProtoMessage added in v0.2.0

func (*QueryApplicationRequest) ProtoMessage()

func (*QueryApplicationRequest) ProtoReflect added in v0.2.0

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

func (*QueryApplicationRequest) Reset added in v0.2.0

func (x *QueryApplicationRequest) Reset()

func (*QueryApplicationRequest) String added in v0.2.0

func (x *QueryApplicationRequest) String() string

type Set

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

func NewApplicationSet

func NewApplicationSet(req *request.PageRequest) *Set

NewApplicationSet 实例化

func (*Set) Add

func (s *Set) Add(app *Application)

Add 添加应用

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() []*Application

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 UnimplementedApplicationServiceServer added in v0.5.5

type UnimplementedApplicationServiceServer struct {
}

UnimplementedApplicationServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedApplicationServiceServer) CreateApplication added in v0.5.5

func (UnimplementedApplicationServiceServer) DeleteApplication added in v0.5.5

func (UnimplementedApplicationServiceServer) DescribeApplication added in v0.5.5

func (UnimplementedApplicationServiceServer) QueryApplication added in v0.5.5

type UnsafeApplicationServiceServer added in v0.5.5

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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