Source:
public OauthAuthenticationResult authenticate(Application application, ResourceAuthenticationRequest request) { JwtWrapper jwtWrapper; try { jwtWrapper = new JwtWrapper(request.getAccessToken()); jwtSignatureValidator.validate(jwtWrapper); } catch (OAuthSystemException e) { log.warn("Caught Exception: {}. Rethrowing as AccessTokenOauthException", e.getMessage(), e); throw ApiAuthenticationExceptionFactory .newOauthException(AccessTokenOauthException.class, INVALID_ACCESS_TOKEN); } catch (InvalidJwtException e) { log.warn("Caught Exception: {}. Rethrowing as AccessTokenOauthException", e.getMessage(), e); throw ApiAuthenticationExceptionFactory .newOauthException(AccessTokenOauthException.class, INVALID_ACCESS_TOKEN); } Map jsonMap = jwtWrapper.getJsonPayloadAsMap(); Number expirationTimestamp = getRequiredValue(jsonMap, AccessTokenRequestAuthenticator.ACCESS_TOKEN_EXPIRATION_TIMESTAMP_FIELD_NAME); assertTokenNotExpired( expirationTimestamp.longValue()); String apiKeyId = getRequiredValue(jsonMap, AccessTokenRequestAuthenticator.ACCESS_TOKEN_SUBJECT_FIELD_NAME); ApiKey apiKey = getTokenApiKey(application, apiKeyId); String grantedScopes = getOptionalValue(jsonMap, OAUTH_SCOPE); Set<String> scope; if (Strings.hasText(grantedScopes)) { scope = new HashSet<String>(); for (StringTokenizer scopeTokenizer = new StringTokenizer(grantedScopes, SCOPE_SEPARATOR_CHAR); scopeTokenizer.hasMoreElements(); ) { String scopeValue = scopeTokenizer.nextToken(); scope.add(scopeValue); } } else { scope = Collections.emptySet(); } return new DefaultOauthAuthenticationResult(dataStore, apiKey, scope); }

Target:
public OauthAuthenticationResult authenticate(Application application, ResourceAuthenticationRequest request) { JwtWrapper jwtWrapper; try { jwtWrapper = new JwtWrapper(request.getAccessToken()); jwtSignatureValidator.validate(jwtWrapper); } catch (OAuthSystemException e) { log.warn( "Caught Exception while validating JWT signature: {}. Rethrowing as AccessTokenOauthException", e.getMessage(), e ); throw ApiAuthenticationExceptionFactory .newOauthException(AccessTokenOauthException.class, INVALID_ACCESS_TOKEN); } catch (InvalidJwtException e) { log.warn( "Caught Exception while validating JWT signature: {}. Rethrowing as AccessTokenOauthException", e.getMessage(), e ); throw ApiAuthenticationExceptionFactory .newOauthException(AccessTokenOauthException.class, INVALID_ACCESS_TOKEN); } Map jsonMap = jwtWrapper.getJsonPayloadAsMap(); Number expirationTimestamp = getRequiredValue(jsonMap, AccessTokenRequestAuthenticator.ACCESS_TOKEN_EXPIRATION_TIMESTAMP_FIELD_NAME); assertTokenNotExpired( expirationTimestamp.longValue()); String apiKeyId = getRequiredValue(jsonMap, AccessTokenRequestAuthenticator.ACCESS_TOKEN_SUBJECT_FIELD_NAME); ApiKey apiKey = getTokenApiKey(application, apiKeyId); String grantedScopes = getOptionalValue(jsonMap, OAUTH_SCOPE); Set<String> scope; if (Strings.hasText(grantedScopes)) { scope = new HashSet<String>(); for (StringTokenizer scopeTokenizer = new StringTokenizer(grantedScopes, SCOPE_SEPARATOR_CHAR); scopeTokenizer.hasMoreElements(); ) { String scopeValue = scopeTokenizer.nextToken(); scope.add(scopeValue); } } else { scope = Collections.emptySet(); } return new DefaultOauthAuthenticationResult(dataStore, apiKey, scope); }