src/Setup.php
/**
     * Main plugin method
     *
     * @param array  $users a list of user/pass
     * @param string $realm the title of the auth popup
     *
     * @return function
     */
Main plugin method
@param array  $users a list of user/pass
@param string $realm the title of the auth popup

@return function
Main plugin method @param array $users a list of user / pass @param string $realm the title of the auth popup @return function
public function import(array $users = array(), $realm = 'Restricted area')
    {
        Argument::i()->test(2, 'string');
        $this->realm = $realm;
        $self = $this;
        return function (Registry $request, Registry $response) use ($users, $self) {
            $digest = $request->get('server', 'PHP_AUTH_DIGEST');
            if (empty($digest)) {
                return $self->dialog();
            }
            $data = $self->digest($digest);
            if (!isset($users[$data['username']])) {
                return $self->dialog();
            }
            $signature = $self->getSignature($users, $data);
            if ($data['response'] !== $signature) {
                return $self->dialog();
            }
        };
    }
public function import ( array $ users = array ( ) , $ realm = 'Restricted area' ) { Argument :: i ( ) -> test ( 2 , 'string' ) ; $ this -> realm = $ realm ; $ self = $ this ; return function ( Registry $ request , Registry $ response ) use ( $ users , $ self ) { $ digest = $ request -> get ( 'server' , 'PHP_AUTH_DIGEST' ) ; if ( empty ( $ digest ) ) { return $ self -> dialog ( ) ; } $ data = $ self -> digest ( $ digest ) ; if ( ! isset ( $ users [ $ data [ 'username' ] ] ) ) { return $ self -> dialog ( ) ; } $ signature = $ self -> getSignature ( $ users , $ data ) ; if ( $ data [ 'response' ] !== $ signature ) { return $ self -> dialog ( ) ; } } ; }
Main plugin method
 @param array  $users a list of user/pass
 @param string $realm the title of the auth popup
Main plugin method @param array $users a list of user / pass @param string $realm the title of the auth popup
//realm must be a string //get digest //if no digest //this throws anyways // analyze the PHP_AUTH_DIGEST variable //if no username //this throws anyways // generate the valid response //if it doesnt match //this throws anyways