Zend Framework  3.0
Public Member Functions | Protected Attributes | List of all members
FileResolver Class Reference

HTTP Authentication File Resolver. More...

Public Member Functions

 __construct ($path= '')
 Constructor.
 
 setFile ($path)
 Set the path to the credentials file.
 
 getFile ()
 Returns the path to the credentials file.
 
 resolve ($username, $realm, $password=null)
 Resolve credentials.
 

Protected Attributes

 $file
 

Detailed Description

HTTP Authentication File Resolver.

Constructor & Destructor Documentation

__construct (   $path = '')

Constructor.

Parameters
string$pathComplete filename where the credentials are stored

Member Function Documentation

getFile ( )

Returns the path to the credentials file.

Returns
string
resolve (   $username,
  $realm,
  $password = null 
)

Resolve credentials.

Only the first matching username/realm combination in the file is returned. If the file contains credentials for Digest authentication, the returned string is the password hash, or h(a1) from RFC 2617. The returned string is the plain-text password for Basic authentication.

The expected format of the file is: username:realm:sharedSecret

That is, each line consists of the user's username, the applicable authentication realm, and the password or hash, each delimited by colons.

Parameters
string$usernameUsername
string$realmAuthentication Realm
Returns
string|false User's shared secret, if the user is found in the realm, false otherwise.
Exceptions
Exception\ExceptionInterface

Implements ResolverInterface.

setFile (   $path)

Set the path to the credentials file.

Parameters
string$path
Returns
FileResolver Provides a fluent interface
Exceptions
Exception\InvalidArgumentExceptionif path is not readable

Member Data Documentation

$file
protected