-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[uss_qualifier] new resource for cleanly exposing the client identity #362
[uss_qualifier] new resource for cleanly exposing the client identity #362
Conversation
08d0b1b
to
8653a50
Compare
edit indeed, a problem in the config caused the DSS tests to be skipped and this got caught by the aggregate check. This is ready for review.
The logs show this:
edit3: a resource was indeed missing. |
8653a50
to
00e0db9
Compare
6b197ff
to
2119cb1
Compare
2119cb1
to
5896ee2
Compare
This is a function and not a field, to possibly profit from a token that would have been requested earlier | ||
""" | ||
|
||
sub = self._adapter.get_sub() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most AuthAdapter subclasses do not have this method, so this line will fail when using most types of AuthAdapter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_sub
seems to be defined on the AuthAdapter parent class:
it returns a None
if no token with a sub
can be found, and the constructor properly initializes self._tokens
to an empty Dict
so I assume this will at worst always return a None?
That would indeed seem to be a problem in situations where the adapters implement issue_token()
(which raises a NotImplementedError
in the superclass) and then do not update the adapter's token map for some reason: in such a case get_sub
would return a None
again after issue_token()
has been called below.
(although, possibly for such situations the sub
field value would be known and get_sub()
could be overridden, such as has been done in DummyOAuth in this PR? This way we would not even call issue_token()
)
Now, if some implementations would effectively fail on get_sub
, can I assume issue_token
will always be available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, entirely my mistake; my original comment here was entirely wrong. Sorry about that!
The thing that was throwing me off was the new get_sub
on just one subclass, but of course this makes sense as there is a particularly easy/better way to implement that pre-existing base-class method on that specific subclass. In any case, entirely my bad.
This is the proper fix for #306:
The client identity (or more colloquially the
sub
field of its JWT) is now exposed to any resource or scenario that needs it via aClientIdentityResource
, which now holds thewhoami_*
audience and scope definitions that were formerly passed to theIDGeneratorResource
.The
IDGeneratorResource
now depends on the new resource to obtain the client_identity.It should be noted that the
whoami_*
audience and scope will be used to request a token only if no other token had yet been requested by the auth_adapter:The
IDGeneratorResource
will wait untilsubscriber()
is called for the first time before checking ifget_sub()
returns something.