FOSSology
3.2.0rc1
Open Source License Compliance by Open Source Software
|
Provides helper methods for REST api. More...
Public Member Functions | |
__construct (UserDao $userDao, Session $session, DbHelper $dbhelper) | |
checkUsernameAndPassword ($userName, $password) | |
Check the username and password against the database. More... | |
verifyAuthToken ($authHeader, &$userId, &$tokenScope) | |
isTokenActive ($valuesFromDb, $tokenId) | |
getSession () | |
updateUserSession ($userId, $scope, $groupName=null) | |
Update the session using updateSession(). More... | |
generateJwtToken ($expire, $created, $jti, $scope, $key) | |
getMaxTokenValidity () | |
userHasGroupAccess ($userId, $groupName) | |
Verify if given User Id has access to given Group name. More... | |
isGroupExisting ($groupName) | |
Verify if given Group name exists. More... | |
Private Member Functions | |
isDateExpired ($date) | |
Private Attributes | |
$session | |
$userDao | |
$dbHelper | |
Provides helper methods for REST api.
Definition at line 39 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::__construct | ( | UserDao | $userDao, |
Session | $session, | ||
DbHelper | $dbhelper | ||
) |
AuthHelper constructor.
UserDao | $userDao | User dao to use |
Session | $session | Session to use |
DbHelper | $dbhelper | Db Helper to use |
Definition at line 64 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::checkUsernameAndPassword | ( | $userName, | |
$password | |||
) |
Check the username and password against the database.
If the user is not 'Default User' and is valid, this function also update session using updateSession().
string | $userName | Username |
string | $password | Password |
Definition at line 86 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::generateJwtToken | ( | $expire, | |
$created, | |||
$jti, | |||
$scope, | |||
$key | |||
) |
Generates new JWT token.
string | $expire | When the token will expire ('YYYY-MM-DD') |
string | $created | When the token was created ('YYYY-MM-DD') |
string | $jti | Token id (pat_pk.user_pk ) |
string | $scope | User friendly token scope |
string | $key | Token secret key |
Definition at line 214 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::getMaxTokenValidity | ( | ) |
Get the value for maximum API token validity from sysconfig table.
Definition at line 231 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::getSession | ( | ) |
|
private |
Check if the given date is expired (is past).
string | $date | Date in Y-m-d format |
Definition at line 148 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::isGroupExisting | ( | $groupName | ) |
Verify if given Group name exists.
string | $groupName | Name of the group to update session with. |
Definition at line 267 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::isTokenActive | ( | $valuesFromDb, | |
$tokenId | |||
) |
Check if the token is still active and not expired.
array | $valuesFromDb | Values from DB. |
array | $tokenId | Token id (pat_pk) |
Definition at line 161 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::updateUserSession | ( | $userId, | |
$scope, | |||
$groupName = null |
|||
) |
Update the session using updateSession().
int | $userId | User id from the JWT. |
string | $scope | Scope of the current token. |
string | $groupName | Name of the group to update session with. |
Definition at line 191 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::userHasGroupAccess | ( | $userId, | |
$groupName | |||
) |
Verify if given User Id has access to given Group name.
int | $userId | User id from the JWT. |
string | $groupName | Name of the group to verify access to. |
Definition at line 244 of file AuthHelper.php.
Fossology\UI\Api\Helper\AuthHelper::verifyAuthToken | ( | $authHeader, | |
& | $userId, | ||
& | $tokenScope | ||
) |
Verify the JWT token sent by user.
string | $authHeader | The "Authorization" header sent by user. |
int | $userId | The user id as per the valid token. |
string | $tokenScope | The scope of the token presented. |
Definition at line 101 of file AuthHelper.php.
|
private |
DB helper for DB interaction.
Definition at line 55 of file AuthHelper.php.
|
private |
Current Symfony session
Definition at line 45 of file AuthHelper.php.
|
private |
User DAO object
Definition at line 50 of file AuthHelper.php.