modules/Users/authentication/SAMLAuthenticate/SAMLAuthenticateUser.php

Show: inherited
Table of Contents

\SAMLAuthenticateUser

Package:

This file is where the user authentication occurs. No redirection should happen in this file.

Parent(s)
\SugarAuthenticateUser

Methods

methodpublicauthenticateUser( 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
methodpubliccreateUser( 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
  • our settings object.
Returns
Type Description
STRING $id
methodprotectedfetch_user( mixed $id, string $field = null ) : \User

Fetches user by provided ID and field name

Parameters
Name Type Description
$id mixed
$field string
Returns
Type Description
\User
methodpublicgetAdditionalFieldsToSelect( \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.
methodpublicgetCustomFields( \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.
methodprotectedget_user_id( \SamlResponse $samlresponse, \SamlSettings $settings ) : string

Retrieves user ID from SamlResponse according to SamlSettings

Parameters
Name Type Description
$samlresponse \SamlResponse
$settings \SamlSettings
Returns
Type Description
string
methodpublicisSugarLogin( STRING $name, \STRIUNG $password ) : boolean
inherited

Checks if a user is a sugarLogin user which implies they should use the sugar authentication to login

Inherited from: \SugarAuthenticateUser::isSugarLogin()
Parameters
Name Type Description
$name STRING
$password \STRIUNG
Returns
Type Description
boolean
methodpublicloadUserOnLogin( 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
Type Description
boolean
methodpublicloadUserOnSession( STRING $user_id = '' ) : boolean
inherited

Loads the current user bassed on the given user_id

Inherited from: \SugarAuthenticateUser::loadUserOnSession()
Parameters
Name Type Description
$user_id STRING
Returns
Type Description
boolean
methodpublicupdateCustomFields( \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
  • saml provider response.
$settings \SamlSettings
  • our settings object.
Returns
Type Description
int - 0 = no action taken, 1 = user record saved, -1 = no update. Contributed by Mike Andersen, SugarCRM.
Documentation was generated by DocBlox 0.18.1.