getAttributeHash() public static method

Create a hash value for the attributes that changes when attributes are added or removed. If the attribute values are included in the hash, the hash will change if the values change.
public static getAttributeHash ( string $attributes, boolean $includeValues = false ) : string
$attributes string The attributes.
$includeValues boolean Whether or not to include the attribute value in the generation of the hash.
return string SHA1 of the user id, source id, destination id and salt.
コード例 #1
0
ファイル: consentAdmin.php プロジェクト: filonuse/fedlab
function driveProcessingChain($idp_metadata, $source, $sp_metadata, $sp_entityid, $attributes, $userid, $hashAttributes = FALSE)
{
    /* 
     * Create a new processing chain 
     */
    $pc = new SimpleSAML_Auth_ProcessingChain($idp_metadata, $sp_metadata, 'idp');
    /* 
     * Construct the state.
     * REMEMBER: Do not set Return URL if you are calling processStatePassive
     */
    $authProcState = array('Attributes' => $attributes, 'Destination' => $sp_metadata, 'Source' => $idp_metadata, 'isPassive' => TRUE);
    /* 
     * Call processStatePAssive.
     * We are not interested in any user interaction, only modifications to the attributes
     */
    $pc->processStatePassive($authProcState);
    $attributes = $authProcState['Attributes'];
    /*
     * Generate identifiers and hashes
     */
    $destination = $sp_metadata['metadata-set'] . '|' . $sp_entityid;
    $targeted_id = sspmod_consent_Auth_Process_Consent::getTargetedID($userid, $source, $destination);
    $attribute_hash = sspmod_consent_Auth_Process_Consent::getAttributeHash($attributes, $hashAttributes);
    SimpleSAML_Logger::info('consentAdmin: user: '******'consentAdmin: target: ' . $targeted_id);
    SimpleSAML_Logger::info('consentAdmin: attribute: ' . $attribute_hash);
    /* Return values */
    return array($targeted_id, $attribute_hash, $attributes);
}