Skip to content

Commit

Permalink
Implement #6: remove Zend_Amf_Auth_Abstract class and usefproject\amf…
Browse files Browse the repository at this point in the history
…\auth\AuthAbstract instead
  • Loading branch information
Bui Sy Nguyen committed Jan 21, 2016
1 parent de15e7d commit 177d168
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 50 deletions.
5 changes: 1 addition & 4 deletions fproject/Zend/Amf/Adobe/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* @version $Id$
*/

/** @see Zend_Amf_Auth_Abstract */
require_once 'Zend/Amf/Auth/Abstract.php';

/** @see Zend_Acl */
require_once 'Zend/Acl.php';

Expand All @@ -38,7 +35,7 @@
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Adobe_Auth extends Zend_Amf_Auth_Abstract
class Zend_Amf_Adobe_Auth extends \fproject\amf\auth\AuthAbstract
{

/**
Expand Down
39 changes: 0 additions & 39 deletions fproject/Zend/Amf/Auth/Abstract.php

This file was deleted.

11 changes: 7 additions & 4 deletions fproject/Zend/Amf/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@

/** @see Zend_Auth */
require_once 'Zend/Auth.php';

use fproject\amf\auth\AuthAbstract;

/**
* An AMF gateway server implementation to allow the connection of the Adobe Flash Player to
* Zend Framework
Expand Down Expand Up @@ -116,7 +119,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
/**
* Authentication handler object
*
* @var Zend_Amf_Auth_Abstract
* @var AuthAbstract
*/
protected $_auth;
/**
Expand All @@ -139,10 +142,10 @@ public function __construct()
* If the authentication adapter implements a "getAcl()" method, populate
* the ACL of this instance with it (if none exists already).
*
* @param Zend_Amf_Auth_Abstract $auth
* @param AuthAbstract $auth
* @return Zend_Amf_Server
*/
public function setAuth(Zend_Amf_Auth_Abstract $auth)
public function setAuth(AuthAbstract $auth)
{
$this->_auth = $auth;
if ((null === $this->getAcl()) && method_exists($auth, 'getAcl')) {
Expand All @@ -153,7 +156,7 @@ public function setAuth(Zend_Amf_Auth_Abstract $auth)
/**
* Get authentication adapter
*
* @return Zend_Amf_Auth_Abstract
* @return AuthAbstract
*/
public function getAuth()
{
Expand Down
35 changes: 35 additions & 0 deletions fproject/amf/auth/AuthAbstract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
///////////////////////////////////////////////////////////////////////////////
//
// © Copyright f-project.net 2010-present.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////

namespace fproject\amf\auth;

/**
* Base abstract class for AMF authentication implementation
*
*/
abstract class AuthAbstract implements AuthAdapterInterface
{
protected $_username;
protected $_password;

public function setCredentials($username, $password) {
$this->_username = $username;
$this->_password = $password;
}
}
5 changes: 2 additions & 3 deletions tests/Zend/Amf/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
require_once 'Zend/Amf/Server.php';
require_once 'Zend/Amf/Request.php';
require_once 'Zend/Amf/Parse/TypeLoader.php';
require_once 'Zend/Amf/Auth/Abstract.php';
require_once 'Zend/Amf/Value/Messaging/RemotingMessage.php';
require_once 'Zend/Session.php';
require_once 'Zend/Acl.php';
Expand Down Expand Up @@ -282,7 +281,7 @@ public function testLogout()
}
}

class WrongPassword extends Zend_Amf_Auth_Abstract
class WrongPassword extends \fproject\amf\auth\AuthAbstract
{
public function authenticate() {
return new \fproject\amf\auth\AuthResult(\fproject\amf\auth\AuthResult::FAILURE_CREDENTIAL_INVALID,
Expand All @@ -292,7 +291,7 @@ public function authenticate() {
}
}

class RightPassword extends Zend_Amf_Auth_Abstract
class RightPassword extends \fproject\amf\auth\AuthAbstract
{
public function __construct($name, $role)
{
Expand Down

0 comments on commit 177d168

Please sign in to comment.