Skip to content

Commit

Permalink
Merge pull request #1649 from JeremyC-za/custom_token_attribs_break_r…
Browse files Browse the repository at this point in the history
…ails_commands

Fixed custom_access_token_attributes related errors
  • Loading branch information
nbulaj authored Mar 29, 2023
2 parents f749791 + 3de42ad commit 57ce594
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 25 deletions.
15 changes: 0 additions & 15 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,20 +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?

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

raise Doorkeeper::Errors::ConfigError, "#{model} does not recognize custom attribute: #{attribute_name}."
end
end
end
end
end
end
1 change: 0 additions & 1 deletion lib/doorkeeper/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def initialize(response)
UnableToGenerateToken = Class.new(DoorkeeperError)
TokenGeneratorNotFound = Class.new(DoorkeeperError)
NoOrmCleaner = Class.new(DoorkeeperError)
ConfigError = Class.new(DoorkeeperError)

InvalidToken = Class.new(BaseResponseError)
TokenExpired = Class.new(InvalidToken)
Expand Down
9 changes: 0 additions & 9 deletions spec/lib/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,6 @@ class ApplicationWithOwner < ActiveRecord::Base
end
expect(config.custom_access_token_attributes).to eq([:tenant_name])
end

it "validates custom attributes to be present in the models" do
expect do
Doorkeeper.configure do
orm DOORKEEPER_ORM
custom_access_token_attributes [:none_existing_column]
end
end.to raise_error(Doorkeeper::Errors::ConfigError)
end
end

describe "application_secret_generator" do
Expand Down

0 comments on commit 57ce594

Please sign in to comment.