-
Notifications
You must be signed in to change notification settings - Fork 72
How to implement new authorization schemes #119
Comments
I have been suspecting this for a while as well but haven't really taken the time to look closer and try and write my own auth scheme. I think we would not mind exposing more things, so feel free to make a PR, unless @domenkozar or @phadej disagree (unlikely though, we all want the servant libraries to be extensible, and anything standing in the way of that needs to be taken care of). |
@alexjg I think that no one has done that yet, so bits may be missing in the public api. If you come up with a list of what needs exporting, or even better a PR, I see no reason to merge that. |
Great, I'll have a crack at implementing something and pop in an MR with the required changes in a bit. |
So I've just got an auth scheme up and running. The only missing export was the
This meant I had to add a |
FWIW, I have done something similar in my application by hijacking the machinery for BasicAuth.
If you can have your client use this "custom" basic auth this may be an option for you too. |
See #40 |
@alexjg Yes, this is indeed a bit of code we need to change. We don't want to enforce any auth scheme and we therefore don't want to be paying for what we don't use. So again, you should feel free to change whatever is needed to make your auth scheme work well, and we can see in the PR whether we can get away with less changes (I suspect not, as I had spotted some of those issues already and was suspecting there was 2 or 3 places that needed changing). |
I submitted a PR as discussed #120 Anyone able to take a look at it? |
Nice! I'll try to take a look later today. |
Hello everyone! Could someone help me to clarify the status of this issue? Is it possible now to add custom auth schemes to As far as I can see, this approach is going to be deprecated: Would be really nice to see some tutorial on how to write custom auth schemes using |
I've had a brief read through the source code and it looks like it should be straightforward to implement a new authorization scheme but the classes I would need to implement aren't exposed as part of the public API (for example the
IsAuth
class). Is this library intended to be extensible in this way or should I just use Servant generalized auth?In case it's of interest the scheme I'm trying to implement is token authentication but not JWT, just tokens stored in a DB.
The text was updated successfully, but these errors were encountered: