authorization

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const RolePrefix = "ROLE_"

Variables

View Source
var (
	AccessDenied = exception.New(http.StatusForbidden, "Access is denied")
)

Functions

This section is empty.

Types

type AccessDecisionManager

type AccessDecisionManager interface {

	// Supports Indicates whether this AccessDecisionManager is able
	// to process authorization requests presented with the passed authorization.GrantedAuthority
	Supports(authority authority.GrantedAuthority) bool

	// Decide Resolves an access control decision for the passed parameters.
	Decide(authentication authen.Authentication, restrictedAuthorities []authority.GrantedAuthority) error
}

type AccessDecisionVoter

type AccessDecisionVoter interface {

	// Supports Indicates whether this AccessDecisionVoter
	// is able to vote on the passed GrantedAuthority
	Supports(authority authority.GrantedAuthority) bool

	// Vote Indicates whether access is granted or not.
	// The decision must be affirmative VotingGranted, negative VotingDenied
	// or the AccessDecisionVoter can abstain VotingAbstain from voting.
	Vote(authentication authen.Authentication, restrictedAuthorities []authority.GrantedAuthority) VotingResult
}

AccessDecisionVoter Indicates a class is responsible for voting on authorization decisions. The coordination of voting is performed by an AccessDecisionManager

type AffirmativeBasedADM

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

func NewAffirmativeBasedADM

func NewAffirmativeBasedADM(voters ...AccessDecisionVoter) *AffirmativeBasedADM

func (AffirmativeBasedADM) Decide

func (a AffirmativeBasedADM) Decide(authentication authen.Authentication, restrictedAuthorities []authority.GrantedAuthority) error

func (AffirmativeBasedADM) Supports

func (a AffirmativeBasedADM) Supports(authority authority.GrantedAuthority) bool

type RoleVoterADV

type RoleVoterADV struct {
}

func NewRoleVoterADV

func NewRoleVoterADV() *RoleVoterADV

func (RoleVoterADV) Supports

func (r RoleVoterADV) Supports(authority authority.GrantedAuthority) bool

func (RoleVoterADV) Vote

func (r RoleVoterADV) Vote(auth authen.Authentication, restrictedAuthorities []authority.GrantedAuthority) VotingResult

type VotingResult

type VotingResult int
const (
	VotingGranted VotingResult = 1
	VotingAbstain VotingResult = 0
	VotingDenied  VotingResult = -1
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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