auth

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorize

func Authorize(
	ctx context.Context,
	requirements ...Requirement,
) error

Authorize authorizes the client session taken from the provided context against the provided requirements

Types

type CtxKey

type CtxKey int

CtxKey represents a context.Context value key type

const CtxSession CtxKey = 1

CtxSession defines the context.Context session value key

type GQLShieldClientRole added in v1.3.0

type GQLShieldClientRole int

GQLShieldClientRole represents a GraphQL shield client role identifier

const (

	// GQLShieldClientGuest represents a guest API user
	GQLShieldClientGuest GQLShieldClientRole

	// GQLShieldClientDebug represents the debug API user
	GQLShieldClientDebug

	// GQLShieldClientRegular represents the regular API user
	GQLShieldClientRegular
)

type IsOwner

type IsOwner struct {
	Owner store.ID
}

IsOwner indicates that the client is required to be the owner of a resource

type IsUser

type IsUser struct{}

IsUser indicates that the client is required to be an authenticated user

type RequestSession

type RequestSession struct {
	IsDebug          bool
	UserID           store.ID
	Creation         time.Time
	ShieldClientRole GQLShieldClientRole
}

RequestSession represents a client session

type Requirement

type Requirement interface {
	// contains filtered or unexported methods
}

Requirement defines the authorization requirement implementation interface

Jump to

Keyboard shortcuts

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