Closed ugurerkan closed 7 years ago
I would recommend asking on StackOverflow instead.
You are right, on a second thought this question don't belong here. 😳 By the way, I found a pretty simple way to do SAML Auth with One Login's PHP SAML toolkit 🤗
Here is 2 controller for redirect user login page and return page. On ACS controller you can identify user. Before using these you need to configure OneLogin toolkit on Silex prod/dev config file.
More information and how to's can be found on toolkit's index page.
$app->get('/saml/login',function() use ($app){
$auth = new OneLogin_Saml2_Auth($app['saml.sso']);
$ssoBuiltUrl = $auth->login(null, array(), false, false, true);
$app['session']->set('AuthNRequestID',$auth->getLastRequestID());
return $app->redirect($ssoBuiltUrl);
});
// SAML assertion consumer service endpoint
$app->post('/saml/acs',function() use ($app){
$requestID = $app['session']->get('AuthNRequestID');
$auth = new OneLogin_Saml2_Auth($app['saml.sso']);
$auth->processResponse($requestID);
if (!$auth->isAuthenticated()) {
return $app->abort(Response::HTTP_UNAUTHORIZED,"SSO Authentication failed.");
}
$app['session']->set('saml_sso_auth',true);
$app['session']->set('saml_sso_user_id',$auth->getNameId());
return $app->redirect($app['app.frontend_url']);
});
Hello,
I have create an app for GSuite with Silex and want to connect users with GSuite SSO SAML 2.0 Is there any one have advice or experience for SAML 2.0 auth flow with Silex, maybe even more a silex service provider which is integrated with security provider 😍
Thank you 😊