lib/doorkeeper/oauth/client_credentials/creator.rb in doorkeeper-0.7.1 vs lib/doorkeeper/oauth/client_credentials/creator.rb in doorkeeper-0.7.2
- old
+ new
@@ -1,24 +1,9 @@
module Doorkeeper
module OAuth
class ClientCredentialsRequest
class Creator
def call(client, scopes, attributes = {})
- existing_token = existing_token_for(client, scopes)
- if existing_token
- return existing_token if existing_token.accessible?
- existing_token.revoke
- end
- create(client, scopes, attributes)
- end
-
- private
-
- def existing_token_for(client, scopes)
- Doorkeeper::AccessToken.matching_token_for client, nil, scopes
- end
-
- def create(client, scopes, attributes = {})
Doorkeeper::AccessToken.create(attributes.merge({
:application_id => client.id,
:scopes => scopes.to_s
}))
end