Class: Pebblebed::Security::Client
- Inherits:
-
Object
- Object
- Pebblebed::Security::Client
- Defined in:
- lib/pebblebed/security/client.rb
Constant Summary collapse
- IDENTITY_MEMBERSHIPS_TTL =
TTL is reset for every cache hit, so actual TTL might be much longer as long as the user keeps hitting that cache.
7
Instance Method Summary collapse
-
#access_data_for(identity) ⇒ Object
Returns an object representing the current access data for a given identity.
-
#initialize(connector) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(connector) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/pebblebed/security/client.rb', line 9 def initialize(connector) @connector = connector @access_data = {} # Memoized identity access data records end |
Instance Method Details
#access_data_for(identity) ⇒ Object
Returns an object representing the current access data for a given identity
15 16 17 18 19 20 21 22 |
# File 'lib/pebblebed/security/client.rb', line 15 def access_data_for(identity) identity = identity.id unless identity.is_a?(Numeric) return @access_data[identity] if @access_data[identity] membership_data = fetch_membership_data_for(identity) result = Pebblebed::Security::AccessData.new(membership_data) @access_data[identity] = result result end |