Documentation ¶
Index ¶
- Constants
- Variables
- func AuthUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func GetGrpcPathEntry(path string) *http.Entry
- func GetTokenFromGrpcInCtx(ctx context.Context) (*token.Token, error)
- func HTTPEntry() *http.EntrySet
- func InitService() error
- func InitV1GRPCAPI(server *grpc.Server)
- func InitV1HTTPAPI(pathPrefix string, root router.Router) error
- func LoadedHTTP() []string
- func LoadedService() []string
- func NewExceptionFromTrailer(md metadata.MD, err error) exception.APIException
- func RegistryHTTPV1(name string, api HTTPAPI)
- func RegistryService(name string, svr Service)
- type GrpcInCtx
- func (c *GrpcInCtx) ClearInternl() *GrpcInCtx
- func (c *GrpcInCtx) Context() context.Context
- func (c *GrpcInCtx) GetAccessToKen() string
- func (c *GrpcInCtx) GetClientID() string
- func (c *GrpcInCtx) GetClientSecret() string
- func (c *GrpcInCtx) GetToken() (*token.Token, error)
- func (c *GrpcInCtx) InternalCallToken() *token.Token
- func (c *GrpcInCtx) IsInternalCall() bool
- func (c GrpcInCtx) SetAccessToken(ak string)
- func (c *GrpcInCtx) SetClientCredentials(clientID, clientSecret string)
- func (c *GrpcInCtx) SetIsInternalCall(account, domain string)
- type GrpcOutCtx
- type HTTPAPI
- type Service
Constants ¶
View Source
const ( // InternalCallTokenHeader todo InternalCallTokenHeader = "internal-call-token" // ClientIDHeader tood ClientIDHeader = "client-id" // ClientSecretHeader todo ClientSecretHeader = "client-secret" // OauthTokenHeader todo OauthTokenHeader = "x-oauth-token" // RealIPHeader todo RealIPHeader = "x-real-ip" // UserAgentHeader todo UserAgentHeader = "user-agent" )
View Source
const ( // ResponseCodeHeader todo ResponseCodeHeader = "x-rpc-code" // ResponseReasonHeader todo ResponseReasonHeader = "x-rpc-reason" // ResponseDescHeader todo ResponseDescHeader = "x-rpc-desc" // ResponseMetaHeader todo ResponseMetaHeader = "x-rpc-meta" // ResponseDataHeader todo ResponseDataHeader = "x-rpc-data" )
Variables ¶
View Source
var ( // Domain 服务 Domain domain.DomainServiceServer // User 用户服务 User user.UserServiceServer // ApplicationUser 应用 ApplicationUser application.UserServiceServer // ApplicationAdmin 应用 ApplicationAdmin application.AdminServiceServer // Token 令牌服务 Token token.TokenServiceServer // Micro todo Micro micro.MicroServiceServer // Role 角色服务 Role role.RoleServiceServer // Endpoint 端点服务 Endpoint endpoint.EndpointServiceServer // Policy 厕所里 Policy policy.PolicyServiceServer // Department 部分服务 Department department.DepartmentServiceServer // Namespace todo Namespace namespace.NamespaceServiceServer // Permission 权限服务 Permission permission.PermissionServiceServer // Counter 自增ID服务 Counter counter.Service // LDAP ldap服务 LDAP provider.LDAP // GEOIP geoip服务 GEOIP geoip.Service // IP2Region ip位置查询 IP2Region ip2region.Service // Storage 对象存储服务 Storage storage.Service // SessionAdmin 审计服务 SessionAdmin session.AdminServiceServer // SessionUser todo SessionUser session.UserServiceServer // System 系统服务 System system.Service // VerifyCode 校验码服务 VerifyCode verifycode.VerifyCodeServiceServer )
Functions ¶
func AuthUnaryServerInterceptor ¶ added in v0.2.0
func AuthUnaryServerInterceptor() grpc.UnaryServerInterceptor
AuthUnaryServerInterceptor returns a new unary server interceptor for auth.
func GetGrpcPathEntry ¶ added in v0.2.0
GetGrpcPathEntry todo
func GetTokenFromGrpcInCtx ¶ added in v0.2.0
GetTokenFromGrpcInCtx todo
func InitV1HTTPAPI ¶
InitV1HTTPAPI 初始化API服务
func NewExceptionFromTrailer ¶ added in v0.2.0
func NewExceptionFromTrailer(md metadata.MD, err error) exception.APIException
NewExceptionFromTrailer todo
Types ¶
type GrpcInCtx ¶ added in v0.2.0
type GrpcInCtx struct {
// contains filtered or unexported fields
}
GrpcInCtx todo
func GetGrpcInCtx ¶ added in v0.2.0
GetGrpcInCtx todo
func NewInternalMockGrpcCtx ¶ added in v0.2.0
NewInternalMockGrpcCtx todo
func (*GrpcInCtx) ClearInternl ¶ added in v0.2.0
ClearInternl todo
func (*GrpcInCtx) GetAccessToKen ¶ added in v0.2.0
GetAccessToKen todo
func (*GrpcInCtx) GetClientID ¶ added in v0.2.0
GetClientID todo
func (*GrpcInCtx) GetClientSecret ¶ added in v0.2.0
GetClientSecret todo
func (*GrpcInCtx) InternalCallToken ¶ added in v0.2.0
InternalCallToken 是不是内部调用
func (*GrpcInCtx) IsInternalCall ¶ added in v0.2.0
IsInternalCall todo
func (GrpcInCtx) SetAccessToken ¶ added in v0.2.0
func (c GrpcInCtx) SetAccessToken(ak string)
SetAccessToken todo
func (*GrpcInCtx) SetClientCredentials ¶ added in v0.2.0
SetClientCredentials todo
func (*GrpcInCtx) SetIsInternalCall ¶ added in v0.2.0
SetIsInternalCall 内部调用不需要认证, 直接传给server端的接口
type GrpcOutCtx ¶ added in v0.2.0
type GrpcOutCtx struct {
// contains filtered or unexported fields
}
GrpcOutCtx todo
func NewGrpcOutCtxFromHTTPRequest ¶ added in v0.2.0
func NewGrpcOutCtxFromHTTPRequest(r *http.Request) (*GrpcOutCtx, error)
NewGrpcOutCtxFromHTTPRequest 从上下文中获取Token
func (*GrpcOutCtx) Context ¶ added in v0.2.0
func (c *GrpcOutCtx) Context() context.Context
Context todo
func (*GrpcOutCtx) GetToken ¶ added in v0.2.0
func (c *GrpcOutCtx) GetToken() (*token.Token, error)
GetToken todo
func (GrpcOutCtx) SetAccessToken ¶ added in v0.2.0
func (c GrpcOutCtx) SetAccessToken(ak string)
SetAccessToken todo
func (*GrpcOutCtx) SetRemoteIP ¶ added in v0.2.0
func (c *GrpcOutCtx) SetRemoteIP(ip string)
SetRemoteIP todo
func (*GrpcOutCtx) SetUserAgent ¶ added in v0.2.0
func (c *GrpcOutCtx) SetUserAgent(ua string)
SetUserAgent todo
Source Files ¶
Click to show internal directories.
Click to hide internal directories.