PHP 클래스 EAuthServiceBase

상속: extends CComponent, implements IAuthService
파일 보기 프로젝트 열기: nodge/yii-eauth 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$attributes authorization attributes.
$authenticated whether user was successfuly authenticated.
$jsArguments arguments for the jQuery.eauth() javascript function.
$name the service name.
$title the service title to display in views.
$type the service type (e.g. OpenID, OAuth).

공개 메소드들

메소드 설명
__get ( string $name ) : mixed PHP getter magic method.
__isset ( string $name ) : boolean Checks if a attribute value is null.
authenticate ( ) : boolean Authenticate the user.
cancel ( $url = null ) Redirect to the {@link cancelUrl} or simply close the popup window.
getAttribute ( string $key, mixed $default = null ) : mixed Returns the authorization attribute value.
getAttributes ( ) : array Returns the array that contains all available authorization attributes.
getCancelUrl ( ) : string Returns the redirect url after unsuccessful authorization (e.g. user canceled).
getComponent ( ) : EAuth Returns the {@link EAuth} application component.
getId ( ) : mixed Returns the user unique id.
getIsAuthenticated ( ) : boolean Whether user was successfuly authenticated.
getItem ( ) : stdClass Returns the object with a human-readable representation of the current authorization.
getItemAttributes ( ) : array Returns the array that contains all available authorization attributes.
getJsArguments ( ) : array Returns arguments for the jQuery.eauth() javascript function.
getRedirectUrl ( ) : string Returns the redirect url after successful authorization.
getServiceName ( ) : string Returns service name(id).
getServiceTitle ( ) : string Returns service title.
getServiceType ( ) : string Returns service type (e.g. OpenID, OAuth).
hasAttribute ( string $key ) : boolean Whether the authorization attribute exists.
init ( EAuth $component, array $options = [] ) Initialize the component.
redirect ( string $url = null, array $params = [] ) Redirect to the url. If url is null, {@link redirectUrl} will be used.
setCancelUrl ( $url ) Sets redirect url after unsuccessful authorization (e.g. user canceled).
setComponent ( EAuth $component ) Sets {@link EAuth} application component
setRedirectUrl ( $url ) Sets redirect url after successful authorization.

보호된 메소드들

메소드 설명
_fetchAttributes ( ) Fetch attributes array.
fetchAttributes ( ) : boolean Fetch attributes array.
fetchJsonError ( stdClass $json ) : array Returns the error info from json.
getState ( string $key, mixed $defaultValue = null ) : mixed Returns the value of a variable that is stored in eauth session.
getStateKeyPrefix ( ) : string
hasState ( string $key ) : boolean Returns a value indicating whether there is a state of the specified name.
initRequest ( string $url, array $options = [] ) : cURL Initializes a new session and return a cURL handle.
makeRequest ( string $url, array $options = [], boolean $parseJson = true ) : stdClass Makes the curl request to the url.
parseJson ( string $response ) : object Parse response from {@link makeRequest} in json format and check OAuth errors.
setState ( string $key, mixed $value, mixed $defaultValue = null ) Stores a variable in eauth session.

메소드 상세

__get() 공개 메소드

This method is overridden so that service attributes can be accessed like properties.
또한 보기: getAttribute
public __get ( string $name ) : mixed
$name string property name.
리턴 mixed property value.

__isset() 공개 메소드

This method overrides the parent implementation by checking if the attribute is null or not.
public __isset ( string $name ) : boolean
$name string the attribute name.
리턴 boolean whether the attribute value is null.

_fetchAttributes() 보호된 메소드

This function is internally used to handle fetched state.
protected _fetchAttributes ( )

authenticate() 공개 메소드

Authenticate the user.
public authenticate ( ) : boolean
리턴 boolean whether user was successfuly authenticated.

cancel() 공개 메소드

Redirect to the {@link cancelUrl} or simply close the popup window.
public cancel ( $url = null )

fetchAttributes() 보호된 메소드

Fetch attributes array.
protected fetchAttributes ( ) : boolean
리턴 boolean whether the attributes was successfully fetched.

fetchJsonError() 보호된 메소드

Returns the error info from json.
protected fetchJsonError ( stdClass $json ) : array
$json stdClass the json response.
리턴 array the error array with 2 keys: code and message. Should be null if no errors.

getAttribute() 공개 메소드

Returns the authorization attribute value.
public getAttribute ( string $key, mixed $default = null ) : mixed
$key string the attribute name.
$default mixed the default value.
리턴 mixed the attribute value.

getAttributes() 공개 메소드

Returns the array that contains all available authorization attributes.
public getAttributes ( ) : array
리턴 array the attributes.

getCancelUrl() 공개 메소드

Returns the redirect url after unsuccessful authorization (e.g. user canceled).
public getCancelUrl ( ) : string
리턴 string the redirect url after unsuccessful authorization (e.g. user canceled).

getComponent() 공개 메소드

Returns the {@link EAuth} application component.
public getComponent ( ) : EAuth
리턴 EAuth the {@link EAuth} application component.

getId() 공개 메소드

Returns the user unique id.
public getId ( ) : mixed
리턴 mixed the user id.

getIsAuthenticated() 공개 메소드

Whether user was successfuly authenticated.
public getIsAuthenticated ( ) : boolean
리턴 boolean whether user was successfuly authenticated.

getItem() 공개 메소드

Returns the object with a human-readable representation of the current authorization.
public getItem ( ) : stdClass
리턴 stdClass the object.

getItemAttributes() 공개 메소드

Returns the array that contains all available authorization attributes.
사용 중단: because getAttributes is more semantic.
public getItemAttributes ( ) : array
리턴 array the attributes.

getJsArguments() 공개 메소드

Returns arguments for the jQuery.eauth() javascript function.
public getJsArguments ( ) : array
리턴 array the arguments for the jQuery.eauth() javascript function.

getRedirectUrl() 공개 메소드

Returns the redirect url after successful authorization.
public getRedirectUrl ( ) : string
리턴 string the redirect url after successful authorization.

getServiceName() 공개 메소드

Returns service name(id).
public getServiceName ( ) : string
리턴 string the service name(id).

getServiceTitle() 공개 메소드

Returns service title.
public getServiceTitle ( ) : string
리턴 string the service title.

getServiceType() 공개 메소드

Returns service type (e.g. OpenID, OAuth).
public getServiceType ( ) : string
리턴 string the service type (e.g. OpenID, OAuth).

getState() 보호된 메소드

Returns the value of a variable that is stored in eauth session.
또한 보기: setState
protected getState ( string $key, mixed $defaultValue = null ) : mixed
$key string variable name.
$defaultValue mixed default value.
리턴 mixed the value of the variable. If it doesn't exist in the session, the provided default value will be returned.

getStateKeyPrefix() 보호된 메소드

protected getStateKeyPrefix ( ) : string
리턴 string a prefix for the name of the session variables storing eauth session data.

hasAttribute() 공개 메소드

Whether the authorization attribute exists.
public hasAttribute ( string $key ) : boolean
$key string the attribute name.
리턴 boolean true if attribute exists, false otherwise.

hasState() 보호된 메소드

Returns a value indicating whether there is a state of the specified name.
protected hasState ( string $key ) : boolean
$key string state name.
리턴 boolean whether there is a state of the specified name.

init() 공개 메소드

Sets the default {@link redirectUrl} and {@link cancelUrl}.
public init ( EAuth $component, array $options = [] )
$component EAuth the component instance.
$options array properties initialization.

initRequest() 보호된 메소드

Initializes a new session and return a cURL handle.
protected initRequest ( string $url, array $options = [] ) : cURL
$url string url to request.
$options array HTTP request options. Keys: query, data, referer.
리턴 cURL handle.

makeRequest() 보호된 메소드

Makes the curl request to the url.
protected makeRequest ( string $url, array $options = [], boolean $parseJson = true ) : stdClass
$url string url to request.
$options array HTTP request options. Keys: query, data, referer.
$parseJson boolean Whether to parse response in json format.
리턴 stdClass the response.

parseJson() 보호된 메소드

Parse response from {@link makeRequest} in json format and check OAuth errors.
protected parseJson ( string $response ) : object
$response string Json string.
리턴 object result.

redirect() 공개 메소드

Redirect to the url. If url is null, {@link redirectUrl} will be used.
public redirect ( string $url = null, array $params = [] )
$url string url to redirect.
$params array

setCancelUrl() 공개 메소드

Sets redirect url after unsuccessful authorization (e.g. user canceled).
public setCancelUrl ( $url )

setComponent() 공개 메소드

Sets {@link EAuth} application component
public setComponent ( EAuth $component )
$component EAuth the application auth component.

setRedirectUrl() 공개 메소드

Sets redirect url after successful authorization.
public setRedirectUrl ( $url )

setState() 보호된 메소드

Stores a variable in eauth session.
또한 보기: getState
protected setState ( string $key, mixed $value, mixed $defaultValue = null )
$key string variable name.
$value mixed variable value.
$defaultValue mixed default value. If $value===$defaultValue, the variable will be removed from the session.

프로퍼티 상세

$attributes 보호되어 있는 프로퍼티

authorization attributes.
또한 보기: getAttribute
또한 보기: getItem
protected $attributes

$authenticated 보호되어 있는 프로퍼티

whether user was successfuly authenticated.
또한 보기: getIsAuthenticated
protected $authenticated

$jsArguments 보호되어 있는 프로퍼티

arguments for the jQuery.eauth() javascript function.
protected $jsArguments

$name 보호되어 있는 프로퍼티

the service name.
protected $name

$title 보호되어 있는 프로퍼티

the service title to display in views.
protected $title

$type 보호되어 있는 프로퍼티

the service type (e.g. OpenID, OAuth).
protected $type