Documentation ¶
Index ¶
- Variables
- type ConditionalLogoutHandler
- type DefaultLogoutHandler
- type LogoutConfigurer
- type LogoutFeature
- func (f *LogoutFeature) AddEntryPoint(entryPoint security.AuthenticationEntryPoint) *LogoutFeature
- func (f *LogoutFeature) AddErrorHandler(errorHandler security.AuthenticationErrorHandler) *LogoutFeature
- func (f *LogoutFeature) AddLogoutHandler(logoutHandler LogoutHandler) *LogoutFeature
- func (f *LogoutFeature) AddSuccessHandler(successHandler security.AuthenticationSuccessHandler) *LogoutFeature
- func (f *LogoutFeature) ErrorUrl(errorUrl string) *LogoutFeature
- func (f *LogoutFeature) Identifier() security.FeatureIdentifier
- func (f *LogoutFeature) LogoutHandlers(logoutHandlers ...LogoutHandler) *LogoutFeature
- func (f *LogoutFeature) LogoutUrl(logoutUrl string) *LogoutFeature
- func (f *LogoutFeature) SuccessUrl(successUrl string) *LogoutFeature
- type LogoutHandler
- type LogoutMiddleware
- type Warnings
Constants ¶
This section is empty.
Variables ¶
var (
FeatureId = security.FeatureId("Logout", security.FeatureOrderLogout)
)
var Module = &bootstrap.Module{ Name: "logout", Precedence: security.MinSecurityPrecedence + 20, Options: []fx.Option{ fx.Invoke(register), }, }
Functions ¶
This section is empty.
Types ¶
type ConditionalLogoutHandler ¶
type ConditionalLogoutHandler interface { // ShouldLogout returns error if logging out cannot be performed. ShouldLogout(context.Context, *http.Request, http.ResponseWriter, security.Authentication) error }
ConditionalLogoutHandler is a supplementary interface for LogoutHandler. It's capable of cancelling/delaying logout process before any LogoutHandler is executed. When non-nil error is returned and logout middleware is configured with an security.AuthenticationEntryPoint, the entry point is used to delay the logout process In case of multiple ConditionalLogoutHandler, returning error by any handler would immediately terminate the process
type DefaultLogoutHandler ¶
type DefaultLogoutHandler struct{}
func (DefaultLogoutHandler) HandleLogout ¶
func (h DefaultLogoutHandler) HandleLogout(ctx context.Context, _ *http.Request, _ http.ResponseWriter, _ security.Authentication) error
type LogoutConfigurer ¶
type LogoutConfigurer struct { }
func (*LogoutConfigurer) Apply ¶
func (c *LogoutConfigurer) Apply(feature security.Feature, ws security.WebSecurity) error
type LogoutFeature ¶
type LogoutFeature struct {
// contains filtered or unexported fields
}
func Configure ¶
func Configure(ws security.WebSecurity) *LogoutFeature
Configure security.Feature entrypoint, used for modifying existing configuration in given security.WebSecurity
func New ¶
func New() *LogoutFeature
New Standard security.Feature entrypoint, DSL style. Used with security.WebSecurity
func (*LogoutFeature) AddEntryPoint ¶
func (f *LogoutFeature) AddEntryPoint(entryPoint security.AuthenticationEntryPoint) *LogoutFeature
AddEntryPoint is used when ConditionalLogoutHandler decide cancel/delay logout process
func (*LogoutFeature) AddErrorHandler ¶
func (f *LogoutFeature) AddErrorHandler(errorHandler security.AuthenticationErrorHandler) *LogoutFeature
AddErrorHandler overrides ErrorUrl
func (*LogoutFeature) AddLogoutHandler ¶
func (f *LogoutFeature) AddLogoutHandler(logoutHandler LogoutHandler) *LogoutFeature
func (*LogoutFeature) AddSuccessHandler ¶
func (f *LogoutFeature) AddSuccessHandler(successHandler security.AuthenticationSuccessHandler) *LogoutFeature
AddSuccessHandler overrides SuccessUrl
func (*LogoutFeature) ErrorUrl ¶
func (f *LogoutFeature) ErrorUrl(errorUrl string) *LogoutFeature
func (*LogoutFeature) Identifier ¶
func (f *LogoutFeature) Identifier() security.FeatureIdentifier
Identifier Standard security.Feature entrypoint
func (*LogoutFeature) LogoutHandlers ¶
func (f *LogoutFeature) LogoutHandlers(logoutHandlers ...LogoutHandler) *LogoutFeature
LogoutHandlers override default handler
func (*LogoutFeature) LogoutUrl ¶
func (f *LogoutFeature) LogoutUrl(logoutUrl string) *LogoutFeature
func (*LogoutFeature) SuccessUrl ¶
func (f *LogoutFeature) SuccessUrl(successUrl string) *LogoutFeature
type LogoutHandler ¶
type LogoutHandler interface { // HandleLogout is the method MW would use to perform logging out actions. // In case of multiple LogoutHandler are registered, implementing class can terminate logout by implementing ConditionalLogoutHandler // If the returned error is security.ErrorSubTypeAuthWarning, the success handler is used with returned error added to the context HandleLogout(context.Context, *http.Request, http.ResponseWriter, security.Authentication) error }
type LogoutMiddleware ¶
type LogoutMiddleware struct {
// contains filtered or unexported fields
}
func NewLogoutMiddleware ¶
func NewLogoutMiddleware(successHandler security.AuthenticationSuccessHandler, errorHandler security.AuthenticationErrorHandler, entryPoint security.AuthenticationEntryPoint, logoutHandlers ...LogoutHandler) *LogoutMiddleware
func (*LogoutMiddleware) LogoutHandlerFunc ¶
func (mw *LogoutMiddleware) LogoutHandlerFunc() gin.HandlerFunc