pjebs / restgate

Secure Authentication for REST API endpoints.
MIT License
247 stars 23 forks source link

Support other Databases #2

Closed jaxon closed 9 years ago

jaxon commented 9 years ago

Are there plans to support databases other databases, such as Google Datastore?

pjebs commented 9 years ago

It works with any database compatible with the database/sql package: https://github.com/golang/go/wiki/SQLDrivers

Google Datastore is a NoSQL database. I have seen in other frameworks for other programming languages ppl making sql adapters for nosql databases. There are none on the list above and I did a quick google search and there doesn't seem to be any for Google Datastore.

There is a security issue as well. NoSQL databases are "eventually consistent" which means that if you were to remove a Secret/Key, it is possible that the database changes do not propagate immediately and for a short period of time someone may still be able to access your endpoint with an old secret/key.

My recommendation is you use Google Cloud Sql which is part of the Google App Engine ecosystem JUST for restgate keys and secrets.

This mysql adapter is compatible with Google Cloud Sql: https://github.com/go-sql-driver/mysql/#examples

pjebs commented 9 years ago

https://cloud.google.com/datastore/docs/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/

jaxon commented 9 years ago

Good point, I hadn't thought of the datastore's eventual consistency in relation to authentication.

The article you posted talked about the same solutions I had seen elsewhere: using memcached and/or ancestor based transactions.

There's even a project utilizing some of these ideas: https://github.com/qedus/nds

pjebs commented 8 years ago

Try this: https://github.com/averni/restgate