class Stormpath::Authentication::HttpBasicAuthentication
Constants
- BASIC_PATTERN
Attributes
application[R]
Public Class Methods
new(application, authorization_header)
click to toggle source
# File lib/stormpath-sdk/auth/http_basic_authentication.rb 7 def initialize(application, authorization_header) 8 @application = application 9 @authorization_header = authorization_header 10 raise Stormpath::Error if authorization_header.nil? 11 end
Public Instance Methods
authenticate!()
click to toggle source
# File lib/stormpath-sdk/auth/http_basic_authentication.rb 13 def authenticate! 14 raise Stormpath::Error if fetched_api_key.nil? 15 raise Stormpath::Error if fetched_api_key.secret != api_key_secret 16 fetched_api_key 17 end
Private Instance Methods
api_key_id()
click to toggle source
# File lib/stormpath-sdk/auth/http_basic_authentication.rb 25 def api_key_id 26 decoded_authorization_header.first 27 end
api_key_secret()
click to toggle source
# File lib/stormpath-sdk/auth/http_basic_authentication.rb 29 def api_key_secret 30 decoded_authorization_header.last 31 end
fetched_api_key()
click to toggle source
# File lib/stormpath-sdk/auth/http_basic_authentication.rb 21 def fetched_api_key 22 @fetched_api_key ||= application.api_keys.search(id: api_key_id).first 23 end