Skip to content
Snippets Groups Projects
Commit 9f009d41 authored by Andrew Hoffmann's avatar Andrew Hoffmann
Browse files

Merge branch 'rename-mapAttribute' into 'master'

Rename mapAttribute method to httpHeaderFromAttribute to better describe what it does

Minor documentation improvements also included in this commit

@weizhong-wang @andrew-summers

See merge request !11
parents 8a65d16f 568c8446
No related branches found
No related tags found
1 merge request!11Rename mapAttribute method to httpHeaderFromAttribute to better describe what it does
......@@ -20,12 +20,13 @@ abstract class UserDetailsProvider
const SOURCE = "source";
const ISIS_EMPLID = "isisEmplid";
// Delimiter used by multi-valued headers
/** Delimiter used by multi-valued headers */
const DELIMITER = ';';
/**
* UserDetailsProvider constructor.
* @param $http
*
* @param bool $http true if Shibboleth attributes are delivered via HTTP request headers
*/
public function __construct($http = false)
{
......@@ -45,10 +46,11 @@ abstract class UserDetailsProvider
*
* @param string $attribute attribute to map
* @return string Shibboleth attribute name mapped to its equivalent HTTP header name
*
* @see https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAttributeAccess NativeSPAttributeAccess
*/
protected function mapAttribute($attribute)
protected function httpHeaderFromAttribute($attribute)
{
return 'HTTP_' . strtoupper($attribute);
}
}
......@@ -34,15 +34,15 @@ class FederatedPreauthUserDetailsProvider extends UserDetailsProvider
if ($this->httpHeaders) {
$userDetails = new UWUserDetails(
getenv($this->mapAttribute(static::EPPN)),
getenv($this->mapAttribute(static::SPVI)),
getenv($this->mapAttribute(static::FULL_NAME)),
explode(static::DELIMITER, getenv($this->mapAttribute(static::UDDS))),
getenv($this->mapAttribute(static::EMAIL)),
getenv($this->mapAttribute(static::SOURCE)),
getenv($this->mapAttribute(static::ISIS_EMPLID)),
getenv($this->mapAttribute(static::FIRST_NAME)),
getenv($this->mapAttribute(static::LAST_NAME))
getenv($this->httpHeaderFromAttribute(static::EPPN)),
getenv($this->httpHeaderFromAttribute(static::SPVI)),
getenv($this->httpHeaderFromAttribute(static::FULL_NAME)),
explode(static::DELIMITER, getenv($this->httpHeaderFromAttribute(static::UDDS))),
getenv($this->httpHeaderFromAttribute(static::EMAIL)),
getenv($this->httpHeaderFromAttribute(static::SOURCE)),
getenv($this->httpHeaderFromAttribute(static::ISIS_EMPLID)),
getenv($this->httpHeaderFromAttribute(static::FIRST_NAME)),
getenv($this->httpHeaderFromAttribute(static::LAST_NAME))
);
} else {
$userDetails = new UWUserDetails(
......
......@@ -36,15 +36,15 @@ class PreauthUserDetailsProvider extends UserDetailsProvider
if ($this->httpHeaders) {
$userDetails = new UWUserDetails(
getenv($this->mapAttribute(static::EPPN)),
getenv($this->mapAttribute(static::PVI)),
getenv($this->mapAttribute(static::FULL_NAME)),
explode(static::DELIMITER, getenv($this->mapAttribute(static::UDDS))),
getenv($this->mapAttribute(static::EMAIL)),
getenv($this->mapAttribute(static::SOURCE)),
getenv($this->mapAttribute(static::ISIS_EMPLID)),
getenv($this->mapAttribute(static::FIRST_NAME)),
getenv($this->mapAttribute(static::LAST_NAME))
getenv($this->httpHeaderFromAttribute(static::EPPN)),
getenv($this->httpHeaderFromAttribute(static::PVI)),
getenv($this->httpHeaderFromAttribute(static::FULL_NAME)),
explode(static::DELIMITER, getenv($this->httpHeaderFromAttribute(static::UDDS))),
getenv($this->httpHeaderFromAttribute(static::EMAIL)),
getenv($this->httpHeaderFromAttribute(static::SOURCE)),
getenv($this->httpHeaderFromAttribute(static::ISIS_EMPLID)),
getenv($this->httpHeaderFromAttribute(static::FIRST_NAME)),
getenv($this->httpHeaderFromAttribute(static::LAST_NAME))
);
} else {
$userDetails = new UWUserDetails(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment