Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrKeyInfoNotFound = fmt.Errorf("key info not found")
)
Functions ¶
This section is empty.
Types ¶
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
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 (*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
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