简体   繁体   English

AngularJS,Laravel REST API

[英]AngularJS, Laravel REST API

Im playing with Angular and laravel, so I have this RBAC Package of my own, and Im trying to make it work in a Rest way... I'm barely learning this... so my question is... 我正在使用Angular和laravel,所以我有自己的RBAC软件包,我正在尝试使其以Rest方式工作...我几乎没有学习这...所以我的问题是...

My package depends on php sessions, where an array with user roles and permissions is stored, so each time I run my filter to determine if the use should perform an action over a resource of the application or not it reads the session instead of querying the DB every time. 我的程序包取决于php会话,该会话存储了具有用户角色和权限的数组,因此,每次运行筛选器以确定用户是否应对应用程序的资源执行操作时,它会读取会话而不是查询会话。每次都有DB。

So... I have my routes functioning and all, but is there a way to access the user session through curl? 所以...我的路由正常运行,但是有没有办法通过curl访问用户会话? ... better question is there a way to keep the user logged in so that way laravel knows where the session is store at? ...更好的问题是,有没有一种方法可以使用户保持登录状态,以便laravel知道会话存储在哪里?

I am not sure this is what you want, but, PHP stores your session id as a cookie. 我不确定这是否是您想要的,但是PHP将您的会话ID存储为cookie。 And, curl can load cookies from a file . 而且curl可以从文件加载cookie So, if you store your session id in a cookie file, and tell curl to load the cookies from that file, your problem is solved. 因此,如果您将会话ID存储在cookie文件中,并告诉curl从该文件中加载cookie,就可以解决问题。

I hope this gives you a hint. 我希望这会给您提示。

EDIT: 编辑:
Laravel stores it's session coookie as laravel_session . Laravel将其会话库存储为laravel_session

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM