middleware

package
v3.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2019 License: OSL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReferrerRedirectStrategy strategy to redirect to the supplied referrer
	ReferrerRedirectStrategy = "referrer"
	//PathRedirectStrategy strategy to redirect to the supplied path
	PathRedirectStrategy = "path"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RedirectURLMaker

type RedirectURLMaker interface {
	URL(context.Context, string) (*url.URL, error)
}

RedirectURLMaker helper function

type RedirectURLMakerImpl

type RedirectURLMakerImpl struct {
	// contains filtered or unexported fields
}

RedirectURLMakerImpl is actual implementation for RedirectURLMaker interface

func (*RedirectURLMakerImpl) Inject

func (r *RedirectURLMakerImpl) Inject(router web.ReverseRouter)

Inject dependencies

func (*RedirectURLMakerImpl) URL

func (r *RedirectURLMakerImpl) URL(ctx context.Context, redirectPath string) (*url.URL, error)

URL generates absolute url depending on provided path

type SecurityMiddleware

type SecurityMiddleware struct {
	// contains filtered or unexported fields
}

SecurityMiddleware to be used to secure controllers/routes

func (*SecurityMiddleware) HandleIfGranted

func (m *SecurityMiddleware) HandleIfGranted(action web.Action, permission string) web.Action

HandleIfGranted allows a controller to be used with a given permission

func (*SecurityMiddleware) HandleIfGrantedWithFallback

func (m *SecurityMiddleware) HandleIfGrantedWithFallback(action web.Action, fallback web.Action, permission string) web.Action

HandleIfGrantedWithFallback is HandleIfGranted with a fallback action

func (*SecurityMiddleware) HandleIfLoggedIn

func (m *SecurityMiddleware) HandleIfLoggedIn(action web.Action) web.Action

HandleIfLoggedIn allows a controller to be used for logged in users

func (*SecurityMiddleware) HandleIfLoggedOut

func (m *SecurityMiddleware) HandleIfLoggedOut(action web.Action) web.Action

HandleIfLoggedOut allows a controller to be used for logged out users

func (*SecurityMiddleware) HandleIfNotGranted

func (m *SecurityMiddleware) HandleIfNotGranted(action web.Action, permission string) web.Action

HandleIfNotGranted allows a controller not to be used with a given permission

func (*SecurityMiddleware) HandleIfNotGrantedWithFallback

func (m *SecurityMiddleware) HandleIfNotGrantedWithFallback(action web.Action, fallback web.Action, permission string) web.Action

HandleIfNotGrantedWithFallback is HandleIfNotGranted with a fallback action

func (*SecurityMiddleware) Inject

func (m *SecurityMiddleware) Inject(r *web.Responder, s application.SecurityService, u RedirectURLMaker, l flamingo.Logger, cfg *struct {
	LoginPathHandler              string `inject:"config:security.loginPath.handler"`
	LoginPathRedirectStrategy     string `inject:"config:security.loginPath.redirectStrategy"`
	LoginPathRedirectPath         string `inject:"config:security.loginPath.redirectPath"`
	AuthenticatedHomepageStrategy string `inject:"config:security.authenticatedHomepage.strategy"`
	AuthenticatedHomepagePath     string `inject:"config:security.authenticatedHomepage.path"`
	EventLogging                  bool   `inject:"config:security.eventLogging"`
})

Inject dependencies

func (*SecurityMiddleware) RedirectToLoginFallback

func (m *SecurityMiddleware) RedirectToLoginFallback(ctx context.Context, req *web.Request) web.Result

RedirectToLoginFallback fallback helper action

func (*SecurityMiddleware) RedirectToLogoutFallback

func (m *SecurityMiddleware) RedirectToLogoutFallback(ctx context.Context, req *web.Request) web.Result

RedirectToLogoutFallback fallback helper action

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL