class JOAuth1Client

Joomla Platform class for interacting with an OAuth 1.0 and 1.0a server.

Methods

__construct( Registry $options = null, JHttp $client = null, JInput $input = null, JApplicationWeb $application = null, string $version = null)

Constructor.

array
authenticate()

Method to for the oauth flow.

JHttpResponse
oauthRequest( string $url, string $method, array $parameters, mixed $data = array(), array $headers = array())

Method used to make an OAuth request.

void
validateResponse( string $url, JHttpResponse $response)

Method to validate a response.

string
toUrl( string $url, array $parameters)

Method to create the URL formed string with the parameters.

string
safeEncode( mixed $data)

Encodes the string or array passed in a way compatible with OAuth.

static  string
generateNonce()

Method used to generate the current nonce.

array
verifyCredentials()

Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not.

mixed
getOption( string $key)

Get an option from the JOauth1aClient instance.

setOption( string $key, mixed $value)

Set an option for the JOauth1aClient instance.

array
getToken()

Get the oauth token key or secret.

setToken( array $token)

Set the oauth token.

Details

__construct( Registry $options = null, JHttp $client = null, JInput $input = null, JApplicationWeb $application = null, string $version = null)

Constructor.

Parameters

Registry $options OAuth1Client options object.
JHttp $client The HTTP client object.
JInput $input The input object
JApplicationWeb $application The application object
string $version Specify the OAuth version. By default we are using 1.0a.

array authenticate()

Method to for the oauth flow.

Return Value

array Contains access token key, secret and verifier.

Exceptions

DomainException

JHttpResponse oauthRequest( string $url, string $method, array $parameters, mixed $data = array(), array $headers = array())

Method used to make an OAuth request.

Parameters

string $url The request URL.
string $method The request method.
array $parameters Array containing request parameters.
mixed $data The POST request data.
array $headers An array of name-value pairs to include in the header of the request

Return Value

JHttpResponse

Exceptions

DomainException

abstract void validateResponse( string $url, JHttpResponse $response)

Method to validate a response.

Parameters

string $url The request URL.
JHttpResponse $response The response to validate.

Return Value

void

Exceptions

DomainException

string toUrl( string $url, array $parameters)

Method to create the URL formed string with the parameters.

Parameters

string $url The request URL.
array $parameters Array containing request parameters.

Return Value

string The formed URL.

string safeEncode( mixed $data)

Encodes the string or array passed in a way compatible with OAuth.

If an array is passed each array value will will be encoded.

Parameters

mixed $data The scalar or array to encode.

Return Value

string $data encoded in a way compatible with OAuth.

static string generateNonce()

Method used to generate the current nonce.

Return Value

string The current nonce.

abstract array verifyCredentials()

Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not.

Return Value

array The decoded JSON response

mixed getOption( string $key)

Get an option from the JOauth1aClient instance.

Parameters

string $key The name of the option to get

Return Value

mixed The option value

JOAuth1Client setOption( string $key, mixed $value)

Set an option for the JOauth1aClient instance.

Parameters

string $key The name of the option to set
mixed $value The option value to set

Return Value

JOAuth1Client This object for method chaining

array getToken()

Get the oauth token key or secret.

Return Value

array The oauth token key and secret.

JOAuth1Client setToken( array $token)

Set the oauth token.

Parameters

array $token The access token key and secret.

Return Value

JOAuth1Client This object for method chaining.