Documentation
¶
Index ¶
- Variables
- func AddEmailTemplates(app bolo.App)
- func AddFlashMessage(c echo.Context, m *FlashMessage) error
- func CreateDefaultEmailTemplates(app bolo.App) error
- func DeleteUserSession(c echo.Context) error
- func FindOrCreateUserFromFacebook(facebookUserDetails FacebookUserDetails, ctx *bolo.RequestContext) (*user_models.UserModel, error)
- func GetFacebookOAuthConfig(ctx *bolo.RequestContext) *oauth2.Config
- func HandleRequestSessionAuthentication(c echo.Context) error
- func Init(app bolo.App)
- func InstallAuth(app bolo.App) error
- func SendRequestResetPasswordEmail(ctx *bolo.RequestContext, authToken *user_models.AuthTokenModel, ...) (bool, error)
- func SetUserSession(app bolo.App, c echo.Context, user bolo.UserInterface) (*sessions.Session, error)
- func UserSettingsHandler(c echo.Context) error
- type AuthController
- func (ctl *AuthController) Activate(c echo.Context) error
- func (ctl *AuthController) ChangeOwnPassword(c echo.Context) error
- func (ctl *AuthController) ChangeOwnPasswordApi(c echo.Context) error
- func (ctl *AuthController) ChangeOwnPassword_Page(c echo.Context) error
- func (ctl *AuthController) CheckIfResetPasswordTokenIsValid(c echo.Context) error
- func (ctl *AuthController) ForgotPasswordRequest(c echo.Context) error
- func (ctl *AuthController) ForgotPasswordUpdate(c echo.Context) error
- func (ctl *AuthController) ForgotPassword_Process(c echo.Context) error
- func (ctl *AuthController) ForgotPassword_Request(c echo.Context) error
- func (ctl *AuthController) ForgotPassword_RequestWithIdentifier(c echo.Context) (err error)
- func (ctl *AuthController) ForgotPassword_ResetPage(c echo.Context) error
- func (ctl *AuthController) GetCurrentUser(c echo.Context) error
- func (ctl *AuthController) Logout(c echo.Context) error
- func (ctl *AuthController) SetPassword(c echo.Context) error
- func (ctl *AuthController) Signup(c echo.Context) error
- func (ctl *AuthController) UpdatePassword(c echo.Context) error
- type AuthPlugin
- func (r *AuthPlugin) BindRoutes(app bolo.App) error
- func (p *AuthPlugin) Bootstrap(app bolo.App) error
- func (p *AuthPlugin) GetMigrations() []*bolo.Migration
- func (p *AuthPlugin) GetName() string
- func (p *AuthPlugin) Init(app bolo.App) error
- func (p *AuthPlugin) OnClose(app bolo.App) error
- func (p *AuthPlugin) OnHTTPError(app bolo.App, e event.Event) error
- type AuthPluginCfgs
- type ChangeOwnPasswordBody
- type Claims
- type Controller
- func (ctl *Controller) Count(c echo.Context) error
- func (ctl *Controller) Create(c echo.Context) error
- func (ctl *Controller) Delete(c echo.Context) error
- func (ctl *Controller) FindAllPageHandler(c echo.Context) error
- func (ctl *Controller) FindOne(c echo.Context) error
- func (ctl *Controller) FindOnePageHandler(c echo.Context) error
- func (ctl *Controller) GetUserRoles(c echo.Context) error
- func (ctl *Controller) GetUserRolesAndPermissions(c echo.Context) error
- func (ctl *Controller) Query(c echo.Context) error
- func (ctl *Controller) Update(c echo.Context) error
- func (ctl *Controller) UpdateUserRoles(c echo.Context) error
- type ControllerCfg
- type CountJSONResponse
- type EmptySuccessResponse
- type ErrorResponse
- type FacebookAuthController
- type FacebookUserDetails
- type FacebookUserPicture
- type FindOneJSONResponse
- type FlashMessage
- type FlashMessageTPL
- type FlashMessages
- type ForgotPasswordChange_RequestBody
- type ForgotPassword_Process_RequestBody
- type HTMLBootstrapConfig
- type ListJSONResponse
- type LoginRequestBody
- type LoginWithFacebookAppCodeBodyRequest
- type LogoutRequestBody
- type NewAuthControllerCFG
- type NewFacebookAuthControllerCFG
- type NewSessionControllerCFG
- type RequestBody
- type RoleTableItem
- type SessionController
- type SessionData
- type SetPasswordBody
- type SignupBody
- type SignupResponse
- type SuccessResponse
- type TeaserTPL
- type UserDetails
- type UserPlugin
- type UserPluginCfg
- type UserRolesBodyRequest
- type UserRolesResponse
Constants ¶
This section is empty.
Variables ¶
var ( // SessionDB - Redis session connection for writes SessionDBWriter *redis.Client // SessionDB - Redis session connection for gets SessionDBReader *redis.Client )
Functions ¶
func AddEmailTemplates ¶
func AddFlashMessage ¶
func AddFlashMessage(c echo.Context, m *FlashMessage) error
func DeleteUserSession ¶
func FindOrCreateUserFromFacebook ¶
func FindOrCreateUserFromFacebook(facebookUserDetails FacebookUserDetails, ctx *bolo.RequestContext) (*user_models.UserModel, error)
SignInUser Used for Signing In the Users
func GetFacebookOAuthConfig ¶
func GetFacebookOAuthConfig(ctx *bolo.RequestContext) *oauth2.Config
GetFacebookOAuthConfig will return the config to call facebook Login
func InstallAuth ¶
func SendRequestResetPasswordEmail ¶
func SendRequestResetPasswordEmail(ctx *bolo.RequestContext, authToken *user_models.AuthTokenModel, u *user_models.UserModel, resetPrefixName string) (bool, error)
func SetUserSession ¶
func UserSettingsHandler ¶
Types ¶
type AuthController ¶
func NewAuthController ¶
func NewAuthController(cfg *NewAuthControllerCFG) *AuthController
func (*AuthController) Activate ¶
func (ctl *AuthController) Activate(c echo.Context) error
Activate a user account with activation code
func (*AuthController) ChangeOwnPassword ¶
func (ctl *AuthController) ChangeOwnPassword(c echo.Context) error
ChangeOwnPassword - POST endpoint
func (*AuthController) ChangeOwnPasswordApi ¶
func (ctl *AuthController) ChangeOwnPasswordApi(c echo.Context) error
func (*AuthController) ChangeOwnPassword_Page ¶
func (ctl *AuthController) ChangeOwnPassword_Page(c echo.Context) error
func (*AuthController) CheckIfResetPasswordTokenIsValid ¶
func (ctl *AuthController) CheckIfResetPasswordTokenIsValid(c echo.Context) error
Check if a reset token is valid
func (*AuthController) ForgotPasswordRequest ¶
func (ctl *AuthController) ForgotPasswordRequest(c echo.Context) error
Generate one time reset password token and send it to user change password with token
func (*AuthController) ForgotPasswordUpdate ¶
func (ctl *AuthController) ForgotPasswordUpdate(c echo.Context) error
func (*AuthController) ForgotPassword_Process ¶
func (ctl *AuthController) ForgotPassword_Process(c echo.Context) error
ForgotPassword_Process - API step 3 to change password with token
func (*AuthController) ForgotPassword_Request ¶
func (ctl *AuthController) ForgotPassword_Request(c echo.Context) error
ForgotPassword_Request - step 1 to change password
func (*AuthController) ForgotPassword_RequestWithIdentifier ¶
func (ctl *AuthController) ForgotPassword_RequestWithIdentifier(c echo.Context) (err error)
ForgotPassword_RequestWithIdentifier - Step 1 to change password
func (*AuthController) ForgotPassword_ResetPage ¶
func (ctl *AuthController) ForgotPassword_ResetPage(c echo.Context) error
ForgotPassword_ResetPage - step 2 to change password
func (*AuthController) GetCurrentUser ¶
func (ctl *AuthController) GetCurrentUser(c echo.Context) error
func (*AuthController) Logout ¶
func (ctl *AuthController) Logout(c echo.Context) error
Logout handler with supports to unAuthenticate from all strategies TODO! add support for unauthenticate from all session strategies with events
func (*AuthController) SetPassword ¶
func (ctl *AuthController) SetPassword(c echo.Context) error
Set user password, usualy used by admins Current version dont need validation
func (*AuthController) UpdatePassword ¶
func (ctl *AuthController) UpdatePassword(c echo.Context) error
type AuthPlugin ¶
type AuthPlugin struct {
bolo.Pluginer
// a map with valid reset page prefix:
ResetPrefixNames map[string]string
AuthController *AuthController
SessionController *SessionController
FacebookAuthController *FacebookAuthController
Name string
SessionStore sessions.Store // TODO! add more session store options as plugins
SessionResave bool
}
func NewAuthPlugin ¶
func NewAuthPlugin(cfg *AuthPluginCfgs) *AuthPlugin
func (*AuthPlugin) BindRoutes ¶
func (r *AuthPlugin) BindRoutes(app bolo.App) error
func (*AuthPlugin) GetMigrations ¶
func (p *AuthPlugin) GetMigrations() []*bolo.Migration
func (*AuthPlugin) GetName ¶
func (p *AuthPlugin) GetName() string
func (*AuthPlugin) OnHTTPError ¶
type AuthPluginCfgs ¶
type ChangeOwnPasswordBody ¶
type ChangeOwnPasswordBody struct {
Password string `json:"password,omitempty" form:"password"`
NewPassword string `json:"newPassword,omitempty" form:"newPassword" validate:"required,min=3"`
RNewPassword string `json:"rNewPassword,omitempty" form:"rNewPassword" validate:"required,eqfield=NewPassword"`
}
func (*ChangeOwnPasswordBody) ToJSON ¶
func (b *ChangeOwnPasswordBody) ToJSON() string
type Claims ¶
type Claims struct {
Email string
jwt.RegisteredClaims
}
Claims is a struct that will be encoded to a JWT. jwt.RegisteredClaims is an embedded type to provide expiry time
type Controller ¶
Http user controller | struct with http handlers
func NewController ¶
func NewController(cfg *ControllerCfg) *Controller
func (*Controller) FindAllPageHandler ¶
func (ctl *Controller) FindAllPageHandler(c echo.Context) error
func (*Controller) FindOnePageHandler ¶
func (ctl *Controller) FindOnePageHandler(c echo.Context) error
func (*Controller) GetUserRoles ¶
func (ctl *Controller) GetUserRoles(c echo.Context) error
func (*Controller) GetUserRolesAndPermissions ¶
func (ctl *Controller) GetUserRolesAndPermissions(c echo.Context) error
func (*Controller) UpdateUserRoles ¶
func (ctl *Controller) UpdateUserRoles(c echo.Context) error
type ControllerCfg ¶
type CountJSONResponse ¶
type CountJSONResponse struct {
bolo.BaseMetaResponse
}
type EmptySuccessResponse ¶
type EmptySuccessResponse struct {
Messages []*bolo.ResponseMessage `json:"messages,omitempty"`
}
type ErrorResponse ¶
ErrorResponse is struct for sending error message with code.
type FacebookAuthController ¶
type FacebookAuthController struct {
}
func NewFacebookAuthController ¶
func NewFacebookAuthController(cfg *NewFacebookAuthControllerCFG) *FacebookAuthController
func (*FacebookAuthController) LoginWithFacebookAppCode ¶
func (ctl *FacebookAuthController) LoginWithFacebookAppCode(c echo.Context) error
type FacebookUserDetails ¶
type FacebookUserDetails struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Picture *FacebookUserPicture `json:"picture"`
}
FacebookUserDetails is struct used for user details
func GetUserInfoFromFacebook ¶
func GetUserInfoFromFacebook(token string, ctx *bolo.RequestContext) (FacebookUserDetails, error)
GetUserInfoFromFacebook will return information of user which is fetched from facebook
type FacebookUserPicture ¶
type FindOneJSONResponse ¶
type FindOneJSONResponse struct {
Record *user_models.UserModel `json:"user"`
}
type FlashMessage ¶
type FlashMessage struct {
Type string `json:"type"`
Message string `json:"message"`
Field string `json:"field"`
Tag string `json:"tag"`
}
func (*FlashMessage) ToJSON ¶
func (m *FlashMessage) ToJSON() []byte
type FlashMessageTPL ¶
type FlashMessageTPL struct {
Ctx *bolo.RequestContext
Message *FlashMessage
}
type FlashMessages ¶
type FlashMessages []*FlashMessage
func GetFlashMessages ¶
func GetFlashMessages(c echo.Context) (messages FlashMessages, err error)
type ForgotPassword_Process_RequestBody ¶
type ForgotPassword_Process_RequestBody struct {
Token string `json:"token" form:"token" validate:"required"`
UserID json.Number `json:"userID" form:"userID" validate:"required"`
NewPassword string `json:"newPassword" form:"newPassword" validate:"required,min=3"`
RNewPassword string `json:"rNewPassword" form:"rNewPassword" validate:"required,eqfield=NewPassword"`
RedirectOnSucess string `json:"redirectOnSucess" form:"redirectOnSucess"`
}
type HTMLBootstrapConfig ¶
type HTMLBootstrapConfig struct {
AppName string `json:"appName"`
AppLogo string `json:"appLogo"`
ENV string `json:"env"`
Site string `json:"site"`
Hostname string `json:"hostname"`
QueryDefaultLimit int `json:"queryDefaultLimit"`
QueryMaxLimit int `json:"queryMaxLimit"`
Locales []string `json:"locales"`
DefaultLocale string `json:"defaultLocale"`
Date clientSideDateFormat `json:"date"`
Plugins []string `json:"plugins"`
User map[string]string `json:"authenticatedUser"`
UserRoles []string `json:"userRoles"`
ActiveLocale string `json:"activeLocale"`
}
type ListJSONResponse ¶
type ListJSONResponse struct {
bolo.BaseListReponse
Record *[]*user_models.UserModel `json:"user"`
}
type LoginRequestBody ¶
type LogoutRequestBody ¶
type LogoutRequestBody struct {
RefreshToken string `json:"refresh_token"`
}
LogoutRequestBody corpo opcional do logout: permite revogar também o refresh token da sessão.
type NewAuthControllerCFG ¶
type NewSessionControllerCFG ¶
type RequestBody ¶
type RequestBody struct {
Record *user_models.UserModel `json:"user"`
}
type RoleTableItem ¶
type SessionController ¶
func NewSessionController ¶
func NewSessionController(cfg *NewSessionControllerCFG) *SessionController
type SessionData ¶
type SessionData struct {
UserID string `json:"userId"`
}
func (*SessionData) ToJSON ¶
func (sd *SessionData) ToJSON() string
type SetPasswordBody ¶
type SetPasswordBody struct {
NewPassword string `json:"newPassword,omitempty" validate:"required,min=3"`
RNewPassword string `json:"rNewPassword,omitempty" validate:"required,eqfield=NewPassword"`
}
func (*SetPasswordBody) ToJSON ¶
func (b *SetPasswordBody) ToJSON() string
type SignupBody ¶
type SignupBody struct {
Username string `json:"username,omitempty" validate:"required"`
Email string `json:"email,omitempty" validate:"required,email"`
ConfirmEmail string `json:"confirmEmail,omitempty" validate:"required,email,eqcsfield=Email"`
DisplayName string `json:"displayName,omitempty" validate:"required"`
FullName string `json:"fullName,omitempty"`
Biography string `json:"biography,omitempty"`
Gender string `json:"gender,omitempty"`
Language string `json:"language,omitempty"`
AcceptTerms bool `json:"acceptTerms,omitempty" validate:"required"`
Birthdate string `json:"birthdate,omitempty"`
Phone string `json:"phone,omitempty"`
}
func (*SignupBody) ToJSON ¶
func (sb *SignupBody) ToJSON() string
type SignupResponse ¶
type SignupResponse struct {
User *user_models.UserModel `json:"user"`
Errors []*bolo.ValidationFieldError `json:"errors,omitempty"`
}
type SuccessResponse ¶
SuccessResponse is struct for sending error message with code.
type UserDetails ¶
UserDetails is struct used for user details
type UserPlugin ¶
type UserPlugin struct {
bolo.Pluginer
Controller *Controller
Name string
}
func NewUserPlugin ¶
func NewUserPlugin(cfg *UserPluginCfg) *UserPlugin
func (*UserPlugin) BindRoutes ¶
func (r *UserPlugin) BindRoutes(app bolo.App) error
func (*UserPlugin) GetMigrations ¶
func (p *UserPlugin) GetMigrations() []*bolo.Migration
func (*UserPlugin) GetName ¶
func (r *UserPlugin) GetName() string
type UserPluginCfg ¶
type UserPluginCfg struct{}
type UserRolesBodyRequest ¶
type UserRolesBodyRequest struct {
UserRoles []string `json:"userRoles"`
}