Skip to content

Commit

Permalink
Removed validations, test, and config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyC-za committed Mar 27, 2023
1 parent 23c44ce commit 3de42ad
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
5 changes: 2 additions & 3 deletions lib/doorkeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ class << self
attr_reader :orm_adapter

def configure(&block)
builder = Config::Builder.new(&block)
@config = builder.config
@config = Config::Builder.new(&block).build
setup
builder.build
@config
end

# @return [Doorkeeper::Config] configuration instance
Expand Down
22 changes: 0 additions & 22 deletions lib/doorkeeper/config/validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def validate!
validate_reuse_access_token_value
validate_token_reuse_limit
validate_secret_strategies
validate_custom_access_token_attributes
end

private
Expand Down Expand Up @@ -49,27 +48,6 @@ def validate_token_reuse_limit
)
@token_reuse_limit = 100
end

# Validate that the access_token and access_grant models
# both respond to all of the custom attributes
def validate_custom_access_token_attributes
return if custom_access_token_attributes.blank?

unrecognized_attributes = []
custom_access_token_attributes.each do |attribute_name|
[access_token_model, access_grant_model].each do |model|
next if model.has_attribute?(attribute_name)

unrecognized_attributes << attribute_name
::Rails.logger.warn(
"[DOORKEEPER] #{access_token_model} does not respond to custom attribute '#{attribute_name}'. " \
"This custom attribute will be ignored.",
)
end
end

@custom_access_token_attributes -= unrecognized_attributes
end
end
end
end
13 changes: 0 additions & 13 deletions spec/lib/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,6 @@ class ApplicationWithOwner < ActiveRecord::Base
end
expect(config.custom_access_token_attributes).to eq([:tenant_name])
end

it "removes unrecognized attributes" do
# Once for access_grant_model, and again for access_token_model.
expect(Rails.logger).to receive(:warn).with(/custom attribute will be ignored/)
expect(Rails.logger).to receive(:warn).with(/custom attribute will be ignored/)

Doorkeeper.configure do
orm DOORKEEPER_ORM
custom_access_token_attributes [:tenant_name, :unrecognized_attribute]
end

expect(config.custom_access_token_attributes).to eq([:tenant_name])
end
end

describe "application_secret_generator" do
Expand Down

0 comments on commit 3de42ad

Please sign in to comment.