Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessService ¶
AccessService represents a service to verifying access tokens
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is a controller that is in charge of authenticating and authorizing requests
func NewAuth ¶
func NewAuth(log *zerolog.Logger, access AccessService) *Auth
NewAuth creates an Auth controller with the given endpoint
func (*Auth) Authorize ¶
func (a *Auth) Authorize(next echo.HandlerFunc) echo.HandlerFunc
Authorize returns the user info for the given access token in the Authorization header It is a middleware, which is why it returns a function that, if successful, calls the function bound to the route.
type Blog ¶
type Blog struct {
// contains filtered or unexported fields
}
Blog is a controller that is in charge of handling the CRUD of blog posts
func NewBlog ¶
func NewBlog(log *zerolog.Logger, blogPostRepository BlogRepository) *Blog
NewBlog creates a Blog controller with the given blog post repository
type BlogRepository ¶
type BlogRepository interface { Store(post *model.BlogPost) (*model.BlogPost, error) Retrieve(id uint) (*model.BlogPost, error) Find(contains *string, limit *uint) ([]*model.BlogPost, error) Update(post *model.BlogPost) error Delete(id uint) error }
BlogRepository represents a repository that allows to create, read, update and delete blog posts
type TokenGenerator ¶
TokenGenerator represents a service to generate tokens from user info
type User ¶
type User struct {
// contains filtered or unexported fields
}
User is a controller that is in charge of handling the CRUD of users
func NewUser ¶
func NewUser(log *zerolog.Logger, userRepository UserRepository, tokens TokenGenerator, hasher Hasher) *User
NewUser creates a User controller with the given user repository