application

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 20 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
)
View Source
const (
	AppName = "application"
)

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 File_app_application_pb_application_proto protoreflect.FileDescriptor
View Source
var File_app_application_pb_request_proto protoreflect.FileDescriptor
View Source
var File_app_application_pb_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.keyauth.application.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateApplication",
			Handler:    _Service_CreateApplication_Handler,
		},
		{
			MethodName: "DescribeApplication",
			Handler:    _Service_DescribeApplication_Handler,
		},
		{
			MethodName: "QueryApplication",
			Handler:    _Service_QueryApplication_Handler,
		},
		{
			MethodName: "DeleteApplication",
			Handler:    _Service_DeleteApplication_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "app/application/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 RegisterServiceServer added in v0.6.4

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Application

type Application struct {

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

NewUserApplicartion 新建实例

func (*Application) CheckClientSecret

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

CheckClientSecret 判断凭证是否合法

func (*Application) Descriptor deprecated

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

Deprecated: Use Application.ProtoReflect.Descriptor instead.

func (*Application) GetAccessTokenExpireSecond

func (x *Application) GetAccessTokenExpireSecond() int64

func (*Application) GetBuildIn

func (x *Application) GetBuildIn() bool

func (*Application) GetClientId

func (x *Application) GetClientId() string

func (*Application) GetClientSecret

func (x *Application) GetClientSecret() string

func (*Application) GetClientType

func (x *Application) GetClientType() ClientType

func (*Application) GetCreateAt

func (x *Application) GetCreateAt() int64

func (*Application) GetCreateBy

func (x *Application) GetCreateBy() string

func (*Application) GetDescription

func (x *Application) GetDescription() string

func (*Application) GetDomain

func (x *Application) GetDomain() string

func (*Application) GetId

func (x *Application) GetId() string

func (*Application) GetLocked

func (x *Application) GetLocked() bool

func (*Application) GetLogoImage

func (x *Application) GetLogoImage() string

func (*Application) GetName

func (x *Application) GetName() string

func (*Application) GetRedirectUri

func (x *Application) GetRedirectUri() string

func (*Application) GetRefreshTokenExpireSecond

func (x *Application) GetRefreshTokenExpireSecond() int64

func (*Application) GetUpdateAt

func (x *Application) GetUpdateAt() int64

func (*Application) GetWebsite

func (x *Application) GetWebsite() string

func (*Application) IsOwner

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

func (*Application) ProtoMessage

func (*Application) ProtoMessage()

func (*Application) ProtoReflect

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

func (*Application) Reset

func (x *Application) Reset()

func (*Application) String

func (x *Application) String() string

type ClientType

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

func ParseClientTypeFromString

func ParseClientTypeFromString(str string) (ClientType, error)

ParseClientTypeFromString Parse ClientType from string

func (ClientType) Descriptor

func (ClientType) Descriptor() protoreflect.EnumDescriptor

func (ClientType) Enum

func (x ClientType) Enum() *ClientType

func (ClientType) EnumDescriptor deprecated

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

Deprecated: Use ClientType.Descriptor instead.

func (ClientType) Equal

func (t ClientType) Equal(target ClientType) bool

Equal type compare

func (ClientType) IsIn

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

IsIn todo

func (ClientType) MarshalJSON

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

MarshalJSON todo

func (ClientType) Number

func (x ClientType) Number() protoreflect.EnumNumber

func (ClientType) String

func (x ClientType) String() string

func (ClientType) Type

func (*ClientType) UnmarshalJSON

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

UnmarshalJSON todo

type CreateApplicatonRequest

type CreateApplicatonRequest struct {

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

CreateApplicatonRequest 创建应用请求

func NewCreateApplicatonRequest

func NewCreateApplicatonRequest() *CreateApplicatonRequest

NewCreateApplicatonRequest 请求

func (*CreateApplicatonRequest) Descriptor deprecated

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

Deprecated: Use CreateApplicatonRequest.ProtoReflect.Descriptor instead.

func (*CreateApplicatonRequest) GetAccessTokenExpireSecond

func (x *CreateApplicatonRequest) GetAccessTokenExpireSecond() int64

func (*CreateApplicatonRequest) GetBuildIn

func (x *CreateApplicatonRequest) GetBuildIn() bool

func (*CreateApplicatonRequest) GetClientType

func (x *CreateApplicatonRequest) GetClientType() ClientType

func (*CreateApplicatonRequest) GetCreateBy

func (x *CreateApplicatonRequest) GetCreateBy() string

func (*CreateApplicatonRequest) GetDescription

func (x *CreateApplicatonRequest) GetDescription() string

func (*CreateApplicatonRequest) GetDomain

func (x *CreateApplicatonRequest) GetDomain() string

func (*CreateApplicatonRequest) GetLogoImage

func (x *CreateApplicatonRequest) GetLogoImage() string

func (*CreateApplicatonRequest) GetName

func (x *CreateApplicatonRequest) GetName() string

func (*CreateApplicatonRequest) GetRedirectUri

func (x *CreateApplicatonRequest) GetRedirectUri() string

func (*CreateApplicatonRequest) GetRefreshTokenExpireSecond

func (x *CreateApplicatonRequest) GetRefreshTokenExpireSecond() int64

func (*CreateApplicatonRequest) GetWebsite

func (x *CreateApplicatonRequest) GetWebsite() string

func (*CreateApplicatonRequest) ProtoMessage

func (*CreateApplicatonRequest) ProtoMessage()

func (*CreateApplicatonRequest) ProtoReflect

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

func (*CreateApplicatonRequest) Reset

func (x *CreateApplicatonRequest) Reset()

func (*CreateApplicatonRequest) String

func (x *CreateApplicatonRequest) String() string

func (*CreateApplicatonRequest) UpdateOwner

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

func (*CreateApplicatonRequest) Validate

func (req *CreateApplicatonRequest) Validate() error

Validate 请求校验

type DeleteApplicationRequest

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

DeleteApplicationRequest 查询应用详情

func NewDeleteApplicationRequestWithID

func NewDeleteApplicationRequestWithID(id string) *DeleteApplicationRequest

NewDeleteApplicationRequestWithID todo

func (*DeleteApplicationRequest) Descriptor deprecated

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

Deprecated: Use DeleteApplicationRequest.ProtoReflect.Descriptor instead.

func (*DeleteApplicationRequest) GetId

func (x *DeleteApplicationRequest) GetId() string

func (*DeleteApplicationRequest) ProtoMessage

func (*DeleteApplicationRequest) ProtoMessage()

func (*DeleteApplicationRequest) ProtoReflect

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

func (*DeleteApplicationRequest) Reset

func (x *DeleteApplicationRequest) Reset()

func (*DeleteApplicationRequest) String

func (x *DeleteApplicationRequest) String() string

type DescribeApplicationRequest

type DescribeApplicationRequest struct {

	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// @gotags: json:"client_id"
	ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id"`
	// contains filtered or unexported fields
}

DescribeApplicationRequest 查询应用详情

func NewDescriptApplicationRequest

func NewDescriptApplicationRequest() *DescribeApplicationRequest

NewDescriptApplicationRequest new实例

func (*DescribeApplicationRequest) Descriptor deprecated

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

Deprecated: Use DescribeApplicationRequest.ProtoReflect.Descriptor instead.

func (*DescribeApplicationRequest) GetClientId

func (x *DescribeApplicationRequest) GetClientId() string

func (*DescribeApplicationRequest) GetId

func (*DescribeApplicationRequest) ProtoMessage

func (*DescribeApplicationRequest) ProtoMessage()

func (*DescribeApplicationRequest) ProtoReflect

func (*DescribeApplicationRequest) Reset

func (x *DescribeApplicationRequest) Reset()

func (*DescribeApplicationRequest) String

func (x *DescribeApplicationRequest) String() string

func (*DescribeApplicationRequest) Validate

func (req *DescribeApplicationRequest) Validate() error

Validate 校验详情查询请求

type GetBuildInApplicationRequest

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

GetBuildInApplicationRequest 获取内建应用

func NewGetBuildInAdminApplicationRequest

func NewGetBuildInAdminApplicationRequest() *GetBuildInApplicationRequest

NewGetBuildInAdminApplicationRequest todo

func (*GetBuildInApplicationRequest) Descriptor deprecated

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

Deprecated: Use GetBuildInApplicationRequest.ProtoReflect.Descriptor instead.

func (*GetBuildInApplicationRequest) GetName

func (x *GetBuildInApplicationRequest) GetName() string

func (*GetBuildInApplicationRequest) ProtoMessage

func (*GetBuildInApplicationRequest) ProtoMessage()

func (*GetBuildInApplicationRequest) ProtoReflect

func (*GetBuildInApplicationRequest) Reset

func (x *GetBuildInApplicationRequest) Reset()

func (*GetBuildInApplicationRequest) String

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

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

Deprecated: Use QueryApplicationRequest.ProtoReflect.Descriptor instead.

func (*QueryApplicationRequest) GetAccount

func (x *QueryApplicationRequest) GetAccount() string

func (*QueryApplicationRequest) GetPage

func (*QueryApplicationRequest) ProtoMessage

func (*QueryApplicationRequest) ProtoMessage()

func (*QueryApplicationRequest) ProtoReflect

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

func (*QueryApplicationRequest) Reset

func (x *QueryApplicationRequest) Reset()

func (*QueryApplicationRequest) String

func (x *QueryApplicationRequest) String() string

type ServiceClient added in v0.6.4

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

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

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer added in v0.6.4

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

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 []*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

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

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems

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

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 UnimplementedServiceServer added in v0.6.4

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) CreateApplication added in v0.6.4

func (UnimplementedServiceServer) DeleteApplication added in v0.6.4

func (UnimplementedServiceServer) DescribeApplication added in v0.6.4

func (UnimplementedServiceServer) QueryApplication added in v0.6.4

type UnsafeServiceServer added in v0.6.4

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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