Class: Auth::AuthorizationHeader
- Inherits:
-
Object
- Object
- Auth::AuthorizationHeader
- Defined in:
- app/services/auth/authorization_header.rb
Constant Summary collapse
- AUTHORIZATION_HEADER_FORMAT =
/\ASigningAlgorithm=([[-a-z0-9]]+), SignedHeaders=([[-a-z0-9;]]+), Signature=([[a-f0-9]]+)\Z/.freeze
Instance Attribute Summary collapse
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#signed_headers ⇒ Object
readonly
Returns the value of attribute signed_headers.
-
#signing_algorithm ⇒ Object
readonly
Returns the value of attribute signing_algorithm.
-
#signing_algorithm_name ⇒ Object
readonly
Returns the value of attribute signing_algorithm_name.
Instance Method Summary collapse
-
#initialize(header) ⇒ AuthorizationHeader
constructor
A new instance of AuthorizationHeader.
Constructor Details
#initialize(header) ⇒ AuthorizationHeader
Returns a new instance of AuthorizationHeader.
10 11 12 13 14 15 16 17 18 |
# File 'app/services/auth/authorization_header.rb', line 10 def initialize(header) match = AUTHORIZATION_HEADER_FORMAT.match(header) raise HeaderParseError, 'Unsupported Gladly-Authorization header format' if match.nil? @signing_algorithm_name = match[1] @signing_algorithm = parse_signing_algorithm!(@signing_algorithm_name.gsub('hmac-', '')) @signed_headers = parse_headers!(match[2]) @signature = match[3] end |
Instance Attribute Details
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
8 9 10 |
# File 'app/services/auth/authorization_header.rb', line 8 def signature @signature end |
#signed_headers ⇒ Object (readonly)
Returns the value of attribute signed_headers.
8 9 10 |
# File 'app/services/auth/authorization_header.rb', line 8 def signed_headers @signed_headers end |
#signing_algorithm ⇒ Object (readonly)
Returns the value of attribute signing_algorithm.
8 9 10 |
# File 'app/services/auth/authorization_header.rb', line 8 def signing_algorithm @signing_algorithm end |
#signing_algorithm_name ⇒ Object (readonly)
Returns the value of attribute signing_algorithm_name.
8 9 10 |
# File 'app/services/auth/authorization_header.rb', line 8 def signing_algorithm_name @signing_algorithm_name end |