Posts

Showing posts with the label simplesamlphp

Accept both username and email address as login identity in simplesamlphp

By default, simplesamlphp only allow you to login by username. But, you hack the source code to make simplesamlphp accept both username and email address as login identity. The solution is pretty simple: + just take the input username and check if -- it is an email than split the string, get only the username part -- it is not an email, than use the input string # nano /path/to/simplesamlphp/modules/core/www/loginuserpass.php ... function get_username($un) {         if (strpos($un,'@') !== false) {                 $un = strstr($un, '@', true);         }         return $un; } if (array_key_exists('username', $_REQUEST)) {         $username = get_username($_REQUEST['username']); } elseif ($source->getRememberUsernameEnabled() && array_key_exists($source->getAuthId() . '-username', $_COOKIE)) {         $usernam...

Using SimpleSAMLphp to authenticate users in Google Apps with Active Directory

To let my users login to Google Apps using Active Directory accounts, I can use SimpleSAMLphp as an IdP which gets identities from my Active Directory servers. Things are pretty easy with simplesamlphp, of-course: 1.  SimpleSAMLphp configurations: simplesamlphp/config/authsources.php : simplesamlphp/config/config.php : simplesamlphp/www/logout_relay.php : (because Google does not allow log out URLs that have question mark and parameters) 2. Google App settings: >> Go to https://admin.google.com and login as my Google App administrator account. >> Security -> Advanced Settings -> Setup Single Sign-on (SSO) : + Check "Enable Single Sign-on" + Sign-in page URL * https://mydomain.com/simplesaml/saml2/idp/SSOService.php + Sign-out page URL * https://mydomain.com/simplesaml/logout_relay.php + Change password URL * https://mydomain.com/ >> Click " Save changes " 3. NGINX server block for simplesamlphp: ...