Class: Rack::OAuth2::AccessToken::MAC::Signature

Inherits:
Verifier
  • Object
show all
Defined in:
lib/rack/oauth2/access_token/mac/signature.rb

Instance Method Summary collapse

Methods inherited from Verifier

#initialize, #verify!

Constructor Details

This class inherits a constructor from Rack::OAuth2::AccessToken::MAC::Verifier

Instance Method Details

#calculateObject



9
10
11
12
13
14
15
# File 'lib/rack/oauth2/access_token/mac/signature.rb', line 9

def calculate
  Rack::OAuth2::Util.base64_encode OpenSSL::HMAC.digest(
    hash_generator,
    secret,
    normalized_request_string
  )
end

#normalized_request_stringObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rack/oauth2/access_token/mac/signature.rb', line 17

def normalized_request_string
  [
    ts.to_i,
    nonce,
    method.to_s.upcase,
    request_uri,
    host,
    port,
    ext || '',
    nil
  ].join("\n")
end