class PolicyEnforcement implements InterceptorInterface (View source)

This is the main security interceptor, which enforces the current security policy and is usually called by the central security aspect:

  1. If authentication has not been performed (flag is set in the security context) the configured authentication manager is called to authenticate its tokens
  2. If a AuthenticationRequired exception has been thrown we look for an authentication entry point in the active tokens to redirect to authentication
  3. Then the configured AccessDecisionManager is called to authorize the request/action

Properties

protected Context $securityContext
protected AuthenticationManagerInterface $authenticationManager
protected PrivilegeManagerInterface $privilegeManager
protected JoinPointInterface $joinPoint

The current joinpoint

Methods

__construct(Context $securityContext, AuthenticationManagerInterface $authenticationManager, PrivilegeManagerInterface $privilegeManager)

No description

void
setJoinPoint(JoinPointInterface $joinPoint)

Sets the current joinpoint for this interception

bool
invoke()

Invokes the security interception

string
renderDecisionReasonMessage(string $privilegeReasonMessage)

Returns a string message, giving insights what happened during privilege evaluation.

Details

__construct(Context $securityContext, AuthenticationManagerInterface $authenticationManager, PrivilegeManagerInterface $privilegeManager)

No description

Parameters

Context $securityContext

The current security context

AuthenticationManagerInterface $authenticationManager

The authentication manager

PrivilegeManagerInterface $privilegeManager

The access decision manager

void setJoinPoint(JoinPointInterface $joinPoint)

Sets the current joinpoint for this interception

Parameters

JoinPointInterface $joinPoint

The current joinpoint

Return Value

void

bool invoke()

Invokes the security interception

Return Value

bool

true if the security checks was passed

Exceptions

AccessDeniedException
AuthenticationRequiredException
NoTokensAuthenticatedException

protected string renderDecisionReasonMessage(string $privilegeReasonMessage)

Returns a string message, giving insights what happened during privilege evaluation.

Parameters

string $privilegeReasonMessage

Return Value

string