Alternatively, it would be better to use one of the Aura.Auth package services to handle authentication and session-state management for you. To retain values in a session, you can start a session by force with session_start() on your own. However, because the values are stored in a $_SESSION segment, the values will not be retained if a session is not running. You can also use the set*() variations of the get*() methods above to force the Auth object to whatever values you like. IsAnon(), isIdle(), isExpired(), isValid(): these return true or false, based on the current authentication status. Status::EXPIRED - the authenticated session has lasted for too long in total Status::IDLE - the authenticated session has been idle for too long GetStatus(): returns the current authentication status constant. GetLastActive(): return the Unix time of most-recent activity (generally that of the current request) GetFirstActive(): returns the Unix time of first activity (login) GetUserData(): returns the array of optional arbitrary user data GetUserName(): returns the authenticated username string You can retrieve authentication information using the following methods on the Auth instance: To track authentication state and related information, create an Auth object using the AuthFactory. To ask questions, provide feedback, or otherwise communicate with the Aura community, please join our Google Group, follow on Twitter, or chat with us on #auraphp on Freenode. You notice compliance oversights, please send a patch via pull request. This library attempts to comply with PSR-1, PSR-2, and PSR-4. This requires Composer to be available as composer. To run the unit tests at the command line, issue composer install and then vendor/bin/phpunit at the package root. It is installable and autoloadable via Composer as aura/auth.Īlternatively, download a release or clone this repository, then require or include its autoload.php file. This library requires PHP 7.2 or later, and has no userland dependencies. That is more properly the domain of application-level functionality, or at least a separate Aura bundle. It does not currently, and probably will not in the future, handle user account creation and management. Note that the purpose of this package is only to authenticate user credentials.
0 Comments
Leave a Reply. |