I'm implementing SSO into my Concrete5 (5.7) application with SimpleSAMLphp and I'm at the stage where I'm trying to authenticate a C5 user using the attributes received from the IDP.
The issue is that when I try to programmatically login a user after '$as->requireAuth()', the login appears successful but clicking anything in the menu bar shows access denied, and when going to a different page, the user is no longer logged in.
Here is the code for my controller:
public function authenticate()
{
require_once(_DIR_.'/../simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple('example-okta-com');
$as->requireAuth();
if ($as->isAuthenticated ()) {
$attributes = $as->getAttributes();
$email = $attributes['email'][0];
$userEmail = UserInfo::getByEmail($email);
$user = User::loginByUserID($userEmail->getUserID());
return $user;
}
}
If I run the login code before the '$as->requireAuth();', it logs in fine. I think the issue has something to do with the sessions but I can't seem to figure it out.
Here are a few of my settings in my config.php:
'session.phpsession.cookiename' => 'PHPSESSID',
'session.phpsession.savepath' => '/',
'session.phpsession.httponly' => true,
I've tried adding this block of code from the SimpleSAML documentation:
$session = SimpleSAML_Session::getSessionFromRequest();
$session->cleanup();
Any advice would be greatly appreciated!
