Documentation ¶
Index ¶
- Constants
- Variables
- func AuthUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func GetClientCredentialsFromHTTPRequest(r *http.Request) (cid, cs string)
- func GetPathEntry(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) GetRemoteIP() string
- func (c *GrpcInCtx) GetRequestID() string
- func (c *GrpcInCtx) GetToken() (*token.Token, error)
- func (c *GrpcInCtx) GetUserAgent() string
- 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)
- func (c GrpcInCtx) SetRemoteIP(ip string)
- func (c GrpcInCtx) SetRequestID(rid string)
- func (c GrpcInCtx) SetUserAgent(ua string)
- type GrpcOutCtx
- func (c *GrpcOutCtx) Context() context.Context
- func (c *GrpcOutCtx) GetToken() (*token.Token, error)
- func (c GrpcOutCtx) SetAccessToken(ak string)
- func (c GrpcOutCtx) SetClientCredentials(clientID, clientSecret string)
- func (c GrpcOutCtx) SetRemoteIP(ip string)
- func (c GrpcOutCtx) SetRequestID(rid string)
- func (c GrpcOutCtx) SetUserAgent(ua string)
- type HTTPAPI
- type OwnerChecker
- type Service
Constants ¶
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 = "x-user-agent" // RequestIDHeader todo RequestIDHeader = "x-request-id" )
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 ¶
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 // Mconf 微服务配置 Mconf mconf.MicroConfigServiceServer // Role 角色服务 Role role.RoleServiceServer // Endpoint 端点服务 Endpoint endpoint.EndpointServiceServer // Policy 厕所里 Policy policy.PolicyServiceServer // Tag 标签服务 Tag tag.TagServiceServer // 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 GetClientCredentialsFromHTTPRequest ¶ added in v0.3.2
func GetPathEntry ¶ added in v0.3.6
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 NewGrpcInCtxFromHTTPRequest ¶ added in v0.3.2
NewGrpcOutCtxFromHTTPRequest 从上下文中获取Token
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) GetRemoteIP ¶ added in v0.3.2
GetAccessToKen todo
func (*GrpcInCtx) GetRequestID ¶ added in v0.3.2
GetAccessToKen todo
func (*GrpcInCtx) GetUserAgent ¶ added in v0.3.2
GetAccessToKen 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
func (c GrpcInCtx) SetClientCredentials(clientID, clientSecret string)
SetClientCredentials todo
func (*GrpcInCtx) SetIsInternalCall ¶ added in v0.2.0
SetIsInternalCall 内部调用不需要认证, 直接传给server端的接口
func (GrpcInCtx) SetRemoteIP ¶ added in v0.3.2
func (c GrpcInCtx) SetRemoteIP(ip string)
SetRemoteIP todo
func (GrpcInCtx) SetRequestID ¶ added in v0.3.2
func (c GrpcInCtx) SetRequestID(rid string)
SetRemoteIP todo
func (GrpcInCtx) SetUserAgent ¶ added in v0.3.2
func (c GrpcInCtx) SetUserAgent(ua string)
SetUserAgent todo
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) SetClientCredentials ¶ added in v0.3.2
func (c GrpcOutCtx) SetClientCredentials(clientID, clientSecret string)
SetClientCredentials todo
func (GrpcOutCtx) SetRemoteIP ¶ added in v0.2.0
func (c GrpcOutCtx) SetRemoteIP(ip string)
SetRemoteIP todo
func (GrpcOutCtx) SetRequestID ¶ added in v0.3.2
func (c GrpcOutCtx) SetRequestID(rid string)
SetRemoteIP todo
func (GrpcOutCtx) SetUserAgent ¶ added in v0.2.0
func (c GrpcOutCtx) SetUserAgent(ua string)
SetUserAgent todo
type OwnerChecker ¶ added in v0.2.5
检测是不是owner请求