simple

package
v1.105.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package simple provides implementations of bahamut.SessionAuthenticator bahamut.RequestAuthenticator and a bahamut.Authorizer using a given function to decide if a request should be authenticated/authorized.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

A Authenticator is a bahamut.Authenticator compliant structure to authentify requests using a given functions.

func NewAuthenticator

func NewAuthenticator(customAuthRequestFunc CustomAuthRequestFunc, customAuthSessionFunc CustomAuthSessionFunc) *Authenticator

NewAuthenticator returns a new *Authenticator.

func (*Authenticator) AuthenticateRequest

func (a *Authenticator) AuthenticateRequest(ctx bahamut.Context) (bahamut.AuthAction, error)

AuthenticateRequest authenticates the request from the given bahamut.Context. It will return true if the authentication is a success, false in case of failure and an eventual error in case of error.

func (*Authenticator) AuthenticateSession

func (a *Authenticator) AuthenticateSession(session bahamut.Session) (bahamut.AuthAction, error)

AuthenticateSession authenticates the given session. It will return true if the authentication is a success, false in case of failure and an eventual error in case of error.

type Authorizer

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

A Authorizer is a bahamut.Authorizer compliant structure to authorize requests using a given functions.

func NewAuthorizer

func NewAuthorizer(customAuthFunc CustomAuthRequestFunc) *Authorizer

NewAuthorizer returns a new *Authorizer.

func (*Authorizer) IsAuthorized

func (a *Authorizer) IsAuthorized(ctx bahamut.Context) (bahamut.AuthAction, error)

IsAuthorized authorizer the given context. It will return true if the authentication is a success, false in case of failure and an eventual error in case of error.

type CustomAuthRequestFunc

type CustomAuthRequestFunc func(bahamut.Context) (bahamut.AuthAction, error)

CustomAuthRequestFunc is the type of functions that can be used to decide custom authentication operations for requests. It returns a bahamut.AuthAction.

type CustomAuthSessionFunc

type CustomAuthSessionFunc func(bahamut.Session) (bahamut.AuthAction, error)

CustomAuthSessionFunc is the type of functions that can be used to decide custom authentication operations sessions. It returns a bahamut.AuthAction.

type CustomShouldPublishFunc

type CustomShouldPublishFunc func(*elemental.Event) (bool, error)

CustomShouldPublishFunc is the type of function that can be used to decide is an event should be published.

type PublishHandler

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

A PublishHandler handles publish decisions.

func NewPublishHandler

func NewPublishHandler(shouldPublishFunc CustomShouldPublishFunc) *PublishHandler

NewPublishHandler returns a new PushSessionsHandler. If shouldPublishFunc is nil the publisher will dispatch all events.

func (*PublishHandler) ShouldPublish

func (g *PublishHandler) ShouldPublish(event *elemental.Event) (bool, error)

ShouldPublish is part of the bahamut.PushPublishHandler interface

Jump to

Keyboard shortcuts

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