Documentation
¶
Index ¶
- func CtxGetName(ctx context.Context) (name string, exists bool)
- func CtxGetTokenLocation(ctx context.Context) (location string, exists bool)
- func CtxWithName(ctx context.Context, v string) context.Context
- func CtxWithTokenLocation(ctx context.Context, v string) context.Context
- func WarpLimitFinder(client *AuthClient) ratelimit.ILimitFinder
- type AuthClient
- func (lc *AuthClient) CreateUser(req *auth.CreateUserRequest) (*auth.CreateUserResponse, error)
- func (lc *AuthClient) DelMiner(miner string) (bool, error)
- func (lc *AuthClient) DelUserRateLimit(req *auth.DelUserRateLimitReq) (string, error)
- func (lc *AuthClient) DeleteUser(req *auth.DeleteUserRequest) error
- func (lc *AuthClient) GenerateToken(name, perm, extra string) (string, error)
- func (lc *AuthClient) GetToken(name, token string) ([]*auth.TokenInfo, error)
- func (lc *AuthClient) GetUser(req *auth.GetUserRequest) (*auth.OutputUser, error)
- func (lc *AuthClient) GetUserByMiner(req *auth.GetUserByMinerRequest) (*auth.OutputUser, error)
- func (lc *AuthClient) GetUserRateLimit(name, id string) (auth.GetUserRateLimitResponse, error)
- func (lc *AuthClient) HasMiner(req *auth.HasMinerRequest) (bool, error)
- func (lc *AuthClient) HasUser(req *auth.HasUserRequest) (bool, error)
- func (lc *AuthClient) ListMiners(user string) (auth.ListMinerResp, error)
- func (lc *AuthClient) ListUsers(req *auth.ListUsersRequest) (auth.ListUsersResponse, error)
- func (lc *AuthClient) ListUsersWithMiners(req *auth.ListUsersRequest) (auth.ListUsersResponse, error)
- func (lc *AuthClient) RecoverToken(token string) error
- func (lc *AuthClient) RecoverUser(req *auth.RecoverUserRequest) error
- func (lc *AuthClient) RemoveToken(token string) error
- func (lc *AuthClient) Tokens(skip, limit int64) (auth.GetTokensResponse, error)
- func (lc *AuthClient) UpdateUser(req *auth.UpdateUserRequest) error
- func (lc *AuthClient) UpsertMiner(user, miner string) (bool, error)
- func (lc *AuthClient) UpsertUserRateLimit(req *auth.UpsertUserRateLimitReq) (string, error)
- func (lc *AuthClient) Verify(ctx context.Context, token string) (*auth.VerifyResponse, error)
- type AuthMux
- type CtxKey
- type IJwtAuthClient
- type Logger
- type ValueFromCtx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CtxGetTokenLocation ¶ added in v1.2.1
func CtxWithTokenLocation ¶ added in v1.2.1
func WarpLimitFinder ¶ added in v1.3.0
func WarpLimitFinder(client *AuthClient) ratelimit.ILimitFinder
Types ¶
type AuthClient ¶ added in v1.4.0
type AuthClient struct {
// contains filtered or unexported fields
}
func NewAuthClient ¶ added in v1.4.0
func NewAuthClient(url string) (*AuthClient, error)
func (*AuthClient) CreateUser ¶ added in v1.4.0
func (lc *AuthClient) CreateUser(req *auth.CreateUserRequest) (*auth.CreateUserResponse, error)
func (*AuthClient) DelMiner ¶ added in v1.4.0
func (lc *AuthClient) DelMiner(miner string) (bool, error)
func (*AuthClient) DelUserRateLimit ¶ added in v1.4.0
func (lc *AuthClient) DelUserRateLimit(req *auth.DelUserRateLimitReq) (string, error)
func (*AuthClient) DeleteUser ¶ added in v1.6.0
func (lc *AuthClient) DeleteUser(req *auth.DeleteUserRequest) error
func (*AuthClient) GenerateToken ¶ added in v1.4.0
func (lc *AuthClient) GenerateToken(name, perm, extra string) (string, error)
func (*AuthClient) GetToken ¶ added in v1.6.0
func (lc *AuthClient) GetToken(name, token string) ([]*auth.TokenInfo, error)
func (*AuthClient) GetUser ¶ added in v1.4.0
func (lc *AuthClient) GetUser(req *auth.GetUserRequest) (*auth.OutputUser, error)
func (*AuthClient) GetUserByMiner ¶ added in v1.4.0
func (lc *AuthClient) GetUserByMiner(req *auth.GetUserByMinerRequest) (*auth.OutputUser, error)
func (*AuthClient) GetUserRateLimit ¶ added in v1.4.0
func (lc *AuthClient) GetUserRateLimit(name, id string) (auth.GetUserRateLimitResponse, error)
func (*AuthClient) HasMiner ¶ added in v1.4.0
func (lc *AuthClient) HasMiner(req *auth.HasMinerRequest) (bool, error)
func (*AuthClient) HasUser ¶ added in v1.6.0
func (lc *AuthClient) HasUser(req *auth.HasUserRequest) (bool, error)
func (*AuthClient) ListMiners ¶ added in v1.4.0
func (lc *AuthClient) ListMiners(user string) (auth.ListMinerResp, error)
func (*AuthClient) ListUsers ¶ added in v1.4.0
func (lc *AuthClient) ListUsers(req *auth.ListUsersRequest) (auth.ListUsersResponse, error)
func (*AuthClient) ListUsersWithMiners ¶ added in v1.4.0
func (lc *AuthClient) ListUsersWithMiners(req *auth.ListUsersRequest) (auth.ListUsersResponse, error)
func (*AuthClient) RecoverToken ¶ added in v1.6.0
func (lc *AuthClient) RecoverToken(token string) error
func (*AuthClient) RecoverUser ¶ added in v1.6.0
func (lc *AuthClient) RecoverUser(req *auth.RecoverUserRequest) error
func (*AuthClient) RemoveToken ¶ added in v1.4.0
func (lc *AuthClient) RemoveToken(token string) error
func (*AuthClient) Tokens ¶ added in v1.4.0
func (lc *AuthClient) Tokens(skip, limit int64) (auth.GetTokensResponse, error)
func (*AuthClient) UpdateUser ¶ added in v1.4.0
func (lc *AuthClient) UpdateUser(req *auth.UpdateUserRequest) error
UpdateUser
func (*AuthClient) UpsertMiner ¶ added in v1.4.0
func (lc *AuthClient) UpsertMiner(user, miner string) (bool, error)
func (*AuthClient) UpsertUserRateLimit ¶ added in v1.4.0
func (lc *AuthClient) UpsertUserRateLimit(req *auth.UpsertUserRateLimitReq) (string, error)
func (*AuthClient) Verify ¶ added in v1.4.0
func (lc *AuthClient) Verify(ctx context.Context, token string) (*auth.VerifyResponse, error)
type AuthMux ¶ added in v1.2.1
type AuthMux struct {
// contains filtered or unexported fields
}
AuthMux used with jsonrpc library to verify whether the request is legal
func NewAuthMux ¶ added in v1.2.1
func NewAuthMux(local, remote IJwtAuthClient, handler http.Handler) *AuthMux
func (*AuthMux) ServeHTTP ¶ added in v1.2.1
func (authMux *AuthMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*AuthMux) TrustHandle ¶ added in v1.2.1
TrustHandle for requests that can be accessed directly if 'pattern' with '/' as suffix, 'TrustHandler' treat it as a root path, that it's all sub-path will be trusted. if 'pattern' have no '/' with suffix, only the URI exactly matches the 'pattern' would be treat as trusted.
type IJwtAuthClient ¶ added in v1.2.1
type IJwtAuthClient interface {
Verify(ctx context.Context, token string) ([]auth.Permission, error)
}
func WarpIJwtAuthClient ¶ added in v1.3.0
func WarpIJwtAuthClient(cli *AuthClient) IJwtAuthClient
type Logger ¶ added in v1.3.0
type Logger interface { Info(args ...interface{}) Infof(template string, args ...interface{}) Warn(args ...interface{}) Warnf(template string, args ...interface{}) Error(args ...interface{}) Errorf(template string, args ...interface{}) Debug(args ...interface{}) Debugf(template string, args ...interface{}) }
type ValueFromCtx ¶ added in v1.3.0
type ValueFromCtx struct{}
func (*ValueFromCtx) AccFromCtx ¶ added in v1.3.0
func (vfc *ValueFromCtx) AccFromCtx(ctx context.Context) (string, bool)
func (*ValueFromCtx) HostFromCtx ¶ added in v1.3.0
func (vfc *ValueFromCtx) HostFromCtx(ctx context.Context) (string, bool)
Click to show internal directories.
Click to hide internal directories.