Documentation ¶
Index ¶
- Constants
- Variables
- func AddAuthentication(webAPI WebAPI, userManager *users.UserManager, ...)
- func AddBasicAuth(webAPI WebAPI, userManager *users.UserManager)
- func AddIPWhiteListAuth(webAPI WebAPI, config IPWhiteListAuthConfiguration)
- func AddNoneAuth(webAPI WebAPI)
- type AccessValidator
- type AuthConfiguration
- type AuthContext
- type AuthHandler
- type BasicAuthConfiguration
- type ClaimValidator
- type IPWhiteListAuthConfiguration
- type JWTAuth
- type JWTAuthConfiguration
- type MiddlewareValidator
- type StatusWebAPIModel
- type WaspClaims
- type WebAPI
Constants ¶
View Source
const ( AuthJWT = "jwt" AuthBasic = "basic" AuthIPWhitelist = "ip" AuthNone = "none" )
Variables ¶
View Source
var ( ErrJWTInvalidClaims = echo.NewHTTPError(http.StatusUnauthorized, "invalid jwt claims") ErrInvalidJWT = echo.NewHTTPError(http.StatusUnauthorized, "token is invalid") )
Errors
Functions ¶
func AddAuthentication ¶
func AddAuthentication( webAPI WebAPI, userManager *users.UserManager, nodeIdentityProvider registry.NodeIdentityProvider, authConfig AuthConfiguration, claimValidator ClaimValidator, )
func AddBasicAuth ¶
func AddBasicAuth(webAPI WebAPI, userManager *users.UserManager)
func AddIPWhiteListAuth ¶
func AddIPWhiteListAuth(webAPI WebAPI, config IPWhiteListAuthConfiguration)
func AddNoneAuth ¶
func AddNoneAuth(webAPI WebAPI)
Types ¶
type AccessValidator ¶
type AccessValidator func(validator ClaimValidator) bool
type AuthConfiguration ¶
type AuthConfiguration struct { Scheme string `default:"ip" usage:"selects which authentication to choose"` JWTConfig JWTAuthConfiguration `name:"jwt" usage:"defines the jwt configuration"` BasicAuthConfig BasicAuthConfiguration `name:"basic" usage:"defines the basic auth configuration"` IPWhitelistConfig IPWhiteListAuthConfiguration `name:"ip" usage:"defines the whitelist configuration"` }
type AuthContext ¶
type AuthContext struct { echo.Context // contains filtered or unexported fields }
func (*AuthContext) IsAllowedTo ¶
func (a *AuthContext) IsAllowedTo(validator ClaimValidator) bool
func (*AuthContext) IsAuthenticated ¶
func (a *AuthContext) IsAuthenticated() bool
func (*AuthContext) Scheme ¶
func (a *AuthContext) Scheme() string
type AuthHandler ¶
type AuthHandler struct { Jwt *JWTAuth UserManager *users.UserManager }
func (*AuthHandler) CrossAPIAuthHandler ¶
func (a *AuthHandler) CrossAPIAuthHandler(c echo.Context) error
type BasicAuthConfiguration ¶
type BasicAuthConfiguration struct {
Username string `default:"wasp" usage:"the username which grants access to the service"`
}
type ClaimValidator ¶
type ClaimValidator func(claims *WaspClaims) bool
type IPWhiteListAuthConfiguration ¶
type IPWhiteListAuthConfiguration struct {
Whitelist []string `default:"127.0.0.1" usage:"a list of ips that are allowed to access the service"`
}
type JWTAuth ¶
type JWTAuth struct {
// contains filtered or unexported fields
}
func AddJWTAuth ¶
func AddJWTAuth(webAPI WebAPI, config JWTAuthConfiguration, privateKey []byte, userManager *users.UserManager, claimValidator ClaimValidator) *JWTAuth
func NewJWTAuth ¶
func (*JWTAuth) IssueJWT ¶
func (j *JWTAuth) IssueJWT(username string, authClaims *WaspClaims) (string, error)
func (*JWTAuth) Middleware ¶
func (j *JWTAuth) Middleware(skipper middleware.Skipper, allow MiddlewareValidator) echo.MiddlewareFunc
type JWTAuthConfiguration ¶
type MiddlewareValidator ¶
type MiddlewareValidator = func(c echo.Context, authContext *AuthContext) bool
type StatusWebAPIModel ¶
type StatusWebAPIModel struct {
// contains filtered or unexported fields
}
type WaspClaims ¶
type WaspClaims struct { jwt.StandardClaims 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.