OIDC: scoped sub with client_credentials?
Scott Cantor
scott at restingparrotsoftware.com
Mon Nov 9 13:52:23 UTC 2026
> That makes total sense and yes it's just in my small world that the
> client id when using client_credentials basically is a service account
> that's connecting to an API.
That would be my expectation when I was designing the implementation of that feature, but since there's no separation in the protocol between "username" and "client_id", I didn't have an obvious way to remap it.
Taking lessons from the SP work I could come up with something today, but back then there was too much to do to just get the feature working.
Even so, with the SP I was free to just treat the "agent ID" as the username and build a reverse mapping, but with this, I'd have had to probably extend the metadata/client info specs to carry something and we'd have to build in that lookup indirection in the code.
> Since most people might use an URI or a string it would also be possible
> via c14n transformation to use a translate map between client_ids and an
> internal service account (probably via a subject decorator[1]?) right?
I'm not sure exactly in which versions of the IdP various things got added, but probably so. The decorator can probably "replace" something in the Subject as well as add to it, so that's probably how one would be able to override the value in the UsernamePrincipal to keep the c14n part trivial.
In 5.2, it's just as easy to do it on the back end and implement a Function-based c14n that does the remapping.
Either way, whatever comes out at the end should be what the code populates into the "sub" claim, but I'll look at the code and double check that, and make the docs a little more explicit about it.
-- Scott
More information about the users
mailing list