PHP 클래스 Webiny\Component\Security\Authentication\Firewall

The firewall class check if users is authenticated and holds the methods for authentication.
상속: use trait Webiny\Component\Http\HttpTrait, use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\FactoryLoaderTrait, use trait Webiny\Component\EventManager\EventManagerTrait
파일 보기 프로젝트 열기: Webiny/Framework 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $firewallKey, ConfigObject $firewallConfig, array $userProviders, Encoder $encoder ) Constructor.
createPasswordHash ( string $password ) : string Create a hash for the given password.
getAnonymousAccess ( ) : boolean Check if anonymous access is allowed or not.
getConfig ( ) : ConfigObject Get config for current firewall.
getFirewallKey ( ) : string Returns the name of the current firewall. Don't mistake it for realm name.
getRealmName ( ) : string Get realm name.
getToken ( ) : Token Get the current token.
getUser ( ) : boolean | AbstractUser Tries to retrieve the user from current token.
isUserAllowedAccess ( ) : boolean Checks if current user has access to current area based by access rules.
processLogin ( string $authProvider = '' ) : boolean Call this method on your login submit page, it will trigger the authentication provider and validate the provided credentials.
processLogout ( ) This method deletes user auth token and calls the logoutCallback on current login provider.
verifyPasswordHash ( string $password, string $hash ) : boolean Verify if the $password matches the $hash.

비공개 메소드들

메소드 설명
authenticate ( Login $login ) : boolean | AbstractUser Method that validates the submitted credentials with defined firewall user providers.
getAuthProvider ( string $authProvider ) : Webiny\Component\Security\Authentication\Providers\AuthenticationInterface Get the authentication provider.
getAuthProviderConfig ( string $authProvider ) : ConfigObject Returns the config of current auth provider.
getTokenName ( ) : string Returns the token name.
initRoleHierarchy ( ) Initializes role hierarchy.
initToken ( ) Initializes the Token.
setUserRoles ( ) Sets roles for current user.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( string $firewallKey, ConfigObject $firewallConfig, array $userProviders, Encoder $encoder )
$firewallKey string Name of the current firewall.
$firewallConfig Webiny\Component\Config\ConfigObject Firewall config.
$userProviders array Array of user providers for this firewall.
$encoder Webiny\Component\Security\Encoder\Encoder Instance of encoder for this firewall.

createPasswordHash() 공개 메소드

Create a hash for the given password.
public createPasswordHash ( string $password ) : string
$password string
리턴 string Password hash.

getAnonymousAccess() 공개 메소드

If anonymous access is not defined in the config, by default it will be set to false.
public getAnonymousAccess ( ) : boolean
리턴 boolean Is anonymous access allowed or not.

getConfig() 공개 메소드

Get config for current firewall.
public getConfig ( ) : ConfigObject
리턴 Webiny\Component\Config\ConfigObject

getFirewallKey() 공개 메소드

Returns the name of the current firewall. Don't mistake it for realm name.
public getFirewallKey ( ) : string
리턴 string

getRealmName() 공개 메소드

Get realm name.
public getRealmName ( ) : string
리턴 string Realm name.

getToken() 공개 메소드

Get the current token.
public getToken ( ) : Token
리턴 Webiny\Component\Security\Token\Token

getUser() 공개 메소드

If the token does not exist, AnonymousUser is returned.
public getUser ( ) : boolean | AbstractUser
리턴 boolean | Webiny\Component\Security\User\AbstractUser

isUserAllowedAccess() 공개 메소드

Checks if current user has access to current area based by access rules.
public isUserAllowedAccess ( ) : boolean
리턴 boolean

processLogin() 공개 메소드

Call this method on your login submit page, it will trigger the authentication provider and validate the provided credentials.
public processLogin ( string $authProvider = '' ) : boolean
$authProvider string Name of the auth provider you wish to use to process the login. If you don't set it, the first registered provider will be used.
리턴 boolean True if login is valid, false if login has failed.

processLogout() 공개 메소드

After that, it replaces the current user instance with an instance of AnonymousUser and redirects the request to the logout.target.
public processLogout ( )

verifyPasswordHash() 공개 메소드

Verify if the $password matches the $hash.
public verifyPasswordHash ( string $password, string $hash ) : boolean
$password string
$hash string
리턴 boolean True if $password matches $hash. Otherwise false is returned.