PHP 클래스 Neos\Flow\Security\Context

파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$activeTokens Neos\Flow\Security\Authentication\TokenInterface[] Array of tokens currently active
$authenticationManager Neos\Flow\Security\Authentication\AuthenticationManagerInterface
$authenticationStrategy integer One of the AUTHENTICATE_* constants to set the authentication strategy.
$authorizationChecksDisabled boolean Whether authorization is disabled @see areAuthorizationChecksDisabled()
$contextHash string @see getContextHash()
$csrfProtectionStrategy integer One of the CSRF_* constants to set the csrf protection strategy
$csrfProtectionTokens array
$hashService Neos\Flow\Security\Cryptography\HashService
$inactiveTokens array Array of tokens currently inactive
$initialized boolean TRUE if the context is initialized in the current request, FALSE or NULL otherwise.
$interceptedRequest Neos\Flow\Mvc\RequestInterface
$policyService Neos\Flow\Security\Policy\PolicyService
$request Neos\Flow\Mvc\ActionRequest
$roles Neos\Flow\Security\Policy\Role[]
$securityLogger Neos\Flow\Log\SecurityLoggerInterface
$sessionManager Neos\Flow\Session\SessionManagerInterface
$tokenStatusLabels array
$tokens array Array of configured tokens (might have request patterns)

공개 메소드들

메소드 설명
areAuthorizationChecksDisabled ( ) : boolean Returns TRUE if authorization should be ignored, otherwise FALSE This is mainly useful to fetch records without Content Security to kick in (e.g. for AuthenticationProviders)
canBeInitialized ( ) : boolean Check if the securityContext is ready to be initialized. Only after that security will be active.
clearContext ( ) : void Clears the security context.
getAccount ( ) : Account Returns the account of the first authenticated authentication token.
getAccountByAuthenticationProviderName ( string $authenticationProviderName ) : Account Returns an authenticated account for the given provider or NULL if no account was authenticated or no token was registered for the given authentication provider name.
getAuthenticationStrategy ( ) : integer Get the token authentication strategy
getAuthenticationTokens ( ) : Neos\Flow\Security\Authentication\TokenInterface[] Returns all Authentication\Tokens of the security context which are active for the current request. If a token has a request pattern that cannot match against the current request it is determined as not active.
getAuthenticationTokensOfType ( string $className ) : Neos\Flow\Security\Authentication\TokenInterface[] Returns all Authentication\Tokens of the security context which are active for the current request and of the given type. If a token has a request pattern that cannot match against the current request it is determined as not active.
getContextHash ( ) : string Returns a hash that is unique for the current context, depending on hash components, @see setContextHashComponent()
getCsrfProtectionToken ( ) : string Returns the current CSRF protection token. A new one is created when needed, depending on the configured CSRF protection strategy.
getInterceptedRequest ( ) : ActionRequest Returns the request, that has been stored for later resuming after it has been intercepted by a security exception, NULL if there is none.
getRoles ( ) : Role[] Returns the roles of all authenticated accounts, including inherited roles.
hasCsrfProtectionTokens ( ) : boolean Returns TRUE if the context has CSRF protection tokens.
hasRole ( string $roleIdentifier ) : boolean Returns TRUE, if at least one of the currently authenticated accounts holds a role with the given identifier, also recursively.
initialize ( ) : void Initializes the security context for the given request.
injectAuthenticationManager ( Neos\Flow\Security\Authentication\AuthenticationManagerInterface $authenticationManager ) : void Inject the authentication manager
injectSettings ( array $settings ) : void Injects the configuration settings
isCsrfProtectionTokenValid ( string $csrfToken ) : boolean Returns TRUE if the given string is a valid CSRF protection token. The token will be removed if the configured csrf strategy is 'onePerUri'.
isInitialized ( ) : boolean
refreshRoles ( ) : void Refreshes the currently effective roles. In fact the roles first level cache is reset and the effective roles get recalculated by calling getRoles().
refreshTokens ( ) : void Refreshes all active tokens by updating the credentials.
setInterceptedRequest ( ActionRequest $interceptedRequest = null ) : void Sets an action request, to be stored for later resuming after it has been intercepted by a security exception.
setRequest ( ActionRequest $request ) : void Set the current action request
shutdownObject ( ) : void Shut the object down
withoutAuthorizationChecks ( Closure $callback ) : void Lets you switch off authorization checks (CSRF token, policies, content security, .

보호된 메소드들

메소드 설명
isTokenActive ( Neos\Flow\Security\Authentication\TokenInterface $token ) : boolean Evaluates any RequestPatterns of the given token to determine whether it is active for the current request - If no RequestPattern is configured for this token, it is active - Otherwise it is active only if at least one configured RequestPattern per type matches the request
mergeTokens ( array $managerTokens, array $sessionTokens ) : array Merges the session and manager tokens. All manager tokens types will be in the result array If a specific type is found in the session this token replaces the one (of the same type) given by the manager.
separateActiveAndInactiveTokens ( ) : void Stores all active tokens in $this->activeTokens, all others in $this->inactiveTokens
updateTokens ( array $tokens ) : void Updates the token credentials for all tokens in the given array.

메소드 상세

areAuthorizationChecksDisabled() 공개 메소드

Returns TRUE if authorization should be ignored, otherwise FALSE This is mainly useful to fetch records without Content Security to kick in (e.g. for AuthenticationProviders)
또한 보기: withoutAuthorizationChecks()

canBeInitialized() 공개 메소드

To be able to initialize, there needs to be an ActionRequest available, usually that is provided by the MVC router.
public canBeInitialized ( ) : boolean
리턴 boolean

clearContext() 공개 메소드

Clears the security context.
public clearContext ( ) : void
리턴 void

getAccount() 공개 메소드

Note: There might be a more currently authenticated account in the remaining tokens. If you need them you'll have to fetch them directly from the tokens. (@see getAuthenticationTokens())
public getAccount ( ) : Account
리턴 Account The authenticated account

getAccountByAuthenticationProviderName() 공개 메소드

Returns an authenticated account for the given provider or NULL if no account was authenticated or no token was registered for the given authentication provider name.
public getAccountByAuthenticationProviderName ( string $authenticationProviderName ) : Account
$authenticationProviderName string Authentication provider name of the account to find
리턴 Account The authenticated account

getAuthenticationStrategy() 공개 메소드

Get the token authentication strategy
public getAuthenticationStrategy ( ) : integer
리턴 integer One of the AUTHENTICATE_* constants

getAuthenticationTokens() 공개 메소드

Returns all Authentication\Tokens of the security context which are active for the current request. If a token has a request pattern that cannot match against the current request it is determined as not active.
public getAuthenticationTokens ( ) : Neos\Flow\Security\Authentication\TokenInterface[]
리턴 Neos\Flow\Security\Authentication\TokenInterface[] Array of set tokens

getAuthenticationTokensOfType() 공개 메소드

Returns all Authentication\Tokens of the security context which are active for the current request and of the given type. If a token has a request pattern that cannot match against the current request it is determined as not active.
public getAuthenticationTokensOfType ( string $className ) : Neos\Flow\Security\Authentication\TokenInterface[]
$className string The class name
리턴 Neos\Flow\Security\Authentication\TokenInterface[] Array of set tokens of the specified type

getContextHash() 공개 메소드

Returns a hash that is unique for the current context, depending on hash components, @see setContextHashComponent()
public getContextHash ( ) : string
리턴 string

getCsrfProtectionToken() 공개 메소드

Returns the current CSRF protection token. A new one is created when needed, depending on the configured CSRF protection strategy.
public getCsrfProtectionToken ( ) : string
리턴 string

getInterceptedRequest() 공개 메소드

Returns the request, that has been stored for later resuming after it has been intercepted by a security exception, NULL if there is none.
public getInterceptedRequest ( ) : ActionRequest
리턴 Neos\Flow\Mvc\ActionRequest

getRoles() 공개 메소드

If no authenticated roles could be found the "Anonymous" role is returned. The "Neos.Flow:Everybody" roles is always returned.
public getRoles ( ) : Role[]
리턴 Neos\Flow\Security\Policy\Role[]

hasCsrfProtectionTokens() 공개 메소드

Returns TRUE if the context has CSRF protection tokens.
public hasCsrfProtectionTokens ( ) : boolean
리턴 boolean TRUE, if the token is valid. FALSE otherwise.

hasRole() 공개 메소드

Returns TRUE, if at least one of the currently authenticated accounts holds a role with the given identifier, also recursively.
public hasRole ( string $roleIdentifier ) : boolean
$roleIdentifier string The string representation of the role to search for
리턴 boolean TRUE, if a role with the given string representation was found

initialize() 공개 메소드

Initializes the security context for the given request.
public initialize ( ) : void
리턴 void

injectAuthenticationManager() 공개 메소드

Inject the authentication manager
public injectAuthenticationManager ( Neos\Flow\Security\Authentication\AuthenticationManagerInterface $authenticationManager ) : void
$authenticationManager Neos\Flow\Security\Authentication\AuthenticationManagerInterface The authentication manager
리턴 void

injectSettings() 공개 메소드

Injects the configuration settings
public injectSettings ( array $settings ) : void
$settings array
리턴 void

isCsrfProtectionTokenValid() 공개 메소드

Returns TRUE if the given string is a valid CSRF protection token. The token will be removed if the configured csrf strategy is 'onePerUri'.
public isCsrfProtectionTokenValid ( string $csrfToken ) : boolean
$csrfToken string The token string to be validated
리턴 boolean TRUE, if the token is valid. FALSE otherwise.

isInitialized() 공개 메소드

public isInitialized ( ) : boolean
리턴 boolean TRUE if the Context is initialized, FALSE otherwise.

isTokenActive() 보호된 메소드

Evaluates any RequestPatterns of the given token to determine whether it is active for the current request - If no RequestPattern is configured for this token, it is active - Otherwise it is active only if at least one configured RequestPattern per type matches the request
protected isTokenActive ( Neos\Flow\Security\Authentication\TokenInterface $token ) : boolean
$token Neos\Flow\Security\Authentication\TokenInterface
리턴 boolean TRUE if the given token is active, otherwise FALSE

mergeTokens() 보호된 메소드

Merges the session and manager tokens. All manager tokens types will be in the result array If a specific type is found in the session this token replaces the one (of the same type) given by the manager.
protected mergeTokens ( array $managerTokens, array $sessionTokens ) : array
$managerTokens array Array of tokens provided by the authentication manager
$sessionTokens array Array of tokens restored from the session
리턴 array Array of Authentication\TokenInterface objects

refreshRoles() 공개 메소드

Refreshes the currently effective roles. In fact the roles first level cache is reset and the effective roles get recalculated by calling getRoles().
public refreshRoles ( ) : void
리턴 void

refreshTokens() 공개 메소드

This is useful when doing an explicit authentication inside a request.
public refreshTokens ( ) : void
리턴 void

separateActiveAndInactiveTokens() 보호된 메소드

Stores all active tokens in $this->activeTokens, all others in $this->inactiveTokens
protected separateActiveAndInactiveTokens ( ) : void
리턴 void

setInterceptedRequest() 공개 메소드

Sets an action request, to be stored for later resuming after it has been intercepted by a security exception.
public setInterceptedRequest ( ActionRequest $interceptedRequest = null ) : void
$interceptedRequest Neos\Flow\Mvc\ActionRequest
리턴 void

setRequest() 공개 메소드

This method is called manually by the request handler which created the HTTP request.
public setRequest ( ActionRequest $request ) : void
$request Neos\Flow\Mvc\ActionRequest The current ActionRequest
리턴 void

shutdownObject() 공개 메소드

Shut the object down
public shutdownObject ( ) : void
리턴 void

updateTokens() 보호된 메소드

Updates the token credentials for all tokens in the given array.
protected updateTokens ( array $tokens ) : void
$tokens array Array of authentication tokens the credentials should be updated for
리턴 void

withoutAuthorizationChecks() 공개 메소드

..) for the runtime of $callback Usage: $this->securityContext->withoutAuthorizationChecks(function () use ($accountRepository, $username, $providerName, &$account) { this will disable the PersistenceQueryRewritingAspect for this one call $account = $accountRepository->findActiveByAccountIdentifierAndAuthenticationProviderName($username, $providerName) });
public withoutAuthorizationChecks ( Closure $callback ) : void
$callback Closure
리턴 void

프로퍼티 상세

$activeTokens 보호되어 있는 프로퍼티

Array of tokens currently active
protected TokenInterface[],Neos\Flow\Security\Authentication $activeTokens
리턴 Neos\Flow\Security\Authentication\TokenInterface[]

$authenticationManager 보호되어 있는 프로퍼티

protected AuthenticationManagerInterface,Neos\Flow\Security\Authentication $authenticationManager
리턴 Neos\Flow\Security\Authentication\AuthenticationManagerInterface

$authenticationStrategy 보호되어 있는 프로퍼티

One of the AUTHENTICATE_* constants to set the authentication strategy.
protected int $authenticationStrategy
리턴 integer

$authorizationChecksDisabled 보호되어 있는 프로퍼티

Whether authorization is disabled @see areAuthorizationChecksDisabled()
protected bool $authorizationChecksDisabled
리턴 boolean

$contextHash 보호되어 있는 프로퍼티

@see getContextHash()
protected string $contextHash
리턴 string

$csrfProtectionStrategy 보호되어 있는 프로퍼티

One of the CSRF_* constants to set the csrf protection strategy
protected int $csrfProtectionStrategy
리턴 integer

$csrfProtectionTokens 보호되어 있는 프로퍼티

protected array $csrfProtectionTokens
리턴 array

$hashService 보호되어 있는 프로퍼티

protected HashService,Neos\Flow\Security\Cryptography $hashService
리턴 Neos\Flow\Security\Cryptography\HashService

$inactiveTokens 보호되어 있는 프로퍼티

Array of tokens currently inactive
protected array $inactiveTokens
리턴 array

$initialized 보호되어 있는 프로퍼티

TRUE if the context is initialized in the current request, FALSE or NULL otherwise.
protected bool $initialized
리턴 boolean

$interceptedRequest 보호되어 있는 프로퍼티

protected RequestInterface,Neos\Flow\Mvc $interceptedRequest
리턴 Neos\Flow\Mvc\RequestInterface

$policyService 보호되어 있는 프로퍼티

protected PolicyService,Neos\Flow\Security\Policy $policyService
리턴 Neos\Flow\Security\Policy\PolicyService

$request 보호되어 있는 프로퍼티

protected ActionRequest,Neos\Flow\Mvc $request
리턴 Neos\Flow\Mvc\ActionRequest

$roles 보호되어 있는 프로퍼티

protected Role[],Neos\Flow\Security\Policy $roles
리턴 Neos\Flow\Security\Policy\Role[]

$securityLogger 보호되어 있는 프로퍼티

protected SecurityLoggerInterface,Neos\Flow\Log $securityLogger
리턴 Neos\Flow\Log\SecurityLoggerInterface

$sessionManager 보호되어 있는 프로퍼티

protected SessionManagerInterface,Neos\Flow\Session $sessionManager
리턴 Neos\Flow\Session\SessionManagerInterface

$tokenStatusLabels 보호되어 있는 프로퍼티

protected array $tokenStatusLabels
리턴 array

$tokens 보호되어 있는 프로퍼티

Array of configured tokens (might have request patterns)
protected array $tokens
리턴 array