Authentication
in package
Table of Contents
- $cache : Cache_Lite_Function|Cache_Lite_Output
- $client_id : mixed
- $created_date : mixed
- $db : mixed
- $end_point_id : mixed
- $expire_session : mixed
- $flags : mixed
- $idle_timeout : mixed
- $ip_address : mixed
- $name : mixed
- $obj : mixed
- $object_id : mixed
- $rl : mixed
- $session_id : mixed
- $type_id : mixed
- $updated_date : mixed
- $user_agent : mixed
- __construct() : mixed
- Authentication constructor.
- changeObject() : bool
- Check() : bool
- checkApplicantPassword() : bool
- checkBarcode() : bool
- checkClientPC() : bool
- checkCompanyStatus() : bool
- checkFingerPrint() : bool
- checkIButton() : bool
- checkPassword() : bool
- checkPhonePassword() : bool
- checkUsername() : bool
- Checks just the username, used in conjunction with HTTP Authentication/SSO.
- checkValidCSRFToken() : bool
- Checks that the CSRF token header matches the CSRF token cookie that was originally sent.
- encryptSessionID() : string
- #2238 - Encrypt SessionID with private SALT before writing/reading SessionID in database.
- getClientID() : string
- getClientIDHeader() : bool|string
- Returns the value of the X-Client-ID HTTP header so we can determine what type of front-end we are using and if CSRF checks should be enabled or not.
- getCompanyObject() : bool|mixed
- getCreatedDate() : null
- getCurrentSessionID() : string|bool
- Gets the current session ID from the COOKIE, POST or GET variables.
- getEnableExpireSession() : mixed
- getEndPointID() : string
- getHTTPAuthenticationUsername() : bool
- getIdleTimeout() : int
- getIPAddress() : null
- getName() : bool|mixed
- getNameByTypeId() : bool|mixed
- getObject() : bool|null
- getObjectByID() : bool
- getObjectID() : null
- getRateLimitObject() : mixed|object|RateLimit
- getSecureSessionID() : mixed
- getSessionID() : string|null
- getType() : int
- getTypeIDByName() : bool|int
- getUpdatedDate() : null
- getUserAgent() : string
- HTTPAuthenticationHeader() : mixed
- isSessionIDAPIKey() : bool
- isUser() : bool
- Determine if the session type is for an actual user, so we know if we can create audit logs.
- Login() : bool
- loginHTTPAuthentication() : bool
- Allow web server to handle authentication with Basic Auth/LDAP/SSO/AD, etc.
- Logout() : bool
- logoutCompany() : bool
- When company status changes, logout all users for the company.
- logoutUser() : bool
- When user resets or changes their password, logout all sessions for that user.
- newSession() : null
- Duplicates existing session with a new SessionID. Useful for multiple logins with the same or different users.
- parseEndPointID() : mixed|string
- registerAPIKey() : bool|string
- Register permanent API key Session ID to be used for all subsequent API calls without needing a username/password.
- setClientID() : bool
- setCreatedDate() : bool
- setEnableExpireSession() : bool
- setEndPointID() : bool
- setIdleTimeout() : bool
- setIPAddress() : bool
- setObject() : bool
- setObjectID() : bool
- setSessionID() : bool
- setType() : bool
- setUpdatedDate() : bool
- setUserAgent() : bool
- Delete() : bool
- destroyCookie() : bool
- genSessionID() : string
- Read() : bool
- setCookie() : bool
- Update() : bool
- UpdateLastLoginDate() : bool
- Write() : bool
Properties
$cache
protected
Cache_Lite_Function|Cache_Lite_Output
$cache
$client_id
protected
mixed
$client_id
= \null
$created_date
protected
mixed
$created_date
= \null
$db
protected
mixed
$db
$end_point_id
protected
mixed
$end_point_id
= \null
$expire_session
protected
mixed
$expire_session
$flags
protected
mixed
$flags
= \null
$idle_timeout
protected
mixed
$idle_timeout
= \null
$ip_address
protected
mixed
$ip_address
= \null
$name
protected
mixed
$name
= 'SessionID'
$obj
protected
mixed
$obj
= \null
$object_id
protected
mixed
$object_id
= \null
$rl
protected
mixed
$rl
= \null
$session_id
protected
mixed
$session_id
= \null
$type_id
protected
mixed
$type_id
= 800
$updated_date
protected
mixed
$updated_date
= \null
$user_agent
protected
mixed
$user_agent
= \null
Methods
__construct()
Authentication constructor.
public
__construct() : mixed
Return values
mixed —changeObject()
public
changeObject(string $object_id) : bool
Parameters
- $object_id : string
-
UUID
Tags
Return values
bool —Check()
public
Check([string $session_id = null ][, string $type = null ][, bool $touch_updated_date = true ]) : bool
Parameters
- $session_id : string = null
-
UUID
- $type : string = null
- $touch_updated_date : bool = true
Tags
Return values
bool —checkApplicantPassword()
public
checkApplicantPassword( $user_name, $password) : bool
Parameters
Return values
bool —checkBarcode()
public
checkBarcode(string $object_id, $employee_number) : bool
Parameters
Return values
bool —checkClientPC()
public
checkClientPC( $user_name) : bool
Parameters
Return values
bool —checkCompanyStatus()
public
checkCompanyStatus( $user_name) : bool
Parameters
Return values
bool —checkFingerPrint()
public
checkFingerPrint(string $id) : bool
Parameters
- $id : string
-
UUID
Return values
bool —checkIButton()
public
checkIButton(string $id) : bool
Parameters
- $id : string
-
UUID
Return values
bool —checkPassword()
public
checkPassword( $user_name, $password) : bool
Parameters
Return values
bool —checkPhonePassword()
public
checkPhonePassword(int $phone_id, $password) : bool
Parameters
Return values
bool —checkUsername()
Checks just the username, used in conjunction with HTTP Authentication/SSO.
public
checkUsername( $user_name) : bool
Parameters
Return values
bool —checkValidCSRFToken()
Checks that the CSRF token header matches the CSRF token cookie that was originally sent.
public
checkValidCSRFToken() : bool
This uses the Cookie-To-Header method explained here: https://en.wikipedia.org/w/index.php?title=Cross-site_request_forgery#Cookie-to-header_token Also explained further here: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html -- "Double Submit Cookie" method.
Return values
bool —encryptSessionID()
#2238 - Encrypt SessionID with private SALT before writing/reading SessionID in database.
public
encryptSessionID(string $session_id) : string
This adds an additional protection layer against session stealing if a SQL injection attack is ever discovered. It prevents someone from being able to enumerate over the SessionIDs in the table and use them for nafarious purposes.
Parameters
- $session_id : string
-
UUID
Return values
string —getClientID()
public
getClientID() : string
Return values
string —getClientIDHeader()
Returns the value of the X-Client-ID HTTP header so we can determine what type of front-end we are using and if CSRF checks should be enabled or not.
public
getClientIDHeader() : bool|string
Return values
bool|string —getCompanyObject()
public
getCompanyObject( $user_name[, string $type = 'USER' ]) : bool|mixed
Parameters
Return values
bool|mixed —getCreatedDate()
public
getCreatedDate() : null
Return values
null —getCurrentSessionID()
Gets the current session ID from the COOKIE, POST or GET variables.
public
getCurrentSessionID(string $type) : string|bool
Parameters
- $type : string
Return values
string|bool —getEnableExpireSession()
public
getEnableExpireSession() : mixed
Return values
mixed —getEndPointID()
public
getEndPointID([mixed $end_point_id = null ]) : string
Parameters
- $end_point_id : mixed = null
Return values
string —getHTTPAuthenticationUsername()
public
getHTTPAuthenticationUsername() : bool
Return values
bool —getIdleTimeout()
public
getIdleTimeout() : int
Return values
int —getIPAddress()
public
getIPAddress() : null
Return values
null —getName()
public
getName([bool $type_id = false ]) : bool|mixed
Parameters
- $type_id : bool = false
Return values
bool|mixed —getNameByTypeId()
public
getNameByTypeId(int $type_id) : bool|mixed
Parameters
- $type_id : int
Return values
bool|mixed —getObject()
public
getObject() : bool|null
Return values
bool|null —getObjectByID()
public
getObjectByID(string $id) : bool
Parameters
- $id : string
-
UUID
Return values
bool —getObjectID()
public
getObjectID() : null
Return values
null —getRateLimitObject()
public
getRateLimitObject() : mixed|object|RateLimit
Tags
Return values
mixed|object|RateLimit —getSecureSessionID()
public
getSecureSessionID() : mixed
Return values
mixed —getSessionID()
public
getSessionID() : string|null
Return values
string|null —getType()
public
getType() : int
Return values
int —getTypeIDByName()
public
getTypeIDByName( $type) : bool|int
Parameters
Return values
bool|int —getUpdatedDate()
public
getUpdatedDate() : null
Return values
null —getUserAgent()
public
getUserAgent() : string
Return values
string —HTTPAuthenticationHeader()
public
HTTPAuthenticationHeader() : mixed
Return values
mixed —isSessionIDAPIKey()
public
isSessionIDAPIKey( $session_id) : bool
Parameters
Return values
bool —isUser()
Determine if the session type is for an actual user, so we know if we can create audit logs.
public
isUser([bool $type_id = false ]) : bool
Parameters
- $type_id : bool = false
Return values
bool —Login()
public
Login( $user_name, $password[, string $type = 'USER_NAME' ][, mixed $enable_cookie = true ]) : bool
Parameters
Tags
Return values
bool —loginHTTPAuthentication()
Allow web server to handle authentication with Basic Auth/LDAP/SSO/AD, etc.
public
loginHTTPAuthentication() : bool
..
Return values
bool —Logout()
public
Logout() : bool
Return values
bool —logoutCompany()
When company status changes, logout all users for the company.
public
logoutCompany(string $company_id[, mixed $client_id = null ]) : bool
Parameters
- $company_id : string
-
UUID
- $client_id : mixed = null
Tags
Return values
bool —logoutUser()
When user resets or changes their password, logout all sessions for that user.
public
logoutUser(string $object_id[, string $type_id = 'USER_NAME' ][, bool $ignore_current_session = true ]) : bool
Parameters
- $object_id : string
-
UUID
- $type_id : string = 'USER_NAME'
- $ignore_current_session : bool = true
-
Avoid logging out existing session, for example when the user is changing their own password.
Tags
Return values
bool —newSession()
Duplicates existing session with a new SessionID. Useful for multiple logins with the same or different users.
public
newSession([string $object_id = null ][, string $ip_address = null ][, string $user_agent = null ][, string $client_id = null ][, string $end_point_id = null ][, null $type_id = null ]) : null
Parameters
- $object_id : string = null
-
UUID
- $ip_address : string = null
- $user_agent : string = null
- $client_id : string = null
-
UUID
- $end_point_id : string = null
- $type_id : null = null
Tags
Return values
null —parseEndPointID()
public
parseEndPointID([null $end_point_id = null ]) : mixed|string
Parameters
- $end_point_id : null = null
Return values
mixed|string —registerAPIKey()
Register permanent API key Session ID to be used for all subsequent API calls without needing a username/password.
public
registerAPIKey(string $user_name, string $password[, mixed $end_point = null ]) : bool|string
Parameters
- $user_name : string
- $password : string
- $end_point : mixed = null
Tags
Return values
bool|string —setClientID()
public
setClientID( $value) : bool
Parameters
Return values
bool —setCreatedDate()
public
setCreatedDate([int $epoch = null ]) : bool
Parameters
- $epoch : int = null
-
EPOCH
Return values
bool —setEnableExpireSession()
public
setEnableExpireSession( $bool) : bool
Parameters
Return values
bool —setEndPointID()
public
setEndPointID( $value) : bool
Parameters
Return values
bool —setIdleTimeout()
public
setIdleTimeout( $secs) : bool
Parameters
Return values
bool —setIPAddress()
public
setIPAddress([null $ip_address = null ]) : bool
Parameters
- $ip_address : null = null
Return values
bool —setObject()
public
setObject( $object) : bool
Parameters
Return values
bool —setObjectID()
public
setObjectID(string $id) : bool
Parameters
- $id : string
-
UUID
Return values
bool —setSessionID()
public
setSessionID(string $session_id) : bool
Parameters
- $session_id : string
-
UUID
Return values
bool —setType()
public
setType(int $type_id) : bool
Parameters
- $type_id : int
Return values
bool —setUpdatedDate()
public
setUpdatedDate([int $epoch = null ]) : bool
Parameters
- $epoch : int = null
-
EPOCH
Return values
bool —setUserAgent()
public
setUserAgent( $value[, bool $hash = false ]) : bool
Parameters
Return values
bool —Delete()
private
Delete() : bool
Tags
Return values
bool —destroyCookie()
private
destroyCookie() : bool
Return values
bool —genSessionID()
private
genSessionID() : string
Return values
string —Read()
private
Read() : bool
Return values
bool —setCookie()
private
setCookie([bool $type_id = false ]) : bool
Parameters
- $type_id : bool = false
Return values
bool —Update()
private
Update() : bool
Return values
bool —UpdateLastLoginDate()
private
UpdateLastLoginDate() : bool
Tags
Return values
bool —Write()
private
Write() : bool