Conversation
| , AllAuth auths a | ||
| , HasContextEntry ctxs (AuthHandler Request (NewAuthResult a)) | ||
| ) => HasServer (NewAuth mods auths a :> api) ctxs where | ||
| type ServerT (NewAuth mods auths a :> api) m = |
There was a problem hiding this comment.
Would it make sense define the instance for NewAuth mods (auth ': auths) a :> api to statically ensure that at least one auth mode is defined ? We could define a custom type error for the case where the list of auths is empty.
Just to clarify my understanding here (I am not overly familiar with
Whereas you would prefer for subsequent auth schemes to be tried anyhow, and only return a 401 error when all of them fail ? |
|
I very much like that the |
No, my implementation works the same way. If the first In this way, if you'd want more than one authentication to be present and tried, you'd have to use two But if you accept a JWT in the query parameters, a header or BasicAuth, it would just look like this and only one has to succeed: |
|
Note to self:
|
|
@Vlix do you need any help with this? |
I haven't spent time on this at all, so if you want to pick it up, or just give your own crack at it, please do :) |
An attempt at making a better Auth instance of
HasServer.Also added an example of how this would make for easy adding of different auth procedures.
Any comments, critiques, etc. are very much welcome and appreciated.