Class: SAMLRequestTracker

Inherits:
Common::RedisStore show all
Defined in:
app/models/saml_request_tracker.rb

Overview

Temporarily store SAML request details, so that on a return SAML response we can lookup associated information.

For example, one use case would be for users logging in via SSOe that need to be redirected back to an external application after authentication, rather than the VA.gov home page. When a authentication request comes in, with the necessary parameter, we can use this Redis namespace to temporarily store a redirect url value so that when a matching SAML response comes back from SSOe we know where to redirect the newly authenticated user.

Constant Summary

Constants inherited from Common::RedisStore

Common::RedisStore::REQ_CLASS_INSTANCE_VARS

Instance Method Summary collapse

Methods inherited from Common::RedisStore

create, delete, #destroy, #destroyed?, exists?, #expire, find, find_or_build, #initialize, #initialize_dup, keys, #persisted?, pop, redis_key, redis_store, redis_ttl, #save!, #ttl, #update, #update!

Constructor Details

This class inherits a constructor from Common::RedisStore

Instance Method Details

#ageObject

Calculate the number of seconds that have elapsed since creation



26
27
28
# File 'app/models/saml_request_tracker.rb', line 26

def age
  @created_at ? Time.new.to_i - @created_at : 0
end

#payload_attr(attr) ⇒ Object



30
31
32
# File 'app/models/saml_request_tracker.rb', line 30

def payload_attr(attr)
  @payload&.try(:[], attr)
end

#saveObject



34
35
36
37
38
# File 'app/models/saml_request_tracker.rb', line 34

def save
  @payload ||= {}
  @created_at ||= Time.new.to_i
  super
end