jwtclient

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxGetName added in v1.2.1

func CtxGetName(ctx context.Context) (name string, exists bool)

func CtxGetTokenLocation added in v1.2.1

func CtxGetTokenLocation(ctx context.Context) (location string, exists bool)

func CtxWithName added in v1.2.1

func CtxWithName(ctx context.Context, v string) context.Context

func CtxWithTokenLocation added in v1.2.1

func CtxWithTokenLocation(ctx context.Context, v string) context.Context

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 (*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

func (authMux *AuthMux) TrustHandle(pattern string, handler http.Handler)

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 CtxKey added in v1.2.1

type CtxKey int

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)

Jump to

Keyboard shortcuts

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