Codebase list ruby-omniauth-facebook / 3ec55a2
Use constant for supported algorithm. Josef Šimánek 9 years ago
1 changed file(s) with 2 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
1010 class UnknownSignatureAlgorithmError < NotImplementedError; end
1111
1212 DEFAULT_SCOPE = 'email'
13 SUPPORTED_ALGORITHM = 'HMAC-SHA256'
1314
1415 option :client_options, {
1516 :site => 'https://graph.facebook.com',
165166 decoded_hex_signature = base64_decode_url(signature)
166167 decoded_payload = MultiJson.decode(base64_decode_url(encoded_payload))
167168
168 unless decoded_payload['algorithm'] == 'HMAC-SHA256'
169 unless decoded_payload['algorithm'] == SUPPORTED_ALGORITHM
169170 raise UnknownSignatureAlgorithmError, "unknown algorithm: #{decoded_payload['algorithm']}"
170171 end
171172