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
-
I wrote a custom authentication handler with custom Identity to use property with typing:
When I set
MyUserIdentity
as typing for user param It does not work.When I use
guardpost.User
as typing for user,blacksheep
injects 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 Identity
toif issubclass(annotation, Identity)
Beta Was this translation helpful? Give feedback.
All reactions