Replies: 1 comment
-
|
@nkhitrov take a look @RobertoPrevato's examples in this discussion #338. I hope they will be useful. I use a custom Identity class class UserIdentity(Identity):
@property
def id(self) -> Optional[str]:
return self["id"] or self.sub
@property
def session_id(self) -> Optional[str]:
return self["sid"] or None
@property
def scopes(self) -> list[str]:
return self["scopes"]I set an instance of this class to request.identity = UserIdentity(token, self.token_type.decode()) |
Beta Was this translation helpful? Give feedback.
0 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.
-
I wrote a custom authentication handler with custom Identity to use property with typing:
When I set
MyUserIdentityas typing for user param It does not work.When I use
guardpost.Useras typing for user,blacksheepinjects my custom identity instance, but in this case controller has invalid typing.I think we should change this line from
if annotation is User or annotation is Identitytoif issubclass(annotation, Identity)Beta Was this translation helpful? Give feedback.
All reactions