tvallotton / rocket_auth

An implementation for an authentication API for Rocket applications.
https://docs.rs/rocket_auth/
Apache License 2.0
73 stars 35 forks source link

Customizable SQL Schema #36

Open isosphere opened 2 years ago

isosphere commented 2 years ago

It looks like if I would like to use a different SQL schema than this project has built into it I would have to do it in a fork.

Since rocket_auth::db is private I cannot begin to make my own DBConnection implementation that used my own queries.

I'll probably cave and let your schema win, but this will make it difficult for people to integrate this authentication with existing systems.

tvallotton commented 2 years ago

I see what you are saying, what kind of API would you expect for this?

isosphere commented 2 years ago

I would probably give you a better answer if I were more experienced with Rust, but I will try and muddle through.

I have reviewed your database implementations under /src/db/ - if I could make my own implementation for a database, I would be happy to replicate all of the code you've used for each database type to achieve my goal of custom schema.

It would have the added benefit of allowing others to extend your crate to support new data storage types as per their needs.

I am not sure how this can be accomplished, though. We would need to be able to implement our own open_... functions for Users that would use our custom DBConnection implementations. I think it might be sufficient to make the involved declarations pub, but there may be a much better best practice than that.

tvallotton commented 2 years ago

I think it may not be so simple, since the User struct depends very strongly on the schema. I do have planned adding more functionality to the User struct, which is one of the reasons I've tried to keep them private.

But I do agree with you that this is a need that should be addressed, I just don't know how at the moment.