Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invocation details for autobahn #254

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7
- 7.1
- hhvm

matrix:
Expand All @@ -13,7 +12,7 @@ matrix:

before_install:
- export PATH=$HOME/.local/bin:$PATH
- pip install crossbar --user `whoami`
- pip install --user crossbar

before_script:
- composer install
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@
}
},
"require": {
"php": ">=5.4",
"react/socket": "0.4.*",
"php": ">=5.6",
"react/socket": "0.4.* | 0.5.*",
"cboden/ratchet": "0.3.*",
"ratchet/pawl": "0.1.*",
"ratchet/pawl": "0.2.*",
"psr/log": "~1",
"guzzle/guzzle": "~3.9"
"ext-openssl": "*",
"voryx/thruway-common": "^1.0"
},
"suggest": {
"ext-mcrypt":"If you want to use WAMP-CRA for authentication"
"require-dev": {
"phpunit/phpunit": "^5.5.4"
},
"extra": {
"branch-alias": {
Expand Down
7 changes: 1 addition & 6 deletions src/Thruway/AbstractSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Thruway;


use Thruway\Message\AbortMessage;
use Thruway\Message\Message;

Expand All @@ -13,7 +12,6 @@
*/
abstract class AbstractSession
{

/**
* Session state
* @const int
Expand Down Expand Up @@ -93,7 +91,6 @@ public function getState()
return $this->state;
}


/**
* Set athentication state (authenticated or not)
*
Expand Down Expand Up @@ -144,7 +141,6 @@ public function getRealm()
return $this->realm;
}


/**
* Get session ID
*
Expand Down Expand Up @@ -248,5 +244,4 @@ public function getLoop()
{
return $this->loop;
}

}
}
1 change: 0 additions & 1 deletion src/Thruway/Authentication/AbstractAuthProviderClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Thruway\Authentication;

use React\EventLoop\LoopInterface;
use Thruway\ClientSession;
use Thruway\Logging\Logger;
use Thruway\Peer\Client;

Expand Down
3 changes: 0 additions & 3 deletions src/Thruway/Authentication/AnonymousAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

namespace Thruway\Authentication;


use Thruway\Event\MessageEvent;
use Thruway\Message\HelloMessage;
use Thruway\Message\WelcomeMessage;
use Thruway\Module\RealmModuleInterface;


/**
* Class AnonymousAuthenticator
* @package Thruway\Authentication
*/
class AnonymousAuthenticator implements RealmModuleInterface

{

/**
Expand Down
2 changes: 0 additions & 2 deletions src/Thruway/Authentication/AuthenticationDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
*
* @package Thruway\Authentication
*/

class AuthenticationDetails implements \JsonSerializable
{

/**
* @var int
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Thruway/Authentication/AuthenticationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
use Thruway\Realm;
use Thruway\Session;


/**
* Class AuthenticationManager
*
* @package Thruway\Authentication
*/
class AuthenticationManager extends RouterModuleClient implements RealmModuleInterface

{
/**
* List authentication methods
Expand Down
3 changes: 0 additions & 3 deletions src/Thruway/Authentication/AuthorizationManager.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php


namespace Thruway\Authentication;


use Ratchet\Wamp\Exception;
use React\EventLoop\LoopInterface;
use Thruway\Common\Utils;
Expand All @@ -17,7 +15,6 @@
use Thruway\Result;
use Thruway\Session;


/**
* Class AuthorizationManager
* @package Thruway\Authentication
Expand Down
8 changes: 3 additions & 5 deletions src/Thruway/Authentication/ClientWampCraAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Thruway\Authentication;


use Thruway\Common\Utils;
use Thruway\Logging\Logger;
use Thruway\Message\AuthenticateMessage;
Expand All @@ -13,7 +12,6 @@
*/
class ClientWampCraAuthenticator implements ClientAuthenticationInterface
{

/**
* @var string|int
*/
Expand Down Expand Up @@ -50,7 +48,7 @@ public function __construct($authid, $key = null)
*/
public function getAuthenticateFromChallenge(ChallengeMessage $msg)
{
Logger::info($this, "Got challenge");
Logger::debug($this, "Got challenge");
Logger::debug($this, "Challenge Message: " . json_encode($msg));


Expand All @@ -61,14 +59,14 @@ public function getAuthenticateFromChallenge(ChallengeMessage $msg)

$details = $msg->getDetails();
if (!is_object($details)) {
Logger::info($this, "No details sent with challenge");
Logger::debug($this, "No details sent with challenge");
return false;
}

if (isset($details->challenge)) {
$challenge = $details->challenge;
} else {
Logger::info($this, "No challenge for wampcra?");
Logger::debug($this, "No challenge for wampcra?");
return false;
}

Expand Down
4 changes: 1 addition & 3 deletions src/Thruway/Authentication/WampCraAuthProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Thruway\Authentication;


use Thruway\Message\HelloMessage;
use Thruway\Message\Message;

Expand All @@ -13,7 +12,6 @@
*/
class WampCraAuthProvider extends AbstractAuthProviderClient
{

/**
* @var \Thruway\Authentication\WampCraUserDbInterface
*/
Expand Down Expand Up @@ -67,7 +65,7 @@ public function processHello(array $args)
}

// create a challenge
$nonce = bin2hex(mcrypt_create_iv(22, MCRYPT_DEV_URANDOM));
$nonce = bin2hex(openssl_random_pseudo_bytes(22));
$authRole = "user";
$authMethod = "wampcra";
$authProvider = "userdb";
Expand Down
1 change: 0 additions & 1 deletion src/Thruway/Authentication/WampCraUserDbInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*
* @package Thruway\Authentication
*/

interface WampCraUserDbInterface
{

Expand Down
9 changes: 5 additions & 4 deletions src/Thruway/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Thruway;


use Thruway\Common\Utils;
use Thruway\Logging\Logger;
use Thruway\Message\CallMessage;
Expand All @@ -21,7 +20,6 @@
*/
class Call
{

/**
* @var \Thruway\Session
*/
Expand Down Expand Up @@ -89,7 +87,7 @@ class Call
*
* @param \Thruway\Session $callerSession
* @param \Thruway\Message\CallMessage $callMessage
* @param Registration $registration
* @param Procedure $procedure
*/
public function __construct(
Session $callerSession,
Expand Down Expand Up @@ -161,7 +159,7 @@ public function processYield(Session $session, YieldMessage $msg)
*/
public function processCancel(Session $session, CancelMessage $msg) {
if ($this->getCallerSession() !== $session) {
Logger::warning($this, "session attempted to cancel call they did not own.");
Logger::warning($this, "session " . $session->getSessionId() . " attempted to cancel call they did not own.");
return false;
}

Expand Down Expand Up @@ -304,6 +302,8 @@ public function getInvocationMessage()
"authrole" => $authenticationDetails->getAuthRole(),
"authroles" => $authenticationDetails->getAuthRoles(),
"authmethod" => $authenticationDetails->getAuthMethod(),
'caller_authid' => $authenticationDetails->getAuthId(),
'caller_authrole' => $authenticationDetails->getAuthRoles()
];

if ($authenticationDetails->getAuthExtra() !== null) {
Expand All @@ -323,6 +323,7 @@ public function getInvocationMessage()
if (count($details) == 0) {
$details = new \stdClass();
}

$invocationMessage->setDetails($details);

$this->setIsProgressive($isProgressive);
Expand Down
77 changes: 1 addition & 76 deletions src/Thruway/CallResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
class CallResult extends \ArrayObject
{

/**
* @var \Thruway\Message\ResultMessage
*/
Expand Down Expand Up @@ -86,78 +85,4 @@ public function getDetails()
{
return $this->getResultMessage()->getDetails();
}

// // ArrayAccess interface
// /**
// * (PHP 5 &gt;= 5.0.0)<br/>
// * Whether a offset exists
// * @link http://php.net/manual/en/arrayaccess.offsetexists.php
// * @param mixed $offset <p>
// * An offset to check for.
// * </p>
// * @return boolean true on success or false on failure.
// * </p>
// * <p>
// * The return value will be casted to boolean if non-boolean was returned.
// */
// public function offsetExists($offset)
// {
// $args = $this->getArguments();
//
// if ($args === null) return false;
//
// return isset($args[$offset]);
// }
//
// /**
// * (PHP 5 &gt;= 5.0.0)<br/>
// * Offset to retrieve
// * @link http://php.net/manual/en/arrayaccess.offsetget.php
// * @param mixed $offset <p>
// * The offset to retrieve.
// * </p>
// * @return mixed Can return all value types.
// */
// public function offsetGet($offset)
// {
// $args = $this->getArguments();
//
// return $args[$offset];
// }
//
// /**
// * (PHP 5 &gt;= 5.0.0)<br/>
// * Offset to set
// * @link http://php.net/manual/en/arrayaccess.offsetset.php
// * @param mixed $offset <p>
// * The offset to assign the value to.
// * </p>
// * @param mixed $value <p>
// * The value to set.
// * </p>
// * @return void
// */
// public function offsetSet($offset, $value)
// {
// if ($offset === null) {
// $this->getArguments()[] = $value;
// } else {
// $this->getArguments()[$offset] = $value;
// }
// }
//
// /**
// * (PHP 5 &gt;= 5.0.0)<br/>
// * Offset to unset
// * @link http://php.net/manual/en/arrayaccess.offsetunset.php
// * @param mixed $offset <p>
// * The offset to unset.
// * </p>
// * @return void
// */
// public function offsetUnset($offset)
// {
// unset($this->getArguments()[$offset]);
// }

}
}
5 changes: 1 addition & 4 deletions src/Thruway/ClientSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Thruway;


use React\Promise\Promise;
use Thruway\Message\Message;
use Thruway\Peer\ClientInterface;
Expand All @@ -15,7 +14,6 @@
*/
class ClientSession extends AbstractSession
{

/**
* @var \Thruway\Peer\Client
*/
Expand Down Expand Up @@ -129,7 +127,6 @@ public function close()
*/
public function onClose()
{

$this->state = static::STATE_DOWN;
}

}
Loading