SecurityHelper
class SecurityHelper implements ProtectedContextAwareInterface (View source)
Helper for security related information
Properties
protected Context | $securityContext | ||
protected PrivilegeManagerInterface | $privilegeManager |
Methods
Get the account of the first authenticated token.
Returns CSRF token which is required for "unsafe" requests (e.g. POST, PUT, DELETE, ...)
Returns true, if any account is currently authenticated
Returns true, if access to the given privilege-target is granted
Returns true, if at least one of the currently authenticated accounts holds a role with the given identifier, also recursively.
All methods are considered safe
Details
Account|null
getAccount()
Get the account of the first authenticated token.
string
csrfToken()
Returns CSRF token which is required for "unsafe" requests (e.g. POST, PUT, DELETE, ...)
bool
isAuthenticated()
Returns true, if any account is currently authenticated
bool
hasAccess(string $privilegeTarget, array $parameters = [])
Returns true, if access to the given privilege-target is granted
bool
hasRole(string $roleIdentifier)
Returns true, if at least one of the currently authenticated accounts holds a role with the given identifier, also recursively.
bool
allowsCallOfMethod(string $methodName)
All methods are considered safe