-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config for identity_providers in local_info.xml #524
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -179,6 +179,37 @@ | |||||||||||||
--> | ||||||||||||||
<restrict_personal_data>false</restrict_personal_data> | ||||||||||||||
|
||||||||||||||
<!-- identity_providers | ||||||||||||||
Shib/CheckIn Token reads config file | ||||||||||||||
for needed AAI entitlements. | ||||||||||||||
This is to allow Admins so that they will be empowered | ||||||||||||||
to make quicker changes to AAI references. | ||||||||||||||
--> | ||||||||||||||
<identity_providers> | ||||||||||||||
<provider> | ||||||||||||||
<idp>aai.egi.eu/auth/realms/egi</idp> | ||||||||||||||
<name>EGI Proxy</name> | ||||||||||||||
<authentication_realms> | ||||||||||||||
<shib_realm_name>EGI Proxy IdP</shib_realm_name> | ||||||||||||||
</authentication_realms> | ||||||||||||||
<required_groups> | ||||||||||||||
<group>urn:mace:egi.eu:res:gocdb#aai.egi.eu</group> | ||||||||||||||
</required_groups> | ||||||||||||||
<help_url>https://docs.egi.eu/internal/configuration-database/access/#using-institutional-account-via-egi-check-in</help_url> | ||||||||||||||
</provider> | ||||||||||||||
<provider> | ||||||||||||||
<idp>aai-demo.egi.eu/auth/realms/egi</idp> | ||||||||||||||
<name>EGI Demo Proxy</name> | ||||||||||||||
<authentication_realms> | ||||||||||||||
<shib_realm_name>EGI Proxy IdP</shib_realm_name> | ||||||||||||||
</authentication_realms> | ||||||||||||||
Comment on lines
+203
to
+205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As with https://github.com/GOCDB/gocdb/pull/524/files#r1842006878
Suggested change
|
||||||||||||||
<required_groups> | ||||||||||||||
<group>urn:mace:egi.eu:res:gocdb#aai.egi.eu</group> | ||||||||||||||
</required_groups> | ||||||||||||||
<help_url>https://docs.egi.eu/internal/configuration-database/access/#using-institutional-account-via-egi-check-in</help_url> | ||||||||||||||
</provider> | ||||||||||||||
</identity_providers> | ||||||||||||||
|
||||||||||||||
</local_info> | ||||||||||||||
|
||||||||||||||
<!-- | ||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -85,6 +85,7 @@ private function getAttributesInitToken(){ | |||||
// specify location of the Shib Logout handler | ||||||
\Factory::$properties['LOGOUTURL'] = 'https://'.$hostname.'/Shibboleth.sso/Logout'; | ||||||
$idp = isset($_SERVER['Shib-Identity-Provider']) ? $_SERVER['Shib-Identity-Provider'] : ''; | ||||||
|
||||||
if ($idp == 'https://unity.eudat-aai.fz-juelich.de:8443/saml-idp/metadata' | ||||||
&& $_SERVER['distinguishedName'] != null){ | ||||||
$this->principal = $_SERVER['distinguishedName']; | ||||||
|
@@ -96,73 +97,67 @@ private function getAttributesInitToken(){ | |||||
$this->userDetails = array('AuthenticationRealm' => array('UK_ACCESS_FED')); | ||||||
return; | ||||||
} | ||||||
else if($idp == 'https://aai.egi.eu/auth/realms/egi'){ | ||||||
// assurance is the old way EGI checkIn used to pass LoA attributes | ||||||
/*if( empty($_SERVER['voPersonID'])){// || empty($_SERVER['displayName']) ){ | ||||||
die('Did not recieve required attributes from the EGI Proxy Identity Provider to complete authentication, please contact gocdb-admins'); | ||||||
} | ||||||
if(empty($_SERVER['assurance'])){ | ||||||
die('Did not receive the required assurance attribute from the EGI Proxy IdP, please contact gocdb-admins'); | ||||||
} | ||||||
if($_SERVER['assurance'] != 'https://aai.egi.eu/LoA#Substantial'){ | ||||||
$HTML = '<ul><li>You authenticated to the EGI Identity Provider using a method that provides an inadequate Level of Assurance for GOCDB (weak user verification).</li><li>Login is required with an assurance level of [Substantial].</li><li>To gain access, you will need to login to the Proxy IdP using a scheme that provides [LoA#Substantial].</li><li>Please logout or restart your browser and attempt to login again.</li></ul>'; | ||||||
$HTML .= "<div style='text-align: center;'>"; | ||||||
$HTML .= '<a href="'.htmlspecialchars(\Factory::$properties['LOGOUTURL']).'"><b><font colour="red">Logout</font></b></a>'; | ||||||
$HTML .= "</div>"; | ||||||
echo ($HTML); | ||||||
die(); | ||||||
} | ||||||
$this->principal = $_SERVER['voPersonID']; | ||||||
$this->userDetails = array('AuthenticationRealm' => array('EGI Proxy IdP')); | ||||||
return; | ||||||
*/ | ||||||
|
||||||
if( empty($_SERVER['voPersonID'])){// || empty($_SERVER['displayName']) ){ | ||||||
die('Did not recieve required attributes from the EGI Proxy Identity Provider to complete authentication, please contact gocdb-admins'); | ||||||
} | ||||||
if(empty($_SERVER['entitlement'])){ | ||||||
//die('Did not recieve the required entitlement attribute from the EGI Proxy IdP, please contact gocdb-admins'); | ||||||
$HTML = '<ul><li>Login requires a GOCDB entitlement value <a href="https://wiki.egi.eu/wiki/URN_Registry:aai.egi.eu:gocdb" target="_blank">https://wiki.egi.eu/wiki/URN_Registry:aai.egi.eu:gocdb</a></li><li>Please, logout or restart your browser and attempt to login again using an identity provider that provides a GOCDB entitlement</li></ul>'; | ||||||
$HTML .= "<div style='text-align: center;'>"; | ||||||
$HTML .= '<a href="'.htmlspecialchars(\Factory::$properties['LOGOUTURL']).'"><b><font colour="red">Logout</font></b></a>'; | ||||||
$HTML .= "</div>"; | ||||||
echo ($HTML); | ||||||
die(); | ||||||
} | ||||||
|
||||||
$entitlementValuesArray = explode(';', $_SERVER['entitlement']); | ||||||
if( !in_array('urn:mace:egi.eu:res:gocdb#aai.egi.eu', $entitlementValuesArray) ){ | ||||||
$HTML = '<ul><li>Login requires a GOCDB entitlement <a href="https://wiki.egi.eu/wiki/URN_Registry:aai.egi.eu:gocdb" target="_blank">https://wiki.egi.eu/wiki/URN_Registry:aai.egi.eu:gocdb</a></li><li>Please, logout or restart your browser and attempt to login again using an identity provider that provides a GOCDB entitlement</li></ul>'; | ||||||
$HTML .= "<div style='text-align: center;'>"; | ||||||
$HTML .= '<a href="'.htmlspecialchars(\Factory::$properties['LOGOUTURL']).'"><b><font colour="red">Logout</font></b></a>'; | ||||||
$HTML .= "</div>"; | ||||||
echo ($HTML); | ||||||
die(); | ||||||
$configService = \Factory::getConfigService(); | ||||||
$identityProviders = $configService->getIdentityProvidersInfo(); | ||||||
|
||||||
foreach ($identityProviders as $provider) { | ||||||
if ($provider['idp'] === $idp) { | ||||||
$name = $provider['name']; | ||||||
$helpUrl = $provider['help_url']; | ||||||
|
||||||
if (empty($_SERVER['voPersonID'])) { | ||||||
die( | ||||||
"Did not receive required attributes from the " | ||||||
. "IDP $name to complete authentication. " | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will read better
Suggested change
|
||||||
. "Please contact gocdb-admins." | ||||||
); | ||||||
} | ||||||
|
||||||
if (empty($_SERVER['entitlement'])) { | ||||||
die( | ||||||
"Did not receive the required entitlement " | ||||||
. "attribute from the IDP $name. " | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will read better
Suggested change
|
||||||
. "Please contact gocdb-admins." | ||||||
); | ||||||
} | ||||||
|
||||||
if (!empty($provider['required_groups'])) { | ||||||
$entitlementValues = explode(';', $_SERVER['entitlement']); | ||||||
|
||||||
if ( | ||||||
!array_intersect( | ||||||
$entitlementValues, | ||||||
$provider['required_groups'] | ||||||
) | ||||||
) { | ||||||
$HTML = "<ul>" | ||||||
. "<li>Login requires a GOCDB entitlement value " | ||||||
. "which was not provided for the IDP $name.</li>" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will read better
Suggested change
|
||||||
. "<li>Please see here for more information: " | ||||||
. "<a href='$helpUrl' target='_blank'>" | ||||||
. "$helpUrl</a>.</li>" | ||||||
. "<li>Logout or restart your browser" | ||||||
. "and attempt to login again using an IDP " | ||||||
. "that provides a GOCDB entitlement.</li>" | ||||||
. "</ul>"; | ||||||
$HTML .= "<div style='text-align: center;'>"; | ||||||
$HTML .= "<a href=\"" | ||||||
. htmlspecialchars(\Factory::$properties['LOGOUTURL']) | ||||||
. "\"><b><font color=\"red\">Logout</font></b></a>"; | ||||||
$HTML .= "</div>"; | ||||||
echo ($HTML); | ||||||
die(); | ||||||
} | ||||||
} | ||||||
|
||||||
$this->principal = $_SERVER['voPersonID']; | ||||||
$this->userDetails = [ | ||||||
'AuthenticationRealm' => $provider['authenticationRealms'] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given https://github.com/GOCDB/gocdb/pull/524/files#r1842006878, this will need a slight tweak |
||||||
]; | ||||||
|
||||||
return; | ||||||
} | ||||||
$this->principal = $_SERVER['voPersonID']; | ||||||
$this->userDetails = array('AuthenticationRealm' => array('EGI Proxy IdP')); | ||||||
return; | ||||||
|
||||||
} | ||||||
else if($idp == 'https://aai-demo.egi.eu/auth/realms/egi'){ | ||||||
if( empty($_SERVER['voPersonID'])){ | ||||||
die('Did not receive required voPersonID attributes from the EGI Demo Proxy Identity Provider to complete authentication, please contact gocdb-admins'); | ||||||
} | ||||||
if(empty($_SERVER['entitlement'])){ | ||||||
die('Did not receive the required entitlement attribute from the EGI Demo Proxy IdP, please contact gocdb-admins'); | ||||||
} | ||||||
$entitlementValuesArray = explode(';', $_SERVER['entitlement']); | ||||||
if( !in_array('urn:mace:egi.eu:res:gocdb#aai.egi.eu', $entitlementValuesArray) ){ | ||||||
$HTML = '<ul><li>You authenticated to the EGI Demo Identity Provider using a method that does not provide a GOCDB entitlement.</li><li>Login is required with a gocdb entitlement.</li><li>To gain access, you will need to login to the Proxy IdP using a scheme that provides a gocdb entitlement.</li><li>Please logout or restart your browser and attempt to login again.</li></ul>'; | ||||||
$HTML .= "<div style='text-align: center;'>"; | ||||||
$HTML .= '<a href="'.htmlspecialchars(\Factory::$properties['LOGOUTURL']).'"><b><font colour="red">Logout</font></b></a>'; | ||||||
$HTML .= "</div>"; | ||||||
echo ($HTML); | ||||||
die(); | ||||||
} | ||||||
$this->principal = $_SERVER['voPersonID']; | ||||||
$this->userDetails = array('AuthenticationRealm' => array('EGI Proxy IdP')); | ||||||
return; | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -203,5 +198,4 @@ public static function isPreAuthenticating() { | |||||
public static function isStateless() { | ||||||
return true; | ||||||
} | ||||||
|
||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -567,4 +567,59 @@ public function getEmailTo() | |||||||||||||||||||
|
||||||||||||||||||||
return $emailTo; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
public function getIdentityProvidersInfo(): array | ||||||||||||||||||||
{ | ||||||||||||||||||||
$localInfo = $this->GetLocalInfoXML(); | ||||||||||||||||||||
$identityProviders = []; | ||||||||||||||||||||
|
||||||||||||||||||||
if (!empty($localInfo->identity_providers->provider)) { | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens here if |
||||||||||||||||||||
foreach ( | ||||||||||||||||||||
$localInfo | ||||||||||||||||||||
->identity_providers | ||||||||||||||||||||
->provider as $providerDetails | ||||||||||||||||||||
) { | ||||||||||||||||||||
Comment on lines
+576
to
+581
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something like this I think would read better
Suggested change
|
||||||||||||||||||||
/** idp */ | ||||||||||||||||||||
$idp = (string) $providerDetails->idp; | ||||||||||||||||||||
|
||||||||||||||||||||
/** name */ | ||||||||||||||||||||
$name = (string) $providerDetails->name; | ||||||||||||||||||||
|
||||||||||||||||||||
/** authentication_realms */ | ||||||||||||||||||||
$authenticationRealms = []; | ||||||||||||||||||||
if ($providerDetails->authentication_realms) { | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given https://github.com/GOCDB/gocdb/pull/524/files#r1842006878, this will need a slight tweak |
||||||||||||||||||||
foreach ( | ||||||||||||||||||||
$providerDetails | ||||||||||||||||||||
->authentication_realms | ||||||||||||||||||||
->shib_realm_name as $shibRealmName | ||||||||||||||||||||
) { | ||||||||||||||||||||
$authenticationRealms[] = (string) $shibRealmName; | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
/** required_groups */ | ||||||||||||||||||||
$requiredGroups = []; | ||||||||||||||||||||
if ($providerDetails->required_groups) { | ||||||||||||||||||||
foreach ( | ||||||||||||||||||||
$providerDetails->required_groups->group as $group | ||||||||||||||||||||
) { | ||||||||||||||||||||
$requiredGroups[] = (string) $group; | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
/** help_url */ | ||||||||||||||||||||
$helpURL = (string) $providerDetails->help_url; | ||||||||||||||||||||
|
||||||||||||||||||||
$identityProviders[] = [ | ||||||||||||||||||||
'idp' => $idp, | ||||||||||||||||||||
'name' => $name, | ||||||||||||||||||||
'authenticationRealms' => $authenticationRealms, | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given https://github.com/GOCDB/gocdb/pull/524/files#r1842006878
Suggested change
|
||||||||||||||||||||
'requiredGroups' => $requiredGroups, | ||||||||||||||||||||
'helpURL', $helpURL | ||||||||||||||||||||
]; | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
return $identityProviders; | ||||||||||||||||||||
} | ||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be
authentication_realm