Abstract Class yii\authclient\BaseClient

Inheritanceyii\authclient\BaseClient » yii\base\Component » yii\base\BaseObject
Implementsyii\authclient\ClientInterface, yii\base\Configurable
Subclassesyii\authclient\BaseOAuth, yii\authclient\OAuth1, yii\authclient\OAuth2, yii\authclient\OpenId, yii\authclient\OpenIdConnect, yii\authclient\clients\Facebook, yii\authclient\clients\GitHub, yii\authclient\clients\Google, yii\authclient\clients\GoogleHybrid, yii\authclient\clients\LinkedIn, yii\authclient\clients\Live, yii\authclient\clients\Twitter, yii\authclient\clients\TwitterOAuth2, yii\authclient\clients\VKontakte, yii\authclient\clients\Yandex
Available since version2.0
Source Code https://github.com/yiisoft/yii2-authclient/blob/master/BaseClient.php

BaseClient is a base Auth Client class.

See also yii\authclient\ClientInterface.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$behaviors yii\base\Behavior[] List of behaviors attached to this component yii\base\Component
$httpClient yii\httpclient\Client Internal HTTP client. yii\authclient\BaseClient
$id string Service id. yii\authclient\BaseClient
$name string Service name. yii\authclient\BaseClient
$normalizeUserAttributeMap array Normalize user attribute map. yii\authclient\BaseClient
$requestOptions array HTTP request options. yii\authclient\BaseClient
$stateStorage yii\authclient\StateStorageInterface Stage storage. yii\authclient\BaseClient
$title string Service title. yii\authclient\BaseClient
$userAttributes array List of user attributes yii\authclient\BaseClient
$viewOptions array View options in format: optionName => optionValue yii\authclient\BaseClient

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
className() Returns the fully qualified name of this class. yii\base\BaseObject
createRequest() Creates HTTP request instance. yii\authclient\BaseClient
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getHttpClient() Returns HTTP client. yii\authclient\BaseClient
getId() yii\authclient\BaseClient
getName() yii\authclient\BaseClient
getNormalizeUserAttributeMap() yii\authclient\BaseClient
getRequestOptions() yii\authclient\BaseClient
getStateStorage() yii\authclient\BaseClient
getTitle() yii\authclient\BaseClient
getUserAttributes() yii\authclient\BaseClient
getViewOptions() yii\authclient\BaseClient
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the object. yii\base\BaseObject
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
setHttpClient() Sets HTTP client to be used. yii\authclient\BaseClient
setId() yii\authclient\BaseClient
setName() yii\authclient\BaseClient
setNormalizeUserAttributeMap() yii\authclient\BaseClient
setRequestOptions() yii\authclient\BaseClient
setStateStorage() yii\authclient\BaseClient
setTitle() yii\authclient\BaseClient
setUserAttributes() yii\authclient\BaseClient
setViewOptions() yii\authclient\BaseClient
trigger() Triggers an event. yii\base\Component

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
createHttpClient() Creates HTTP client instance from reference or configuration. yii\authclient\BaseClient
defaultName() Generates service name. yii\authclient\BaseClient
defaultNormalizeUserAttributeMap() Returns the default $normalizeUserAttributeMap value. yii\authclient\BaseClient
defaultRequestOptions() Returns default HTTP request options. yii\authclient\BaseClient
defaultTitle() Generates service title. yii\authclient\BaseClient
defaultViewOptions() Returns the default $viewOptions value. yii\authclient\BaseClient
getState() Returns persistent state value. yii\authclient\BaseClient
getStateKeyPrefix() Returns session key prefix, which is used to store internal states. yii\authclient\BaseClient
initUserAttributes() Initializes authenticated user attributes. yii\authclient\BaseClient
normalizeUserAttributes() Normalize given user attributes according to $normalizeUserAttributeMap. yii\authclient\BaseClient
removeState() Removes persistent state value. yii\authclient\BaseClient
setState() Sets persistent state. yii\authclient\BaseClient

Property Details

$httpClient public property

Internal HTTP client.

public yii\httpclient\Client getHttpClient ( )
public void setHttpClient ( $httpClient )
$id public property

Service id.

public string getId ( )
public void setId ( $id )
$name public property

Service name.

public string getName ( )
public void setName ( $name )
$normalizeUserAttributeMap public property

Normalize user attribute map.

public array getNormalizeUserAttributeMap ( )
public void setNormalizeUserAttributeMap ( $normalizeUserAttributeMap )
$requestOptions public property

HTTP request options.

public array getRequestOptions ( )
public void setRequestOptions ( array $options )
$stateStorage public property

Stage storage.

$title public property

Service title.

public string getTitle ( )
public void setTitle ( $title )
$userAttributes public property

List of user attributes

public array getUserAttributes ( )
public void setUserAttributes ( $userAttributes )
$viewOptions public property

View options in format: optionName => optionValue

public array getViewOptions ( )
public void setViewOptions ( $viewOptions )

Method Details

createHttpClient() protected method (available since version 2.1)

Creates HTTP client instance from reference or configuration.

protected yii\httpclient\Client createHttpClient ( $reference )
$reference string|array

Component name or array configuration.

return yii\httpclient\Client

HTTP client instance.

createRequest() public method (available since version 2.1)

Creates HTTP request instance.

public yii\httpclient\Request createRequest ( )
return yii\httpclient\Request

HTTP request instance.

defaultName() protected method

Generates service name.

protected string defaultName ( )
return string

Service name.

defaultNormalizeUserAttributeMap() protected method

Returns the default $normalizeUserAttributeMap value.

Particular client may override this method in order to provide specific default map.

protected array defaultNormalizeUserAttributeMap ( )
return array

Normalize attribute map.

defaultRequestOptions() protected method (available since version 2.1)

Returns default HTTP request options.

protected array defaultRequestOptions ( )
return array

HTTP request options.

defaultTitle() protected method

Generates service title.

protected string defaultTitle ( )
return string

Service title.

defaultViewOptions() protected method

Returns the default $viewOptions value.

Particular client may override this method in order to provide specific default view options.

protected array defaultViewOptions ( )
return array

List of default $viewOptions

getHttpClient() public method (available since version 2.1)

Returns HTTP client.

public yii\httpclient\Client getHttpClient ( )
return yii\httpclient\Client

Internal HTTP client.

getId() public method

public string getId ( )
return string

Service id

getName() public method

public string getName ( )
return string

Service name.

getNormalizeUserAttributeMap() public method

public array getNormalizeUserAttributeMap ( )
return array

Normalize user attribute map.

getRequestOptions() public method (available since version 2.1)

public array getRequestOptions ( )
return array

HTTP request options.

getState() protected method

Returns persistent state value.

protected mixed getState ( $key )
$key string

State key.

return mixed

State value.

getStateKeyPrefix() protected method

Returns session key prefix, which is used to store internal states.

protected string getStateKeyPrefix ( )
return string

Session key prefix.

getStateStorage() public method

public yii\authclient\StateStorageInterface getStateStorage ( )
return yii\authclient\StateStorageInterface

Stage storage.

getTitle() public method

public string getTitle ( )
return string

Service title.

getUserAttributes() public method

public array getUserAttributes ( )
return array

List of user attributes

getViewOptions() public method

public array getViewOptions ( )
return array

View options in format: optionName => optionValue

initUserAttributes() protected abstract method

Initializes authenticated user attributes.

protected abstract array initUserAttributes ( )
return array

Auth user attributes.

normalizeUserAttributes() protected method

Normalize given user attributes according to $normalizeUserAttributeMap.

protected array normalizeUserAttributes ( $attributes )
$attributes array

Raw attributes.

return array

Normalized attributes.

throws yii\base\InvalidConfigException

on incorrect normalize attribute map.

removeState() protected method

Removes persistent state value.

protected boolean removeState ( $key )
$key string

State key.

return boolean

Success.

setHttpClient() public method (available since version 2.1)

Sets HTTP client to be used.

public void setHttpClient ( $httpClient )
$httpClient array|yii\httpclient\Client

Internal HTTP client.

setId() public method

public void setId ( $id )
$id string

Service id.

setName() public method

public void setName ( $name )
$name string

Service name.

setNormalizeUserAttributeMap() public method

public void setNormalizeUserAttributeMap ( $normalizeUserAttributeMap )
$normalizeUserAttributeMap array

Normalize user attribute map.

setRequestOptions() public method (available since version 2.1)

public void setRequestOptions ( array $options )
$options array

HTTP request options.

setState() protected method

Sets persistent state.

protected $this setState ( $key, $value )
$key string

State key.

$value mixed

State value

return $this

The object itself

setStateStorage() public method

public void setStateStorage ( $stateStorage )
$stateStorage yii\authclient\StateStorageInterface|array|string

Stage storage to be used.

setTitle() public method

public void setTitle ( $title )
$title string

Service title.

setUserAttributes() public method

public void setUserAttributes ( $userAttributes )
$userAttributes array

List of user attributes

setViewOptions() public method

public void setViewOptions ( $viewOptions )
$viewOptions array

View options in format: optionName => optionValue