Parse 'sub' to identify resource owner
As per https://tools.ietf.org/html/rfc7662#section-2.2 the `sub` key should identify the resource owner in oauth2 introspection responses. This change adds support for the `sub` key and will allow the introspection response of RFC-compliant servers to be parsed. Will still try `user_id` first as to not break backward compatibility.pull/1320/head
parent
ce9bf3507f
commit
85246d2d3e
|
@ -244,7 +244,10 @@ public class IntrospectingTokenService implements ResourceServerTokenServices {
|
|||
private Authentication createUserAuthentication(JsonObject token) {
|
||||
JsonElement userId = token.get("user_id");
|
||||
if(userId == null) {
|
||||
return null;
|
||||
userId = token.get("sub");
|
||||
if (userId == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return new PreAuthenticatedAuthenticationToken(userId.getAsString(), token, introspectionAuthorityGranter.getAuthorities(token));
|
||||
|
|
Loading…
Reference in New Issue