jwtauth

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyInfoNotFound = fmt.Errorf("key info not found")
)

Functions

This section is empty.

Types

type APIAlg

type APIAlg jwt3.HMACSHA

type AuthMux added in v0.9.4

type AuthMux struct {
	// contains filtered or unexported fields
}

AuthMux used with jsonrpc library to verify whether the request is legal

func NewAuthMux added in v0.9.4

func NewAuthMux(jwtCli IJwtAuthClient, serveMux *http.ServeMux) *AuthMux

func (*AuthMux) ServeHTTP added in v0.9.4

func (authMux *AuthMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP used to verify that the token is legal, but skip local request to allow request from cmds todo should mixed local verify and venus-auth verify. first check local and than check remote auth

func (*AuthMux) TrustHandle added in v0.9.4

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

TrustHandle for requests that can be accessed directly

type IJwtAuthClient added in v0.9.4

type IJwtAuthClient interface {
	API() apiface.IJwtAuthAPI
	Verify(ctx context.Context, spanID, serviceName, preHost, host, token string) ([]auth.Permission, error)
}

type JwtAuth

type JwtAuth struct {
	// contains filtered or unexported fields
}

JwtAuth auth through local token

func NewJwtAuth

func NewJwtAuth(lr repo.Repo) (*JwtAuth, error)

func (*JwtAuth) API

func (jwtAuth *JwtAuth) API() apiface.IJwtAuthAPI

API jwt for token api todo remove auth new api, because not secure for remote mod

func (*JwtAuth) V0API added in v0.9.7

func (jwtAuth *JwtAuth) V0API() apiface.IJwtAuthAPI

func (*JwtAuth) Verify added in v0.9.4

func (jwtAuth *JwtAuth) Verify(ctx context.Context, spanID, serviceName, preHost, host, token string) ([]auth.Permission, error)

Verify verify token from request

type JwtAuthAPI

type JwtAuthAPI struct {
	JwtAuth *JwtAuth
}

func (*JwtAuthAPI) AuthNew

func (a *JwtAuthAPI) AuthNew(ctx context.Context, perms []auth.Permission) ([]byte, error)

AuthNew create new token with specify permission for access venus

func (*JwtAuthAPI) Verify added in v0.9.4

func (a *JwtAuthAPI) Verify(ctx context.Context, spanID, serviceName, preHost, host, token string) ([]auth.Permission, error)

Verify check the token is valid or not

type JwtPayload

type JwtPayload struct {
	Allow []auth.Permission
}

type RemoteAuth added in v0.9.4

type RemoteAuth struct {
	// contains filtered or unexported fields
}

RemoteAuth in remote verification mode, venus connects venus-auth service, and verifies whether token is legal through rpc

func NewRemoteAuth added in v0.9.4

func NewRemoteAuth(url string) *RemoteAuth

NewRemoteAuth new remote auth client from venus-auth url

func (*RemoteAuth) API added in v0.9.4

func (r *RemoteAuth) API() apiface.IJwtAuthAPI

API remote a new api

func (*RemoteAuth) V0API added in v0.9.7

func (r *RemoteAuth) V0API() apiface.IJwtAuthAPI

func (*RemoteAuth) Verify added in v0.9.4

func (r *RemoteAuth) Verify(ctx context.Context, spanID, serviceName, preHost, host, token string) ([]auth.Permission, error)

Verify check token through venus-auth rpc api

Jump to

Keyboard shortcuts

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