lib/oclc/auth/wskey.rb
# Generates a digital signature for a given request according to the OAuth HMAC specification
#
# [http_method] the HTTP method, GET, POST, PUT, DELETE
# [url] the URL the request will be made to
# [options] a hash of optional parameters described below
#
# Options
# 
# [:principal_id] the ID that represents a user
# [:principal_idns] the ID namespace context for the user
Generates a digital signature for a given request according to the OAuth HMAC specification
[http_method] the HTTP method, GET, POST, PUT, DELETE
[url] the URL the request will be made to
[options] a hash of optional parameters described below

Options

[:principal_id] the ID that represents a user
[:principal_idns] the ID namespace context for the user
Generates a digital signature for a given request according to the OAuth HMAC specification [ http_method ] the HTTP method GET POST PUT DELETE [ url ] the URL the request will be made to [ options ] a hash of optional parameters described below Options [ : principal_id ] the ID that represents a user [ : principal_idns ] the ID namespace context for the user
def hmac_signature(http_method, url, options = {})
        req_timestamp = timestamp
        req_nonce = nonce 
        signature_base = signature_base_string(req_timestamp, req_nonce, http_method, url)
        auth  = ""
        auth += "#{scheme_url} "
        auth += "clientId=\"#{client_id}\", "
        auth += "timestamp=\"#{req_timestamp}\", "
        auth += "nonce=\"#{req_nonce}\", "
        auth += "signature=\"#{signature(signature_base)}\""
        if options[:principal_id] and options[:principal_idns] 
          append = true
          uri = URI.parse(url)
          if uri.query
            params = CGI::parse(uri.query)
            append = params.has_key?("principalID") ? false : true
          end
          auth += ", principalID=\"#{options[:principal_id]}\", principalIDNS=\"#{options[:principal_idns]}\"" if append
        end
        auth
      end
def hmac_signature ( http_method , url , options = { } ) req_timestamp = timestamp req_nonce = nonce signature_base = signature_base_string ( req_timestamp , req_nonce , http_method , url ) auth = "" auth += "#{scheme_url} " auth += "clientId=\"#{client_id}\", " auth += "timestamp=\"#{req_timestamp}\", " auth += "nonce=\"#{req_nonce}\", " auth += "signature=\"#{signature(signature_base)}\"" if options [ :principal_id ] and options [ :principal_idns ] append = true uri = URI . parse ( url ) if uri . query params = CGI :: parse ( uri . query ) append = params . has_key? ( "principalID" ) ? false : true end auth += ", principalID=\"#{options[:principal_id]}\", principalIDNS=\"#{options[:principal_idns]}\"" if append end auth end
Generates a digital signature for a given request according to the OAuth HMAC specification
[http_method] the HTTP method, GET, POST, PUT, DELETE
[url] the URL the request will be made to
[options] a hash of optional parameters described below
Generates a digital signature for a given request according to the OAuth HMAC specification [ http_method ] the HTTP method GET POST PUT DELETE [ url ] the URL the request will be made to [ options ] a hash of optional parameters described below
http_method
<not_specific>
url
<not_specific>
options
<not_specific>