securitycontext

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewActorContext

func NewActorContext(ctx context.Context, act Actor) context.Context

NewActorContext returns a new Context that carries Actor value.

Types

type Actor

type Actor struct {
	ID          int64              `json:"id"`
	Username    string             `json:"username"`
	FirstName   string             `json:"firstName"`
	LastName    string             `json:"lastName"`
	IsSuperuser bool               `json:"isSuperuser"`
	IsActive    bool               `json:"isActive"`
	IsStaff     bool               `json:"isStaff"`
	IsConfirmed bool               `json:"isConfirmed"`
	Permissions charon.Permissions `json:"permissions"`
}

Actor is a generic object that represent anything that can be under control of charon.

func ActorFromContext

func ActorFromContext(ctx context.Context) (Actor, bool)

ActorFromContext returns the Actor value stored in context, if any.

type Context

type Context interface {
	context.Context
	oauth2.TokenSource
	// Actor ...
	Actor() (Actor, bool)
	// AccessToken ...
	AccessToken() (string, bool)
}

Context ....

func NewSecurityContext

func NewSecurityContext(ctx context.Context) Context

NewSecurityContext allocates new context.

Jump to

Keyboard shortcuts

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