Class: Heroku::Samorau::SsoCheck
- Includes:
- HTTP
- Defined in:
- lib/heroku/samorau.rb
Instance Attribute Summary
Attributes inherited from Check
Instance Method Summary collapse
Methods included from HTTP
#delete, #get, #post, #request
Methods inherited from ApiCheck
Methods inherited from Check
#call, #check, #error, #initialize, #run, #test, #to_proc
Constructor Details
This class inherits a constructor from Heroku::Samorau::Check
Instance Method Details
#call! ⇒ Object
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/heroku/samorau.rb', line 457 def call! sso = Sso.new(data) t = Time.now.to_i test "GET #{sso.path}" check "validates token" do code, _ = get(sso.path, { :token => 'invalid', :timestamp => t }) error("expected 403, got #{code}") if code != 403 true end check "validates timestamp" do prev = (Time.now - 60*6).to_i code, _ = get(sso.path, { :token => sso.make_token(prev), :timestamp => prev }) error("expected 403, got #{code}") if code != 403 true end check "logs in" do code, _ = get(sso.path, { :token => sso.make_token(t), :timestamp => t }) error("expected 200, got #{code}") if code != 200 true end end |