# \Thelia\Core\SecuritySecurityContext

A simple security manager, in charge of checking user

## Summary

Methods
Properties
Constants
__construct()
setContext()
getContext()
getUser()
isAuthenticated()
isGranted()
setUser()
clear()
No public properties found
CONTEXT_FRONT_OFFICE
CONTEXT_BACK_OFFICE
No protected methods found
No protected properties found
N/A
getSession()
$request
$context
N/A

File
  Core/Security/SecurityContext.php
Package
  \Default
Class hierarchy
  \Thelia\Core\Security\SecurityContext

## Tags

author | Franck Allimant franck@cqfdev.fr

## Constants

### CONTEXT_FRONT_OFFICE

    CONTEXT_FRONT_OFFICE

#

## Tags

None found

### CONTEXT_BACK_OFFICE

    CONTEXT_BACK_OFFICE

#

## Tags

None found

## Properties

### $request

    $request

#

## Tags

None found

### $context

    $context

#

## Tags

None found

## Methods

### __construct()

    __construct(\Thelia\Core\HttpFoundation\Request $request)

#### Parameters

\Thelia\Core\HttpFoundation\Request | $request |

#

## Tags

None found

### setContext()

    setContext( $context)

#### Parameters

| $context |

#

## Tags

None found

### getContext()

    getContext( $exception_if_context_undefined)

#### Parameters

| $exception_if_context_undefined |

#

## Tags

None found

### getUser()

    getUser() : \Thelia\Core\Security\User\UserInterface|null

Gets the currently authenticated user in the current context, or null if none is defined

#### Returns

\Thelia\Core\Security\User\UserInterface|null —

A UserInterface instance or null if no user is available

#

## Tags

None found

### isAuthenticated()

    isAuthenticated()

#

final

## Tags

None found

### isGranted()

    isGranted(array $roles, array $permissions) : Boolean

Checks if the current user is allowed

#### Parameters

array | $roles |
array | $permissions |

#### Returns

Boolean

#

final

## Tags

None found

### setUser()

    setUser(\Thelia\Core\Security\User\UserInterface $user)

Sets the authenticated user.

#### Parameters

\Thelia\Core\Security\User\UserInterface | $user | A UserInterface, or null if no further user should be stored

#

## Tags

None found

### clear()

    clear()

Clear the user from the security context

#

## Tags

None found

### getSession()

    getSession()

#

## Tags

None found

### SecurityContext.php