Documentation ¶
Index ¶
- Constants
- Variables
- func AddAuthentication(apiRoot echoswagger.ApiRoot, userManager *users.UserManager, ...) echo.MiddlewareFunc
- func GetNoneAuthMiddleware() echo.MiddlewareFunc
- func ValidatePermissions(permissions []string) func(next echo.HandlerFunc) echo.HandlerFunc
- type AuthConfiguration
- type AuthContext
- type AuthHandler
- type JWTAuth
- type JWTAuthConfiguration
- type ValidationError
- type WaspClaims
- type WebAPI
Constants ¶
View Source
const ( AuthNone = "none" AuthJWT = "jwt" )
View Source
const (
JWTContextKey = "jwt"
)
Variables ¶
View Source
var ( ErrJWTInvalidClaims = echo.NewHTTPError(http.StatusUnauthorized, "invalid jwt claims") ErrInvalidJWT = echo.NewHTTPError(http.StatusUnauthorized, "token is invalid") )
Errors
View Source
var DefaultJWTDuration time.Duration
Functions ¶
func AddAuthentication ¶
func AddAuthentication( apiRoot echoswagger.ApiRoot, userManager *users.UserManager, nodeIdentityProvider registry.NodeIdentityProvider, authConfig AuthConfiguration, mocker interfaces.Mocker, ) echo.MiddlewareFunc
func GetNoneAuthMiddleware ¶ added in v1.0.3
func GetNoneAuthMiddleware() echo.MiddlewareFunc
func ValidatePermissions ¶ added in v1.0.3
func ValidatePermissions(permissions []string) func(next echo.HandlerFunc) echo.HandlerFunc
Types ¶
type AuthConfiguration ¶
type AuthConfiguration struct { Scheme string `default:"ip" usage:"selects which authentication to choose"` JWTConfig JWTAuthConfiguration `name:"jwt" usage:"defines the jwt configuration"` }
type AuthContext ¶
type AuthContext struct { echo.Context // contains filtered or unexported fields }
func (*AuthContext) Name ¶ added in v1.0.3
func (a *AuthContext) Name() string
func (*AuthContext) Scheme ¶
func (a *AuthContext) Scheme() string
type AuthHandler ¶
type AuthHandler struct { Jwt *JWTAuth UserManager *users.UserManager }
func (*AuthHandler) JWTLoginHandler ¶ added in v1.0.3
func (a *AuthHandler) JWTLoginHandler(c echo.Context) error
type JWTAuth ¶
type JWTAuth struct {
// contains filtered or unexported fields
}
func GetJWTAuthMiddleware ¶ added in v1.0.3
func GetJWTAuthMiddleware( config JWTAuthConfiguration, privateKey []byte, userManager *users.UserManager, ) (*JWTAuth, echo.MiddlewareFunc)
type JWTAuthConfiguration ¶
type ValidationError ¶ added in v1.0.3
type WaspClaims ¶
type WaspClaims struct { jwt.RegisteredClaims Permissions map[string]struct{} `json:"permissions"` }
func (*WaspClaims) HasPermission ¶
func (c *WaspClaims) HasPermission(permission string) bool
func (*WaspClaims) VerifySubject ¶
func (c *WaspClaims) VerifySubject(expected string) bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.