diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-11-16 14:35:55 -0800 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-11-16 14:35:55 -0800 |
commit | 59d23220103389dc8ba5c34cff96a594f69fd483 (patch) | |
tree | 38d84041f04745a04713eb45c7cc445a11ce7de9 | |
parent | cdac3ec09779fc7b8e1914712e3a27bc2f2c1443 (diff) | |
download | mixlib-authentication-59d23220103389dc8ba5c34cff96a594f69fd483.tar.gz |
Add some notes about deprecations and private things
-rw-r--r-- | lib/mixlib/authentication/signedheaderauth.rb | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/mixlib/authentication/signedheaderauth.rb b/lib/mixlib/authentication/signedheaderauth.rb index bd4035d..9fdf32c 100644 --- a/lib/mixlib/authentication/signedheaderauth.rb +++ b/lib/mixlib/authentication/signedheaderauth.rb @@ -30,15 +30,17 @@ module Mixlib NULL_ARG = Object.new - SUPPORTED_ALGORITHMS = ['sha1'].freeze - SUPPORTED_VERSIONS = ['1.0', '1.1'].freeze - ALGORITHMS_FOR_VERSION = { '1.0' => ['sha1'], '1.1' => ['sha1'], '1.3' => ['sha256', 'sha1'], }.freeze() + # Use of SUPPORTED_ALGORITHMS and SUPPORTED_VERSIONS is deprecated. Use + # ALGORITHMS_FOR_VERSION instead + SUPPORTED_ALGORITHMS = ['sha1'].freeze + SUPPORTED_VERSIONS = ['1.0', '1.1'].freeze + DEFAULT_SIGN_ALGORITHM = 'sha1'.freeze DEFAULT_PROTO_VERSION = '1.0'.freeze @@ -119,17 +121,6 @@ module Mixlib header_hash end - def do_sign(private_key, digest, sign_algorithm, sign_version) - string_to_sign = canonicalize_request(sign_algorithm, sign_version) - Mixlib::Authentication::Log.debug "String to sign: '#{string_to_sign}'" - case sign_version - when '1.3' - private_key.sign(digest.new, string_to_sign) - else - private_key.private_encrypt(string_to_sign) - end - end - def validate_sign_version_digest!(sign_version, sign_algorithm) if ALGORITHMS_FOR_VERSION[sign_version].nil? raise AuthenticationError, @@ -252,6 +243,18 @@ module Mixlib Mixlib::Authentication::Digester end + # private + def do_sign(private_key, digest, sign_algorithm, sign_version) + string_to_sign = canonicalize_request(sign_algorithm, sign_version) + Mixlib::Authentication::Log.debug "String to sign: '#{string_to_sign}'" + case sign_version + when '1.3' + private_key.sign(digest.new, string_to_sign) + else + private_key.private_encrypt(string_to_sign) + end + end + private :canonical_time, :canonical_path, :parse_signing_description, :digester, :canonicalize_user_id end |