Replies: 1 comment 5 replies
-
I’d use something like |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For my service, I've got an
Authentication
type that represents how a request is authenticated. I've then implementedFromRequestParts
for this so that it can be wired directly into my handlers.For the most part, this works great. However, what I'd like is for some handlers to be able to take an
Option<Authentication>
so that they can be called whether the request is authenticated or not. On doing that, I've discovered that authentication errors - e.g. providing an invalid bearer token - come through aNone
when they should fail. Is there a way to achieve this?In other words, what I would like to have is:
Authentication
Option<Authentication>
Some(...)
.None
.Unfortunately, I can't implement
FromRequestParts
forOption<Authentication>
because bothFromRequestParts
andOption
are foreign types. The best I can think of is to have a local version ofOption<Authentication>
that's used instead, but that feels like a bit of a crude hack.Cheers
Beta Was this translation helpful? Give feedback.
All reactions