{"action":"opened","issue":{"url":"https://api.github.com/repos/spring-projects/spring-security-oauth/issues/350","labels_url":"https://api.github.com/repos/spring-projects/spring-security-oauth/issues/350/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-security-oauth/issues/350/comments","events_url":"https://api.github.com/repos/spring-projects/spring-security-oauth/issues/350/events","html_url":"https://github.com/spring-projects/spring-security-oauth/issues/350","id":53539105,"number":350,"title":"(TokenServices + ClientDetailServices)*stateless = extra DB query for each request","user":{"login":"Bobik007","id":10423408,"avatar_url":"https://avatars.githubusercontent.com/u/10423408?v=3","gravatar_id":"","url":"https://api.github.com/users/Bobik007","html_url":"https://github.com/Bobik007","followers_url":"https://api.github.com/users/Bobik007/followers","following_url":"https://api.github.com/users/Bobik007/following{/other_user}","gists_url":"https://api.github.com/users/Bobik007/gists{/gist_id}","starred_url":"https://api.github.com/users/Bobik007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bobik007/subscriptions","organizations_url":"https://api.github.com/users/Bobik007/orgs","repos_url":"https://api.github.com/users/Bobik007/repos","events_url":"https://api.github.com/users/Bobik007/events{/privacy}","received_events_url":"https://api.github.com/users/Bobik007/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-06T17:26:03Z","updated_at":"2015-01-06T17:26:03Z","closed_at":null,"body":"I'm using oauth2 for my rest API, with JdbsTokenStore. My API is stateless, so for every request token is read from DB and it includes everything that I will need down the line.\r\n \r\nMy problem though is ClientDetailServices, now that the token was extracted from DB, I still need to make another DB query to restore client details including granted authorities in ClientDetailsService.loadClientByClientId, even though token already includes relevant details\r\n\r\nThus instead of having one DB query to restore token, I must issue a second one to populate ClientDetails.\r\n\r\nThis obviously is a result of oauth implementation superimposed on top of security framework. \r\nPossibly can be solved by ClientDetailsService.loadClientByClientId accepting Object instead of String, and passing in entire token is used with oauth and just username otherwise, but I'm not sure what other implications this change would entail.\r\n\r\nI'm hoping I'm doing something wrong and there is a simple solution? \r\nBut if not would you consider adding as feature request?"}}