Sha256: 6df64e5802dd14dd8453d135932730864eafc19fd885da096700090ee8cd356f
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module Rack module OAuth2 class AccessToken class MAC class Signature < Verifier attr_required :token, :secret, :timestamp, :nonce, :method, :host, :port, :path attr_optional :body_hash, :query def calculate Rack::OAuth2::Util.base64_encode OpenSSL::HMAC.digest( hash_generator, secret, normalized_request_string ) end def normalized_request_string arr = [ token, timestamp, nonce, body_hash || '', method.to_s.upcase, host, port, path, normalized_query ] arr.join("\n") end def normalized_query if query.present? query.inject([]) do |result, (key, value)| result << [key, value] end.sort.inject('') do |result, (key, value)| result << "#{Rack::OAuth2::Util.rfc3986_encode key}=#{Rack::OAuth2::Util.rfc3986_encode value}\n" end else '' end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-oauth2-0.6.9 | lib/rack/oauth2/access_token/mac/signature.rb |
rack-oauth2-0.6.8 | lib/rack/oauth2/access_token/mac/signature.rb |