RoleAuth

Implements \RtmClient\Auth\iAuth

RTM role-based authentication.

Client connection to RTM is established in default role. Client can acquire different the permissions by authenticating for a different role. This is done in a two-step process using the Handshake and then Authenticate PDU.

package

Default

Methods

Creates Role based authenticator.

__construct(string $role, string $role_secret, array $options = array()) 

Arguments

$role

string

Role name

$role_secret

string

Role secret key

$options

array

RoleAuth options

$options = [
  'logger' => (Psr\Log\LoggerInterface) Logger
]

Makes authentication procedure.

authenticate(\RtmClient\Connection $connection) : boolean
Throws
\RtmClient\Exceptions\AuthenticationException

if unable to get nonce from RTM

\RtmClient\Exceptions\AuthenticationException

if failed to authenticate

Arguments

$connection

\RtmClient\Connection

Connection instance

Response

boolean

true if successfully authenticates, false otherwise

Sends handshake request to Satori RTM

handshake() : boolean

Response

boolean

true if successfully authenticates, false otherwise

Sends authenticate reply to RTM.

roleSecretAuth(string $nonce) : true
Throws
\RtmClient\Exceptions\AuthenticationException

if failed to authenticate

Arguments

$nonce

string

Nonce from RTM reply on handshake

Response

true

if successfully authenticated

Constants

Timeout limit on read operations

READ_TIMEOUT_SEC

ERROR_CODE_NONCE_NOT_FOUND

ERROR_CODE_NONCE_NOT_FOUND

ERROR_CODE_FAILED_TO_AUTHENTICATE

ERROR_CODE_FAILED_TO_AUTHENTICATE

Properties

Connection instance

connection : \RtmClient\Connection
var

Type(s)

\RtmClient\Connection

Uses to determine if auth still in progress.

auth_in_progress : boolean
var

Type(s)

boolean