Module: MAuth::Client::Authenticator
- Included in:
- MAuth::Client
- Defined in:
- lib/mauth/client.rb
Overview
methods common to RemoteRequestAuthenticator and LocalAuthenticator
Constant Summary collapse
- ALLOWED_DRIFT_SECONDS =
300
Instance Method Summary collapse
-
#authentic?(object) ⇒ Boolean
takes an incoming request or response object, and returns whether the object is authentic according to its signature.
-
#authenticate!(object) ⇒ Object
raises InauthenticError unless the given object is authentic.
Instance Method Details
#authentic?(object) ⇒ Boolean
takes an incoming request or response object, and returns whether the object is authentic according to its signature.
293 294 295 296 297 298 299 300 301 |
# File 'lib/mauth/client.rb', line 293 def authentic?(object) log_authentication_request(object) begin authenticate!(object) true rescue InauthenticError, MauthNotPresent false end end |
#authenticate!(object) ⇒ Object
raises InauthenticError unless the given object is authentic
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/mauth/client.rb', line 304 def authenticate!(object) authentication_present!(object) time_valid!(object) token_valid!(object) signature_valid!(object) rescue MauthNotPresent => e logger.warn "mAuth signature not present on #{object.class}. Exception: #{e.}" raise rescue InauthenticError => e logger.error "mAuth signature authentication failed for #{object.class}. Exception: #{e.}" raise rescue UnableToAuthenticateError => e logger.error "Unable to authenticate with MAuth for #{object.class}. Exception: #{e.}" raise end |