symfony - REST API and client on same server, need API authentication? -


first, let me describe application: working on web-based software kind of custom desk application. requires user login (we use fosuserbundle). after login user redirected dashboard. dashboard there no more page reload, frontend build on angularjs , user can anywhere within application without page reload. speak of single page application.

so data presented user, fetched rest api (we use fosrestbundle). works quite @ point.

there kind of dilemma. our staff access application (for now). staff member needs login access helpdesk. data pushed frontend via angularjs called via api, user has logged in needs authenticate again on every request because of rest.

problem: since backend runs on symfony2 let try user object of logged in user when api call made:

$this->get('security.context')->gettoken()->getuser() 

returns anon. stands anonymous, or

$this->getuser(); 

returns null.

so authenticated context seems gone when using rest api. when call action directly without rest, can user information.

so need secure our rest api , user information on every api call. don't want third party people access our application, staff. not familar oauth, user redirected third party page allow/deny access data? not option us.

based on information, have suggestions or ideas how secure api , transport user data getuser not return null or anon. actuall logged in user?

there's way resolve problem.

it's using certificates. can generate certificates use http tunneling (https obviousley), server ask certificate (you've configure apache it's not big challenge).

with in place, you've add certificatemanageron server side ensure certificate valid , know who's calling service (to able authenticate user @ each request), certificatemanager(or ever you'll call it) have configured within filters chaine (as known in java world), et voilĂ 

hop you, abderrazak


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -