authorise

package
v0.0.0-...-22be18f Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticityToken

func AuthenticityToken(context router.Context) error

AuthenticityToken checks the token in the current request

func AuthenticityTokenFilter

func AuthenticityTokenFilter(c router.Context) error

AuthenticityTokenFilter sets the authenticity token on the context and on the cookie

func CurrentUser

func CurrentUser(context router.Context) *users.User

CurrentUser returns the saved user (or an empty anon user) for the current session cookie Strictly speaking this should be authenticate.User

func CurrentUserFilter

func CurrentUserFilter(c router.Context) error

CurrentUserFilter returns a filter function which sets the current user on the context

func Path

func Path(c router.Context) error

Path authorises the path for the current user

func Resource

func Resource(c router.Context, r ResourceModel) error

Resource authorises the path and resource for the current user if model is nil it is ignored and permission granted

func ResourceAndAuthenticity

func ResourceAndAuthenticity(c router.Context, r ResourceModel) error

ResourceAndAuthenticity authorises the path and resource for the current user

func Setup

func Setup(s *server.Server)

Setup authentication and authorization keys for this app

Types

type ResourceModel

type ResourceModel interface {
	OwnedBy(int64) bool
}

ResourceModel defines the interface for models passed to authorise.Resource

Jump to

Keyboard shortcuts

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