mirror of
https://github.com/samsonjs/simple_oauth.git
synced 2026-04-27 14:57:45 +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
|
module SimpleOAuth
|
||||||
class Header
|
class Header
|
||||||
ATTRIBUTE_KEYS = [:callback, :consumer_key, :nonce, :signature_method, :timestamp, :token, :verifier, :version] unless defined? ::SimpleOAuth::Header::ATTRIBUTE_KEYS
|
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
|
attr_reader :method, :params, :options
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
@ -82,6 +85,7 @@ module SimpleOAuth
|
||||||
|
|
||||||
def attributes
|
def attributes
|
||||||
matching_keys, extra_keys = options.keys.partition { |key| ATTRIBUTE_KEYS.include?(key) }
|
matching_keys, extra_keys = options.keys.partition { |key| ATTRIBUTE_KEYS.include?(key) }
|
||||||
|
extra_keys -= IGNORED_KEYS
|
||||||
if options[:ignore_extra_keys] || extra_keys.empty?
|
if options[:ignore_extra_keys] || extra_keys.empty?
|
||||||
Hash[options.select { |key, _value| matching_keys.include?(key) }.collect { |key, value| [:"oauth_#{key}", value] }]
|
Hash[options.select { |key, _value| matching_keys.include?(key) }.collect { |key, value| [:"oauth_#{key}", value] }]
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue