PHP Class ZF\Apigility\Admin\Model\AuthenticationModel

Show file Open project: zfcampus/zf-apigility-admin

Protected Properties

Property Type Description
$globalConfig ZF\Configuration\ConfigResource
$localConfig ZF\Configuration\ConfigResource
$modules ModuleModel

Public Methods

Method Description
__construct ( ZF\Configuration\ConfigResource $globalConfig, ZF\Configuration\ConfigResource $localConfig, ModuleModel $modules )
arrayDiffRecursive ( mixed $a, mixed $b ) : integer Perform a recursive array diff
create ( array $authenticationConfig ) : AuthenticationEntity Create authentication configuration
createAuthenticationAdapter ( array $adapter ) : array Create authentication adapter for version 2
fetch ( ) : AuthenticationEntity | false Fetch configuration details for authentication
fetchAllAuthenticationAdapter ( ) : array Fetch configuration details for auth adapters
fetchAuthenticationAdapter ( string $name ) : array | false Fetch configuration details for specific auth adapter name
fromOAuth2RegexToArray ( array $config ) : array Return the OAuth2 urls as array from the regex string
getAuthenticationMap ( string $module, integer | false $version = false ) : string | false Get the authentication map specified by $module and $version
remove ( ) : true Remove authentication
removeAuthenticationAdapter ( string $name ) : boolean Remove the authentication adapter specified
removeAuthenticationMap ( string $module, integer $version = null ) : boolean Remove the authentication Map for a specific $module and $version
removeOldAuthentication ( ) : true Remove authentication
saveAuthenticationMap ( string $auth, string $module, integer $version = null ) : boolean Save the authentication Map for a specific $module and $version
transformAuthPerApis ( ) : boolean | string This function transform the old authentication system to the new one based on APIs defined. It reads the old configuration and generates an authentication mapping for each API and version.
update ( array $authenticationConfig ) : AuthenticationEntity Update authentication configuration
updateAuthenticationAdapter ( string $name, array $adapter ) : array Update authentication adapter data

Protected Methods

Method Description
checkAuthenticationAdapterData ( array $adapter ) : array Check and return the input data for version 2
createAuthenticationEntityFromConfig ( array $config ) : AuthenticationEntity Create an AuthenticationEntity based on the configuration given
createMongoDSN ( $dsn ) : MongoClient
createPdoDSN ( $dsn, $username, $password ) : PDO
fetchHttpAuthConfiguration ( array $config ) : array | false Fetch HTTP Authentication configuration
fetchOAuth2Configuration ( array $config ) : array | false Fetch all OAuth2 configuration from global and local files
loadAuthenticationAdapterFromConfig ( string $name, array $config ) : array Load authentication data from configuration version 2 Since Apigility 1.1
patchHttpAuthConfig ( AuthenticationEntity $entity, array $global, array $local ) Patch the HTTP Authentication configuration
patchOAuth2Config ( AuthenticationEntity $entity, array $global, array $local ) : void Patch the OAuth2 configuration
removeOAuth2Route ( string $url ) : boolean Remove a url from OAuth2 route
removeSensitiveConfig ( array $config ) : array Remove sensitive information from the configuration
saveAuthenticationAdapter ( array $adapter ) : true Add a new authentication adapter in local config
updateOAuth2Route ( string $url ) : void Update the OAuth2 route
validateDsn ( string $dsn, string $username = null, string $password = null, string $dsnType = AuthenticationEntity::DSN_PDO ) : boolean Validate a DSN

Method Details

__construct() public method

public __construct ( ZF\Configuration\ConfigResource $globalConfig, ZF\Configuration\ConfigResource $localConfig, ModuleModel $modules )
$globalConfig ZF\Configuration\ConfigResource
$localConfig ZF\Configuration\ConfigResource
$modules ModuleModel

arrayDiffRecursive() public static method

Necessary starting in PHP 5.4; see https://bugs.php.net/bug.php?id=60278
public static arrayDiffRecursive ( mixed $a, mixed $b ) : integer
$a mixed
$b mixed
return integer

checkAuthenticationAdapterData() protected method

Check and return the input data for version 2
protected checkAuthenticationAdapterData ( array $adapter ) : array
$adapter array
return array

create() public method

Create authentication configuration
public create ( array $authenticationConfig ) : AuthenticationEntity
$authenticationConfig array
return AuthenticationEntity

createAuthenticationAdapter() public method

Since Apigility 1.1
public createAuthenticationAdapter ( array $adapter ) : array
$adapter array
return array

createAuthenticationEntityFromConfig() protected method

Create an AuthenticationEntity based on the configuration given
protected createAuthenticationEntityFromConfig ( array $config ) : AuthenticationEntity
$config array
return AuthenticationEntity

createMongoDSN() protected method

protected createMongoDSN ( $dsn ) : MongoClient
$dsn
return MongoClient

createPdoDSN() protected method

protected createPdoDSN ( $dsn, $username, $password ) : PDO
$dsn
$username
$password
return PDO

fetch() public method

Fetch configuration details for authentication
public fetch ( ) : AuthenticationEntity | false
return AuthenticationEntity | false

fetchAllAuthenticationAdapter() public method

Used since Apigility 1.1

fetchAuthenticationAdapter() public method

Used since Apigility 1.1
public fetchAuthenticationAdapter ( string $name ) : array | false
$name string
return array | false

fetchHttpAuthConfiguration() protected method

Fetch HTTP Authentication configuration
protected fetchHttpAuthConfiguration ( array $config ) : array | false
$config array
return array | false

fetchOAuth2Configuration() protected method

Fetch all OAuth2 configuration from global and local files
protected fetchOAuth2Configuration ( array $config ) : array | false
$config array
return array | false

fromOAuth2RegexToArray() public method

Since Apigility 1.1
public fromOAuth2RegexToArray ( array $config ) : array
$config array
return array

getAuthenticationMap() public method

Used since Apigility 1.1
public getAuthenticationMap ( string $module, integer | false $version = false ) : string | false
$module string
$version integer | false
return string | false

loadAuthenticationAdapterFromConfig() protected method

Load authentication data from configuration version 2 Since Apigility 1.1
protected loadAuthenticationAdapterFromConfig ( string $name, array $config ) : array
$name string
$config array
return array

patchHttpAuthConfig() protected method

Patch the HTTP Authentication configuration
protected patchHttpAuthConfig ( AuthenticationEntity $entity, array $global, array $local )
$entity AuthenticationEntity
$global array
$local array

patchOAuth2Config() protected method

Patch the OAuth2 configuration
protected patchOAuth2Config ( AuthenticationEntity $entity, array $global, array $local ) : void
$entity AuthenticationEntity
$global array
$local array
return void

remove() public method

Remove authentication
public remove ( ) : true
return true

removeAuthenticationAdapter() public method

Since Apigility 1.1
public removeAuthenticationAdapter ( string $name ) : boolean
$name string
return boolean

removeAuthenticationMap() public method

Used since Apigility 1.1
public removeAuthenticationMap ( string $module, integer $version = null ) : boolean
$module string
$version integer
return boolean

removeOAuth2Route() protected method

Since Apigility 1.1
protected removeOAuth2Route ( string $url ) : boolean
$url string
return boolean

removeOldAuthentication() public method

Remove authentication
public removeOldAuthentication ( ) : true
return true

removeSensitiveConfig() protected method

Currently only "htpasswd" and "htdigest" entries are stripped.
protected removeSensitiveConfig ( array $config ) : array
$config array
return array

saveAuthenticationAdapter() protected method

Add a new authentication adapter in local config
protected saveAuthenticationAdapter ( array $adapter ) : true
$adapter array
return true

saveAuthenticationMap() public method

Used since Apigility 1.1
public saveAuthenticationMap ( string $auth, string $module, integer $version = null ) : boolean
$auth string
$module string
$version integer
return boolean

transformAuthPerApis() public method

This function transform the old authentication system to the new one based on APIs defined. It reads the old configuration and generates an authentication mapping for each API and version.
public transformAuthPerApis ( ) : boolean | string
return boolean | string Boolean false if nothing was performed; string adapter name otherwise.

update() public method

Update authentication configuration
public update ( array $authenticationConfig ) : AuthenticationEntity
$authenticationConfig array
return AuthenticationEntity

updateAuthenticationAdapter() public method

Since Apigility 1.1
public updateAuthenticationAdapter ( string $name, array $adapter ) : array
$name string
$adapter array
return array

updateOAuth2Route() protected method

Since Apigility 1.1
protected updateOAuth2Route ( string $url ) : void
$url string
return void

validateDsn() protected method

Validate a DSN
protected validateDsn ( string $dsn, string $username = null, string $password = null, string $dsnType = AuthenticationEntity::DSN_PDO ) : boolean
$dsn string
$username string
$password string
$dsnType string
return boolean

Property Details

$globalConfig protected property

protected ConfigResource,ZF\Configuration $globalConfig
return ZF\Configuration\ConfigResource

$localConfig protected property

protected ConfigResource,ZF\Configuration $localConfig
return ZF\Configuration\ConfigResource

$modules protected property

protected ModuleModel,ZF\Apigility\Admin\Model $modules
return ModuleModel