web\User removeIdentityCookie()

removeIdentityCookie() protected method (available since version 2.0.9) Removes the identity cookie. This method is used when $enableAutoLogin is true. protected void removeIdentityCookie ( )

web\User logout()

logout() public method Logs out the current user. This will remove authentication-related session data. If $destroySession is true, all session data will be removed. public boolean logout ( $destroySession = true )$destroySession boolean Whether to destroy the whole session. Defaults to true. This parameter is ignored if $enableSession is false. return boolean Whether the user is logged out

web\User loginRequired()

loginRequired() public method Redirects the user browser to the login page. Before the redirection, the current URL (if it's not an AJAX url) will be kept as $returnUrl so that the user browser may be redirected back to the current page after successful login. Make sure you set $loginUrl so that the user browser can be redirected to the specified login URL after calling this method. Note that when $loginUrl is set, calling this method will NOT terminate the application execution. See also \

web\User loginByCookie()

loginByCookie() protected method Logs in a user by cookie. This method attempts to log in a user using the ID and authKey information provided by the identity cookie. protected void loginByCookie ( )

web\User loginByAccessToken()

loginByAccessToken() public method Logs in a user by the given access token. This method will first authenticate the user by calling yii\web\IdentityInterface::findIdentityByAccessToken() with the provided access token. If successful, it will call login() to log in the authenticated user. If authentication fails or login() is unsuccessful, it will return null. public yii\web\IdentityInterface|null loginByAccessToken ( $token, $type = null )$token string The access token $type mixed The

web\User login()

login() public method Logs in a user. After logging in a user, you may obtain the user's identity information from the $identity property. If $enableSession is true, you may even get the identity information in the next requests without calling this method again. The login status is maintained according to the $duration parameter: $duration == 0: the identity information will be stored in session and will be available via $identity as long as the session remains active. $duration > 0:

web\User init()

init() public method Initializes the application component. public void init ( )

web\User getReturnUrl()

getReturnUrl() public method Returns the URL that the browser should be redirected to after successful login. This method reads the return URL from the session. It is usually used by the login action which may call this method to redirect the browser to where it goes after successful authentication. See also loginRequired(). public string getReturnUrl ( $defaultUrl = null )$defaultUrl string|array The default return URL in case it was not set previously. If this is null and the return

web\User getIsGuest()

getIsGuest() public method Returns a value indicating whether the user is a guest (not authenticated). See also getIdentity(). public boolean getIsGuest ( )return boolean Whether the current user is a guest.

web\User getIdentityAndDurationFromCookie()

getIdentityAndDurationFromCookie() protected method (available since version 2.0.9) Determines if an identity cookie has a valid format and contains a valid auth key. This method is used when $enableAutoLogin is true. This method attempts to authenticate a user using the information in the identity cookie. See also loginByCookie(). protected array|null getIdentityAndDurationFromCookie ( )return array|null Returns an array of 'identity' and 'duration' if valid, otherwise null.