-
Notifications
You must be signed in to change notification settings - Fork 952
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
Jwt Bearer is not sure whether "sub" contains the username or the user email. #295
Comments
@bojanz excellent questions.
|
|
Hey guys, I implemented JWT bearers early last year, so things could have changed. The spec I used then was: http://tools.ietf.org/html/draft-ietf-oauth-jwt-bearer-01 Where the spec was not clear, I followed google's implementation: https://developers.google.com/accounts/docs/OAuth2ServiceAccount
|
Why can't we have in the current implementation a public key per client only and not per client per user? Because if you want to use the JWT as an authorization grant you should have a subject. And for now the |
@luxifer: I agree. Clients should be able to have 1 key and impersonate other clients via the The default storage implementation for the However, all is not lost! If you are using a custom written storage, simply use I am currently a bit busy, but it would great if anyone can make this change to |
That's what i've done. I just override the |
You shouldn't just be checking the In any case, do you think you can submit a PR? |
In my case |
Why is called "client_id" at first place? It's actually an issuer(URL) of the token that is pushed in, therefore it's issuer's public key and has nothing to do with client. Client is stored under "aud" field inside JWT Token. http://openid.net/specs/openid-connect-core-1_0.html#IDToken Referring to this line in JWTBearer(176):
|
@valheranze It's called |
@F21 ahhh true, see now the difference between oauth draft and openid connect draft. |
@F21 still, there is inconsistency in library, looking inside IdToken(60-62) when creating id_token:
'aud' should then be issuer(https://example.info/uri) and 'iss' identity of the client(client_id). |
@valheranze I am not familiar with the open id spec for JWT tokens, but the spec you linked to shows that the implementation is correct:
The JWT bearer token and open id implementation are 2 separate things. I do agree its confusing that open id's JWT and JWT bearer uses different things for the JWT's components. |
@F21 hmm if JWT Bearer is not the correct GrantType to be used for openid connect implementation, which one is then? |
@valheranze I have not used the Open ID implementation, but I assume that you will need to use the AuthorizationCode GrantType located in https://github.com/bshaffer/oauth2-server-php/blob/develop/src/OAuth2/OpenID/GrantType/AuthorizationCode.php cc @bshaffer Can we have a cookbook for open id in the documentation? |
JWTBearerTest says "@param $sub The subject we are acting on behalf of. This could be the email address of the user in the system."
The email address is what examples elsewhere use for the subject field as well.
However, the JwtBearer grant type has:
This treats the subject as the username (since user id is always the username in the library.)
So, either the library changes its tests and code docs to indicate that "sub" contains a username, or it introduces a new storage method for loading the user by mail, and uses that in the JwtBearer grant type.
Semi-related question: Why does getClientKey($client_id, $subject) accept the $subject? Is it likely that a client would have a public key per user? And is there a source (spec?) for that?
The text was updated successfully, but these errors were encountered: