mirror of
https://github.com/samsonjs/simple_oauth.git
synced 2026-03-25 08:45:54 +00:00
add IGNORED_KEYS for options used in signature calculations
This commit is contained in:
parent
cbc2df1ca0
commit
234fd8793b
1 changed files with 4 additions and 0 deletions
|
|
@ -6,6 +6,9 @@ require 'cgi'
|
|||
module SimpleOAuth
|
||||
class Header
|
||||
ATTRIBUTE_KEYS = [:callback, :consumer_key, :nonce, :signature_method, :timestamp, :token, :verifier, :version] unless defined? ::SimpleOAuth::Header::ATTRIBUTE_KEYS
|
||||
|
||||
IGNORED_KEYS = [:consumer_secret, :token_secret] unless defined? ::SimpleOAuth::Header::IGNORED_KEYS
|
||||
|
||||
attr_reader :method, :params, :options
|
||||
|
||||
class << self
|
||||
|
|
@ -82,6 +85,7 @@ module SimpleOAuth
|
|||
|
||||
def attributes
|
||||
matching_keys, extra_keys = options.keys.partition { |key| ATTRIBUTE_KEYS.include?(key) }
|
||||
extra_keys -= IGNORED_KEYS
|
||||
if options[:ignore_extra_keys] || extra_keys.empty?
|
||||
Hash[options.select { |key, _value| matching_keys.include?(key) }.collect { |key, value| [:"oauth_#{key}", value] }]
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue