Example #1
0
 public function onCheckAuthentication(ResRequest $request)
 {
     // the request must contains all parameters from the redirect. We have
     // to check whether everything is valid and return true
     return $request->isValidSignature(self::$assoc->getSecret(), self::$assoc->getAssocType());
 }
Example #2
0
 public function extract(array $data)
 {
     $record = new ResRequest();
     $record->setParams($data);
     if (isset($data['openid_op_endpoint'])) {
         $record->setOpEndpoint($data['openid_op_endpoint']);
     } else {
         throw new InvalidDataException('OP endpoint not set');
     }
     if (isset($data['openid_claimed_id'])) {
         $record->setClaimedId($data['openid_claimed_id']);
     }
     if (isset($data['openid_identity'])) {
         $record->setIdentity($data['openid_identity']);
     }
     if (isset($data['openid_return_to'])) {
         $record->setReturnTo($data['openid_return_to']);
     } else {
         throw new InvalidDataException('Return to not set');
     }
     if (isset($data['openid_response_nonce'])) {
         $record->setResponseNonce($data['openid_response_nonce']);
     } else {
         throw new InvalidDataException('Response nonce not set');
     }
     if (isset($data['openid_invalidate_handle'])) {
         $record->setInvalidateHandle($data['openid_invalidate_handle']);
     }
     if (isset($data['openid_assoc_handle'])) {
         $record->setAssocHandle($data['openid_assoc_handle']);
     } else {
         throw new InvalidDataException('Assoc handle not set');
     }
     if (isset($data['openid_signed'])) {
         $record->setSigned($data['openid_signed']);
     } else {
         throw new InvalidDataException('Signed not set');
     }
     if (isset($data['openid_sig'])) {
         $record->setSig($data['openid_sig']);
     } else {
         throw new InvalidDataException('Sig not set');
     }
     return $record;
 }
Example #3
0
    public function onCheckAuthentication(ResRequest $request)
    {
        $sql = <<<SQL
SELECT
\t`assoc`.`id`,
\t`assoc`.`assocHandle`,
\t`assoc`.`assocType`,
\t`assoc`.`sessionType`,
\t`assoc`.`secret`,
\t`assoc`.`expires`,
\t`assoc`.`date`
FROM 
\t{$this->registry['table.openid_assoc']} `assoc`
WHERE 
\t`assoc`.`assocHandle` = ?
SQL;
        $row = $this->sql->getRow($sql, array($request->getAssocHandle()));
        if (!empty($row)) {
            return $request->isValidSignature($row['secret'], $row['assocType']);
        } else {
            throw new Exception('Invalid association');
        }
    }