auth

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 17 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.1.4

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

func HandleHTTPWithSession added in v0.1.4

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

func HandleTS added in v0.1.4

func HandleTSWithSession added in v0.1.5

func RegisterGobTypes added in v0.2.1

func RegisterGobTypes()

func RegoModules added in v0.1.15

func RegoModules() []opa.Module

func SetCSRFBehavior

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

func SetIdentity

func SetIdentity(s *sessions.Session, id ory.IdentityID)

Types

type Auth

type Auth struct {
	Identity       Identity
	Authorizations interface{}
	CSRF           CSRF
}

func GetFromRequest

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

func LookupStored added in v0.1.15

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

type AuthzChecker added in v0.1.15

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

func NewAuthzChecker added in v0.1.15

func NewAuthzChecker(db *database.DB, opc *opa.Client) *AuthzChecker

func (*AuthzChecker) Allow added in v0.1.15

func (azc *AuthzChecker) Allow(
	ctx context.Context, a Auth, resourcePath, operationMethod string, operationParams interface{},
) (bool, error)

func (*AuthzChecker) NewHTTPMiddleware added in v0.1.15

func (azc *AuthzChecker) NewHTTPMiddleware(ss *session.Store) echo.MiddlewareFunc

func (*AuthzChecker) NewTSMiddleware added in v0.1.15

func (azc *AuthzChecker) NewTSMiddleware(ss *session.Store) turbostreams.MiddlewareFunc

func (*AuthzChecker) RequireAuthz added in v0.1.15

func (azc *AuthzChecker) RequireAuthz(
	ctx context.Context, input map[string]interface{},
) (authzErr error, evalErr error)

func (*AuthzChecker) RequireHTTPAuthz added in v0.1.15

func (azc *AuthzChecker) RequireHTTPAuthz(c echo.Context, a Auth) (authzErr error, evalErr error)

func (*AuthzChecker) RequireTSAuthz added in v0.1.15

func (azc *AuthzChecker) RequireTSAuthz(
	c *turbostreams.Context, a Auth,
) (authzErr error, evalErr 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.1.4

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

type HTTPHandlerFuncWithSession added in v0.1.4

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

type HTTPRouter added in v0.1.4

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.1.4

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

func (*HTTPRouter) CONNECT added in v0.1.4

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

func (*HTTPRouter) DELETE added in v0.1.4

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

func (*HTTPRouter) GET added in v0.1.4

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

func (*HTTPRouter) HEAD added in v0.1.4

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

func (*HTTPRouter) OPTIONS added in v0.1.4

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

func (*HTTPRouter) PATCH added in v0.1.4

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

func (*HTTPRouter) POST added in v0.1.4

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

func (*HTTPRouter) PUT added in v0.1.4

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

func (*HTTPRouter) TRACE added in v0.1.4

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

type Identity

type Identity struct {
	Authenticated bool
	User          ory.IdentityID
}

func GetIdentity

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

func (Identity) NewSubject added in v0.1.15

func (i Identity) NewSubject() opa.Subject

type TSHandlerFunc added in v0.1.4

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

type TSHandlerFuncWithSession added in v0.1.5

type TSHandlerFuncWithSession func(c *turbostreams.Context, a Auth, sess *sessions.Session) error

type TSRouter added in v0.1.4

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.1.4

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

func (*TSRouter) MSG added in v0.1.4

func (*TSRouter) PUB added in v0.1.4

func (*TSRouter) SUB added in v0.1.4

Jump to

Keyboard shortcuts

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