laravel-saml2 icon indicating copy to clipboard operation
laravel-saml2 copied to clipboard

What is the best practice to deal with SAML POST and still maintaining CSRF protection ?

Open bunlongheng opened this issue 7 years ago • 0 comments

I configured everything in the SP and iDP sections in saml2_settings.php I go to : /admin/login I got landed on my iDP log-in page immediately, it is a correct behavior.

I log-in with the proper username and password provided by my iDP.

screen shot 2017-03-28 at 2 53 54 pm

After successfully authenticated, I kept redirecting back to my log-in page/host.

I declared my routes like this

Route::get('/admin/login','SAMLController@adminSignIn');
Route::post('admin/secure/dashboard', 'SAMLController@saml_post');

SAMLController

public function adminSignIn(){
        return Saml2::login(URL::full());
    }

public function saml_post(){
        $inputs = json_decode(Input::get('json'), true);
        dd($inputs); <—— I never get to see what POST to me from my iDP
}

How do I prevent that redirect ? Do I need to create a middleware ?

Can someone please help me how to create a middleware to prevent this redirecting ?

Thanks..

bunlongheng avatar Mar 28 '17 18:03 bunlongheng