Documentation ¶
Index ¶
- Constants
- type AuthMiddleware
- func (auth *AuthMiddleware) Require(filter filter) echo.MiddlewareFunc
- func (auth *AuthMiddleware) RequireAdminRole() echo.MiddlewareFunc
- func (auth *AuthMiddleware) RequireAuthentication() echo.MiddlewareFunc
- func (auth *AuthMiddleware) RequireRole(requiredRoles ...string) echo.MiddlewareFunc
- func (auth *AuthMiddleware) RequireScope(requiredScopes ...string) echo.MiddlewareFunc
- type Router
- type Server
- type Validator
Constants ¶
const ( // HeaderContentType is the name for the conten type HTTP header. HeaderContentType = "Content-Type" // HeaderContentDisposition is the name for the conten disposition HTTP header. HeaderContentDisposition = "Content-Disposition" // HeaderContentLength is the name for the conten disposition HTTP header. HeaderContentLength = "Content-Length" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMiddleware ¶
type AuthMiddleware struct {
// contains filtered or unexported fields
}
AuthMiddleware defines which types of filters are provided by the auth middleware.
func NewAuthMiddleware ¶
func NewAuthMiddleware( authService application.AuthService, tokenKeyResolver application.TokenKeyResolver, ) *AuthMiddleware
NewAuthMiddleware creates a new auth middleware using the given token key resolver and auth service.
func (*AuthMiddleware) Require ¶
func (auth *AuthMiddleware) Require(filter filter) echo.MiddlewareFunc
Require defines a middleware which checks for a valid authentication token and uses to custom function to authorize the token.
func (*AuthMiddleware) RequireAdminRole ¶
func (auth *AuthMiddleware) RequireAdminRole() echo.MiddlewareFunc
RequireAdminRole returns a middleware handler function for protecting end-points needing user authentication.
Only users having with 'admin' role are allowed to access the end-point.
func (*AuthMiddleware) RequireAuthentication ¶
func (auth *AuthMiddleware) RequireAuthentication() echo.MiddlewareFunc
RequireAuthentication returns a middleware handler function for protecting end-points needing user authentication.
Any valid subject claim will pass the middleware.
func (*AuthMiddleware) RequireRole ¶
func (auth *AuthMiddleware) RequireRole(requiredRoles ...string) echo.MiddlewareFunc
RequireRole returns a middleware handler function for protecting end-points needing user authentication. The authenticated user needs to have any role from the given set of roles in order to pass.
func (*AuthMiddleware) RequireScope ¶
func (auth *AuthMiddleware) RequireScope(requiredScopes ...string) echo.MiddlewareFunc
RequireScope returns a middleware handler function for protecting end-points authentication. At least one of the given scopes needs to be granted in order to pass.
type Router ¶
type Router interface {
DefineRoutes(group *echo.Group, auth *AuthMiddleware)
}
Router defines an abstraction for a REST router.
func NewAuthRouter ¶
func NewAuthRouter( authService application.AuthService, tokenKeyResolver application.TokenKeyResolver, ) Router
NewAuthRouter creates a new router for auth functionality based on the given configuration.
func NewDocumentRouter ¶
func NewDocumentRouter(documentService application.DocumentService) Router
NewDocumentRouter creates a new router for document management using the given document service.
func NewUserRouter ¶
func NewUserRouter(userService application.UserService) Router
NewUserRouter creates a new router for user management using the given user service.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the main object responsible for running the REST interface.
func NewServer ¶
func NewServer( config *config.Configuration, authService application.AuthService, ) *Server
NewServer constructs a new server instance considering the given configuration.
Source Files ¶
- auth_middleware.go
- auth_router.go
- auth_serializers.go
- auth_validators.go
- context.go
- document_page_serializers.go
- document_router.go
- document_serializers.go
- document_validators.go
- error_handler.go
- mime_types.go
- paging.go
- router.go
- search_results.go
- server.go
- user_router.go
- user_serializers.go
- user_validators.go
- validator.go