Class Identity
This is the main class of the Genetsis ID library.
It's the class that wraps the whole set of classes of the library and
that you'll have to use the most. With it, you'll be able to check if a
user is logged, log them out, obtain the personal data of any user,
and check if a user has enough data to take part in a promotion, upload
content or carry out an action that requires a specific set of personal
data.
Sample usage:
Identity::init();
Methods summary
public static
|
#
initConfig( string $gid_client = 'default' )
When you initialize the library with this method, only the configuration defined in "oauthconf.xml" file of the gid_client is loaded
You must synchronize data with server if you need access to client or access token. This method is used for example, in ckactions.php actions.
When you initialize the library with this method, only the configuration defined in "oauthconf.xml" file of the gid_client is loaded
You must synchronize data with server if you need access to client or access token. This method is used for example, in ckactions.php actions.
Parameters
Throws
Exception
|
public static
|
#
init( string $gid_client = 'default', boolean $sync = true, string $ini_path = null )
When you initialize the library, the configuration defined in "oauthconf.xml" file of the gid_client is loaded
and by default this method auto-sync data (client_token, access_token,...) with server
When you initialize the library, the configuration defined in "oauthconf.xml" file of the gid_client is loaded
and by default this method auto-sync data (client_token, access_token,...) with server
Parameters
- $gid_client
- GID Client to load
- $sync
- Indicates if automatic data synchronization with the server is enabled
- $ini_path
- path of the configuration of the library (gid.ini file) if no argument passed, the default path and file will be /config/gid.ini
Throws
Exception
|
public static
|
#
synchronizeSessionWithServer( )
This method verifies the authorization tokens (client_token,
access_token and refresh_token). Also updates the web client status,
storing the client_token, access_token and refresh tokend and
login_status in Things Genetsis\core\Things .
This method verifies the authorization tokens (client_token,
access_token and refresh_token). Also updates the web client status,
storing the client_token, access_token and refresh tokend and
login_status in Things Genetsis\core\Things .
Is INVOKE ON EACH REQUEST in order to check and update
the status of the user (not logged, logged or connected), and
verify that every token that you are gonna use before is going to be
valid.
|
public static
boolean
|
#
isConnected( )
Helper to check if the user is connected (logged on Genetsis ID)
Helper to check if the user is connected (logged on Genetsis ID)
Returns
boolean TRUE if is logged, FALSE otherwise.
|
public static
Genetsis\core\Things
|
#
getThings( )
Helper to access library data
Helper to access library data
Returns
|
public static
|
#
authorizeUser( string $code )
In that case, the url of "post-login" will retrieve an authorization
code as a GET parameter.
In that case, the url of "post-login" will retrieve an authorization
code as a GET parameter.
Once the authorization code is provided to the web client, the SDK
will send it again to Genetsis ID at "token_endpoint" to obtain the
"access_token" of the user and create the cookie.
This method is needed to authorize user when the web client takes
back the control of the browser.
Parameters
- $code
- Authorization code returned by Genetsis ID.
Throws
/Exception
|
public static
boolean
|
#
checkUserComplete( $scope )
Checks if the user have been completed all required fields for that
section.
Checks if the user have been completed all required fields for that
section.
The "scope" (section) is a group of fields configured in Genetsis ID for
a web client.
A section can be also defined as a "part" (section) of the website
(web client) that only can be accesed by a user who have filled a
set of personal information configured in Genetsis ID (all of the fields
required for that section).
This method is commonly used for promotions or sweepstakes: if a
user wants to participate in a promotion, the web client must
ensure that the user have all the fields filled in order to let him
participate.
Parameters
- $scope
Section-key identifier of the web client. The
section-key is located in "oauthconf.xml" file.
Returns
boolean TRUE if the user have already completed all the
fields needed for that section, false in otherwise
Throws
Exception
|
public static
|
#
logoutUser( )
Performs the logout process.
Performs the logout process.
It makes:
- The logout call to Genetsis ID
- Clear cookies
- Purge Tokens and local data for the logged user
Throws
Exception
|
public static
Logger
|
#
getLogger( )
Helper to access an static instance of Logger
Helper to access an static instance of Logger
Returns
|