We're developing a system using AngularJS and PHP. I have some concerns about the security on the matter of authentication. I wrote a basic authentication based upon multiple different examples around the web (I only started learning Angular), which uses a database via REST API calls. On some routes it checks if the user information exists before it creates a promise, but I have a few questions:
Can session information be stored in
$window.sessionStorageor$cookieStoragewithout the client being able to modify these values or should I keep them server-side with PHP$_SESSIONand fetch them from there, never storing them anywhere in JS? Session information can contain uid, role, email and nameCan I store a value, like let's say
$rootScope.roleor$scope.rolewithout the client being able to modify this value? Let's say for example we have multiple levels of user accounts where super-admin is the highest. If I create a route with a resolve which would check the$rootScope.rolelevel, can a novice go change the$rootScope.rolevalue to super-admin gaining access to restricted backend sections?Will I have to implement a GET /session check on every route to which gets
$_SESSIONdata to actually make sure this data stays untouched?Or am I just paranoid?