auth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package auth provides application-level standardization for authentication

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleHTTP added in v0.5.0

func HandleHTTP(h HTTPHandlerFunc, ss *session.Store) echo.HandlerFunc

func HandleHTTPWithSession added in v0.5.0

func HandleHTTPWithSession(h HTTPHandlerFuncWithSession, ss *session.Store) echo.HandlerFunc

func HandleTS added in v0.5.0

func RegisterGobTypes added in v0.6.2

func RegisterGobTypes()

func RequireHTTPAuthz added in v0.5.0

func RequireHTTPAuthz(ss *session.Store) echo.MiddlewareFunc

func RequireTSAuthz added in v0.5.0

func RequireTSAuthz(ss *session.Store) turbostreams.MiddlewareFunc

func SetCSRFBehavior

func SetCSRFBehavior(s *sessions.Session, inlineToken bool)

func SetIdentity

func SetIdentity(s *sessions.Session, username string)

Types

type Auth

type Auth struct {
	Identity Identity
	CSRF     CSRF
}

func GetFromRequest

func GetFromRequest(r *http.Request, s sessions.Session, ss *session.Store) (a Auth, err error)

func GetWithSession

func GetWithSession(
	r *http.Request, ss *session.Store, l godest.Logger,
) (a Auth, s *sessions.Session, err error)

func GetWithoutRequest added in v0.5.0

func GetWithoutRequest(s sessions.Session, ss *session.Store) (a Auth, err error)

func (Auth) Authorized

func (a Auth) Authorized() bool

func (Auth) RequireHTTPAuthz added in v0.5.0

func (a Auth) RequireHTTPAuthz() error

func (Auth) RequireTSAuthz added in v0.5.0

func (a Auth) RequireTSAuthz() error

type CSRF

type CSRF struct {
	Config   session.CSRFOptions
	Behavior CSRFBehavior
	Token    string
}

func (*CSRF) SetInlining

func (c *CSRF) SetInlining(r *http.Request, inlineToken bool)

type CSRFBehavior

type CSRFBehavior struct {
	InlineToken bool
}

func GetCSRFBehavior

func GetCSRFBehavior(s sessions.Session) (behavior CSRFBehavior, err error)

type HTTPHandlerFunc added in v0.5.0

type HTTPHandlerFunc func(c echo.Context, a Auth) error

type HTTPHandlerFuncWithSession added in v0.5.0

type HTTPHandlerFuncWithSession func(c echo.Context, a Auth, sess *sessions.Session) error

type HTTPRouter added in v0.5.0

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

HTTPRouter is a routing adapter between echo.HandlerFunc and this package's HTTPHandlerFunc, by automatically extracting auth data from the session of the request.

func NewHTTPRouter added in v0.5.0

func NewHTTPRouter(er godest.EchoRouter, ss *session.Store) HTTPRouter

func (*HTTPRouter) CONNECT added in v0.5.0

func (r *HTTPRouter) CONNECT(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) DELETE added in v0.5.0

func (r *HTTPRouter) DELETE(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) GET added in v0.5.0

func (r *HTTPRouter) GET(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) HEAD added in v0.5.0

func (r *HTTPRouter) HEAD(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) OPTIONS added in v0.5.0

func (r *HTTPRouter) OPTIONS(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) PATCH added in v0.5.0

func (r *HTTPRouter) PATCH(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) POST added in v0.5.0

func (r *HTTPRouter) POST(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) PUT added in v0.5.0

func (r *HTTPRouter) PUT(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

func (*HTTPRouter) TRACE added in v0.5.0

func (r *HTTPRouter) TRACE(path string, h HTTPHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

type Identity

type Identity struct {
	Authenticated bool
	User          string
}

func GetIdentity

func GetIdentity(s sessions.Session) (identity Identity, err error)

type TSHandlerFunc added in v0.5.0

type TSHandlerFunc func(c *turbostreams.Context, a Auth) error

type TSRouter added in v0.5.0

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

TSRouter is a routing adapter between turbostreams.HandlerFunc and this package's TSHandlerFunc, by automatically extracting auth data from the session associated with the Action Cable connection underlying the Turbo Stream.

func NewTSRouter added in v0.5.0

func NewTSRouter(tsr turbostreams.Router, ss *session.Store) TSRouter

func (*TSRouter) MSG added in v0.5.0

func (*TSRouter) PUB added in v0.5.0

func (*TSRouter) SUB added in v0.5.0

Jump to

Keyboard shortcuts

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