onury / accesscontrol

Role and Attribute based Access Control for Node.js
https://onury.io/accesscontrol
MIT License
2.21k stars 178 forks source link

Redis Support? #49

Open joshrathke opened 6 years ago

joshrathke commented 6 years ago

I’m looking to implement authorization in a clustered Node app. Has there been an attempt to make this package have Redis support? Or is there an alternative method of sharing memory between Node instances?

aggarwaldev commented 5 years ago

@onury Any Comments on this one?

onury commented 5 years ago

Yes, we should add this feature. Though, there are higher priority features we need to implement first.

aggarwaldev commented 5 years ago

@onury I think you should use "Feature Request" label instead of "Help Wanted". Also, I think it's really important feature for clustered node applications.

In the meantime, do you think a workaround would be possible to update roles when changes are made in database?

onury commented 5 years ago

"help wanted" stands for: contributors / collaborators are needed to implement this; and PRs are welcome. It does not indicate "this user is asking for help".

This is a good but extra feature. Unfortunately, AC itself cannot provide a "workaround" for this; other than implementing redis integration.

What you can do for a workaround is; either have your app instances periodically check (poll) for updates; or horizontally update or notify instances of your service/application; at the time when any policy is changed. Depends on the architecture of your application. e.g. if using sockets with a central server, you could even do subscriptions.

mikesparr commented 5 years ago

I've been researching how to put it all together in this repo (here is authorization helper with Redis [cache] functionality I'm using if it helps):

onury commented 5 years ago

I'll check it soon. Thanks.

mikesparr commented 5 years ago

Thank YOU for putting together a great library. I just wrapped up integration tests and 51 tests green. Enjoy the repo: https://github.com/mikesparr/typescript-postgres-auth-example