Skip to content

Commit 3de42ad

Browse files
committed
Removed validations, test, and config changes
1 parent 23c44ce commit 3de42ad

3 files changed

Lines changed: 2 additions & 38 deletions

File tree

lib/doorkeeper.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,9 @@ class << self
118118
attr_reader :orm_adapter
119119

120120
def configure(&block)
121-
builder = Config::Builder.new(&block)
122-
@config = builder.config
121+
@config = Config::Builder.new(&block).build
123122
setup
124-
builder.build
123+
@config
125124
end
126125

127126
# @return [Doorkeeper::Config] configuration instance

lib/doorkeeper/config/validations.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def validate!
1111
validate_reuse_access_token_value
1212
validate_token_reuse_limit
1313
validate_secret_strategies
14-
validate_custom_access_token_attributes
1514
end
1615

1716
private
@@ -49,27 +48,6 @@ def validate_token_reuse_limit
4948
)
5049
@token_reuse_limit = 100
5150
end
52-
53-
# Validate that the access_token and access_grant models
54-
# both respond to all of the custom attributes
55-
def validate_custom_access_token_attributes
56-
return if custom_access_token_attributes.blank?
57-
58-
unrecognized_attributes = []
59-
custom_access_token_attributes.each do |attribute_name|
60-
[access_token_model, access_grant_model].each do |model|
61-
next if model.has_attribute?(attribute_name)
62-
63-
unrecognized_attributes << attribute_name
64-
::Rails.logger.warn(
65-
"[DOORKEEPER] #{access_token_model} does not respond to custom attribute '#{attribute_name}'. " \
66-
"This custom attribute will be ignored.",
67-
)
68-
end
69-
end
70-
71-
@custom_access_token_attributes -= unrecognized_attributes
72-
end
7351
end
7452
end
7553
end

spec/lib/config_spec.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,6 @@ class ApplicationWithOwner < ActiveRecord::Base
533533
end
534534
expect(config.custom_access_token_attributes).to eq([:tenant_name])
535535
end
536-
537-
it "removes unrecognized attributes" do
538-
# Once for access_grant_model, and again for access_token_model.
539-
expect(Rails.logger).to receive(:warn).with(/custom attribute will be ignored/)
540-
expect(Rails.logger).to receive(:warn).with(/custom attribute will be ignored/)
541-
542-
Doorkeeper.configure do
543-
orm DOORKEEPER_ORM
544-
custom_access_token_attributes [:tenant_name, :unrecognized_attribute]
545-
end
546-
547-
expect(config.custom_access_token_attributes).to eq([:tenant_name])
548-
end
549536
end
550537

551538
describe "application_secret_generator" do

0 commit comments

Comments
 (0)