Properties

$socialManager

$socialManager : \Social\Service\SocialManager

The manager that handles basic logic for the Social module

Type

\Social\Service\SocialManager

$csrf

$csrf : string

The hashed string to add extra level of security Stands for cross site request forgery

Type

string — hash

$providerName

$providerName : string

The name of the social provider Set in actual named provider

Type

string

$authorisationParams

$authorisationParams : array

The basic parameters to append to the initial call to the provider

Type

array

$accessParams

$accessParams : array

Basic former for access params array

Type

array

$callback

$callback : string

The URI that the provider returns to

Type

string

$action

$action : string

social login or registration

Type

string

$baseAuthorisationUrl

$baseAuthorisationUrl : string

LINKEDIN's base authorisation URL

Type

string

$requestAccessTokenUrl

$requestAccessTokenUrl : string

The URL that LINKEDIN requires to request an access token

Type

string

$requestUserProfileUrl

$requestUserProfileUrl : string

The URL that LINKEDIN requires to request the user's profile

Type

string

Methods

__construct()

__construct(\Social\Service\SocialManager  $socialManager) 

Constructor Instantiate (extending) class and pass Social manager and set the extending social provider name.

Parameters

\Social\Service\SocialManager $socialManager

getRedirectRoute()

getRedirectRoute(string  $callback) : string

Get the full redirect URL (including query string)

Parameters

string $callback

Returns

string —

full redirect URL

sendClientRequest()

sendClientRequest(string  $callback, array  $queryParams) : array

Send Client Request Form client request URL with query params and send via Zend Client

Parameters

string $callback

the callback URL

array $queryParams

parameters to append to end of callback URL

Returns

array —

that contains the user profile

getUserProfile()

getUserProfile(\Zend\Http\Client  $client, string  $token) : array

Make new request to LINKEDIN to get user profile Using the access token that LINKEDIN returned for previous request Change static escaper for LinkedIn social provider Otherwise the brackets in $requestUserProfileUrl will be URL escaped and the call will fail

Parameters

\Zend\Http\Client $client

Zend Client that makes the HTTP request

string $token

Returns

array —

corresponding to the user

setProviderName()

setProviderName() 

Set the provider name

updateAuthorisationParams()

updateAuthorisationParams() 

Update authorisation parameters In this case just add the single scope

updateAccessParams()

updateAccessParams(array  $queryParams) : array

Update access parameters in this case just add values for grant_type and scope keys

Parameters

array $queryParams

in this case not used

Returns

array —

(empty)

handleAccessTokenResponse()

handleAccessTokenResponse(\Zend\Http\Client  $client, \Social\Providers\Response  $response) : array

Handle response after requesting access token from LINKEDIN

Parameters

\Zend\Http\Client $client

Zend Client that makes the HTTP request

\Social\Providers\Response $response

Throws

\Exception

Returns

array —

corresponding to the user

processUserProfile()

processUserProfile(\Social\Providers\Response  $response) : array

Process the response that LINKEDIN returned to the getUserProfile request

Parameters

\Social\Providers\Response $response

Throws

\Exception

if the response does not contain user profile

Returns

array —

array containing user profile

checkReturnedQuery()

checkReturnedQuery(array  $params) 

Check the query string provided by the social provider to ensure that it has the keys code and state and that the value of state corresponds to the CSRF value that was sent to the provider

Parameters

array $params

the params that need checking

Throws

\Exception

getQuery()

getQuery() : string

Get HTTP query string after setting up basic values for authorisationParams array

Returns

string —

the HTT{ query string

setCsrf()

setCsrf() : string

Set (new) csrf hashed string

Returns

string —

csrf hash

getCsrf()

getCsrf(boolean  $regenerate = false) : string

Get hashed security string

Parameters

boolean $regenerate

whether to create a new one if one already exists

Returns

string —

hashed csrf

checkCsrf()

checkCsrf(string  $value) : boolean

Check whether the hash value matches the original created in getCsrf()

Parameters

string $value

the hashed value to check

Returns

boolean —

whether passed value is valid

checkUserProfile()

checkUserProfile(\Social\Providers\Zend\Http\Response  $response) : \Social\Providers\JSON

CHeck that the returned response has the required parameters

Parameters

\Social\Providers\Zend\Http\Response $response

Throws

\Exception

when returned object does not conform to requirements

Returns

\Social\Providers\JSON —

object