authorization

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	Authorize(session.Session) (DeauthorizeFunc, bool, error)
}

Authorizer interface is the basis for authorizers in the namespace ssh.session.authorizers. An erroed authorization should not require a call to DeauthorizeFunc.

type Chained

type Chained struct {
	// The list of sub-authorizers to loop through to authorize a session. If an authorizer in the chain
	// fails, all the preiovusly successful authorization will be de-authorized.
	AuthorizersRaw []json.RawMessage `json:"authorize,omitempty" caddy:"namespace=ssh.session.authorizers inline_key=authorizer"`
	// contains filtered or unexported fields
}

Chained is a multi-authorizer module that authorizes a session against multiple authorizers

func (*Chained) Authorize

func (c *Chained) Authorize(sess session.Session) (DeauthorizeFunc, bool, error)

Authorize loops through the sub-authorizers in sequence asking for authorization and collects the de-authorizers in a stack. If an authorization fails, it will de-authorize the earlier pushed de-authorizers, except for the failed authorizer.

func (*Chained) CaddyModule

func (c *Chained) CaddyModule() caddy.ModuleInfo

This method indicates that the type is a Caddy module. The returned ModuleInfo must have both a name and a constructor function. This method must not have any side-effects.

func (*Chained) Provision

func (c *Chained) Provision(ctx caddy.Context) error

Provision loads up the sub-authorizers in the chain and provisions them as loaded

type DeauthorizeFunc

type DeauthorizeFunc func(session.Session) error

type MaxSession

type MaxSession struct {
	// The maximum number of active sessions
	MaxSessions uint64 `json:"max_sessions,omitempty"`
	// contains filtered or unexported fields
}

MaxSession is an authorizer that permits sessions so long as the number of active sessions is below the specified maximum.

func (*MaxSession) Authorize

func (ms *MaxSession) Authorize(sess session.Session) (DeauthorizeFunc, bool, error)

Authorize validates the current count of active sessions and issues an authorization if the addition of new session does not exceed the defined maximum number of allowed sessions.

func (*MaxSession) CaddyModule

func (ms *MaxSession) CaddyModule() caddy.ModuleInfo

This method indicates that the type is a Caddy module. The returned ModuleInfo must have both a name and a constructor function. This method must not have any side-effects.

func (*MaxSession) Provision

func (ms *MaxSession) Provision(ctx caddy.Context) error

Provision sets up the MaxSession authorizer

type Public

type Public struct{}

Public authorizes all sessions

func (*Public) Authorize

func (ms *Public) Authorize(sess session.Session) (DeauthorizeFunc, bool, error)

Authorize is an noop for this module

func (*Public) CaddyModule

func (ms *Public) CaddyModule() caddy.ModuleInfo

This method indicates that the type is a Caddy module. The returned ModuleInfo must have both a name and a constructor function. This method must not have any side-effects.

func (*Public) Provision

func (ms *Public) Provision(ctx caddy.Context) error

Provision is an noop for this module

type Reject

type Reject struct{}

Reject rejects all sessions

func (*Reject) Authorize

func (ms *Reject) Authorize(sess session.Session) (DeauthorizeFunc, bool, error)

Authorize is an noop for this module, except for returning false to deny the session.

func (*Reject) CaddyModule

func (ms *Reject) CaddyModule() caddy.ModuleInfo

This method indicates that the type is a Caddy module. The returned ModuleInfo must have both a name and a constructor function. This method must not have any side-effects.

func (*Reject) Provision

func (ms *Reject) Provision(ctx caddy.Context) error

Provision is an noop for this module

Jump to

Keyboard shortcuts

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