# PwsAuth PwsAuth is an authentication protocol throught http header designed to web services ## Request Headers Request headers must be define as follow : Pws-Authorization : $type $token Pws-Ident : $userkey The **$token** can be either a `loginToken` or a `sessionToken` The **$token** is divided in four part * a datetime formatted with the `Authenticator::DATE_FORMAT` format * an obfuscate part 's token builded by date, common salt & the third token 's part * a loginToken representing a user signed token for a specific login at given date OR a session token representing the session id * noise data to be removed The complete token is valid only if obfuscate part can be rebuild. This simple mecanism ensure that **sessionId** is valid and can be safety load Authenticator 's configuration comes with a `hash.session.index` and `hash.noise.length` values wich can be redefined to move the session token part into the complete token << hash.session.index >> << hash.noise.length >> |-----------------------------------------------------------<<-^->>---------------------------------------------<<-^->>--------| |- type ||-- date ---|------------ obfuscate token ---------<<-^->>-------------- session token ----------------<<-^->> noise -| | || 1 | 2 | 3 | 4 | PwsAuth2 242003031711e1a6104135f04c6c01e6cd5952ecafbb53c928603b0gb64tqo609qse6ovd7lhdvk4fnaqk7cdl26e4d4qh7jb41eu5f1zb5y79m8pgu3 ### Requirements PHP >= 5.4 ### Install The package can be installed using [ Composer ](https://getcomposer.org/). ``` composer require meta-tech/pws-auth ``` Or add the package to your `composer.json`. ``` "require": { "meta-tech/pws-auth" : "^2.1" } ``` ### Authenticator instanciation ```php