modules/Users/authentication/SAMLAuthenticate/SAMLAuthenticateUser.php
Package: This file is where the user authentication occurs. No redirection should happen in this file.
- Parent(s)
- \SugarAuthenticateUser
Methods
authenticateUser(
STRING $name, STRING $password
)
:
STRING
Does the actual authentication of the user and returns an id that will be used
to load the current user (loadUserOnSession)
Parameters
Name |
Type |
Description |
$name |
STRING |
|
$password |
STRING |
|
Returns
Type |
Description |
STRING |
id - used for loading the user Contributions by Erik Mitchell erikm@logicpd.com |
createUser(
STRING $name, \DOMXpath $xpath, \SamlSettings $settings
)
:
STRING
Creates a user with the given User Name and returns the id of that new user
populates the user with what was set in the SAML Response
Parameters
Name |
Type |
Description |
$name |
STRING |
|
$xpath |
\DOMXpath |
|
$settings |
\SamlSettings |
|
Returns
Type |
Description |
STRING |
$id |
fetch_user(
mixed $id, string $field
=
null
)
:
\User
Fetches user by provided ID and field name
Parameters
Name |
Type |
Description |
$id |
mixed |
|
$field |
string |
|
Returns
getAdditionalFieldsToSelect(
\SamlResponse $samlresponse, \SamlSettings $settings
)
:
String
Determines if there are custom fields to add to our select statement, and
returns a comma prepended, comma-delimited list of those custom fields.
Parameters
Name |
Type |
Description |
$samlresponse |
\SamlResponse |
|
$settings |
\SamlSettings |
|
Returns
Type |
Description |
String |
$additionalFields = either empty, or ", field1[, field2, fieldn]" Contributed by Mike Andersen, SugarCRM. |
getCustomFields(
\SamlSettings $settings, String $which
)
:
Array
Returns an array of custom field names. These names are the keys in the
'update' hash in $settings->saml_settings hash.
See modules/Users/authentication/SAMLAuthenticate/settings.php for details.
Parameters
Name |
Type |
Description |
$settings |
\SamlSettings |
|
$which |
String |
- which custom fields: 'check', 'create' or 'update'
|
Returns
Type |
Description |
Array |
- list of custom field names. Contributed by Mike Andersen, SugarCRM. |
get_user_id(
\SamlResponse $samlresponse, \SamlSettings $settings
)
:
string
Retrieves user ID from SamlResponse according to SamlSettings
Parameters
Name |
Type |
Description |
$samlresponse |
\SamlResponse |
|
$settings |
\SamlSettings |
|
Returns
loadUserOnLogin(
string $name, string $password, boolean $fallback
=
false, array $PARAMS
=
array()
)
:
boolean
This is called when a user logs in
Parameters
Name |
Type |
Description |
$name |
string |
|
$password |
string |
|
$fallback |
boolean |
- is this authentication a fallback from a failed authentication
|
$PARAMS |
array |
|
Returns
updateCustomFields(
\User $user, \SamlResponse $samlresponse, \SamlSettings $settings
)
:
int
Updates the custom fields listed in settings->saml_settings['update'] in our
db records with the data from the xml in the saml assertion. Every field
listed in the ['update'] array is a key whose value is a (hopefully) valid
xpath, which in turn can be used to retrive the value of the node specified
by that xpath. If the value of the node does not equal the value in our
records, update our records to match the value from the xml.
Parameters
Name |
Type |
Description |
$user |
\User |
- user fetched from our db.
|
$samlresponse |
\SamlResponse |
|
$settings |
\SamlSettings |
|
Returns
Type |
Description |
int |
- 0 = no action taken, 1 = user record saved, -1 = no update. Contributed by Mike Andersen, SugarCRM. |