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.
286 287 288 289 290 291 292 293 294 |
# File 'lib/mauth/client.rb', line 286 def authentic?(object) log_authentication_request(object) begin authenticate!(object) true rescue InauthenticError false end end |
#authenticate!(object) ⇒ Object
raises InauthenticError unless the given object is authentic
297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/mauth/client.rb', line 297 def authenticate!(object) authentication_present!(object) time_valid!(object) token_valid!(object) signature_valid!(object) rescue InauthenticError logger.error "mAuth signature authentication failed for #{object.class}. encountered error:" $!..split("\n").each { |l| logger.error "\t#{l}" } raise rescue UnableToAuthenticateError logger.error "Unable to authenticate with MAuth. encountered error:" $!..split("\n").each { |l| logger.error "\t#{l}" } raise end |