diff --git a/app/controllers/authorizations_controller.rb b/app/controllers/authorizations_controller.rb index 133d739f2..f0675eebd 100644 --- a/app/controllers/authorizations_controller.rb +++ b/app/controllers/authorizations_controller.rb @@ -81,16 +81,3 @@ class AuthorizationsController < ApplicationController !OAuth2::Provider.client_class.exists?(:nonce => nonce) end end - -OAuth2::Provider.client_class.instance_eval do - def self.create_or_reset_from_manifest! manifest - if obj = find_by_name(manifest['name']) - obj.oauth_identifier = OAuth2::Provider::Random.base62(16) - obj.oauth_secret = OAuth2::Provider::Random.base62(32) - obj.save! - obj - else - create!(manifest) - end - end -end diff --git a/app/models/oauth2_provider_models_activerecord_client.rb b/app/models/oauth2_provider_models_activerecord_client.rb new file mode 100644 index 000000000..dbd37d865 --- /dev/null +++ b/app/models/oauth2_provider_models_activerecord_client.rb @@ -0,0 +1,12 @@ +class OAuth2::Provider::Models::ActiveRecord::Client + def self.create_or_reset_from_manifest! manifest + if obj = find_by_name(manifest['name']) + obj.oauth_identifier = OAuth2::Provider::Random.base62(16) + obj.oauth_secret = OAuth2::Provider::Random.base62(32) + obj.save! + obj + else + create!(manifest) + end + end +end diff --git a/spec/models/oauth2_provider_models_activerecord_client_spec.rb b/spec/models/oauth2_provider_models_activerecord_client_spec.rb new file mode 100644 index 000000000..6acf772f1 --- /dev/null +++ b/spec/models/oauth2_provider_models_activerecord_client_spec.rb @@ -0,0 +1,13 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. +# +require 'spec_helper' + +describe OAuth2::Provider::Models::ActiveRecord::Client do + #TODO + describe 'validations'do + it 'is pending for now' + end +end +