Class: SignIn::AccessTokenAudienceGenerator
- Inherits:
-
Object
- Object
- SignIn::AccessTokenAudienceGenerator
- Defined in:
- app/services/sign_in/access_token_audience_generator.rb
Constant Summary collapse
- SHARED_SESSION_CLIENT_IDS_CACHE_KEY =
'sis_shared_sessions_client_ids'
Instance Attribute Summary collapse
-
#client_config ⇒ Object
readonly
private
Returns the value of attribute client_config.
Instance Method Summary collapse
- #generate_audience ⇒ Object private
-
#initialize(client_config:) ⇒ AccessTokenAudienceGenerator
constructor
A new instance of AccessTokenAudienceGenerator.
- #perform ⇒ Object
- #shared_session_client_ids ⇒ Object private
Constructor Details
#initialize(client_config:) ⇒ AccessTokenAudienceGenerator
Returns a new instance of AccessTokenAudienceGenerator.
7 8 9 |
# File 'app/services/sign_in/access_token_audience_generator.rb', line 7 def initialize(client_config:) @client_config = client_config end |
Instance Attribute Details
#client_config ⇒ Object (readonly, private)
Returns the value of attribute client_config.
17 18 19 |
# File 'app/services/sign_in/access_token_audience_generator.rb', line 17 def client_config @client_config end |
Instance Method Details
#generate_audience ⇒ Object (private)
19 20 21 22 23 |
# File 'app/services/sign_in/access_token_audience_generator.rb', line 19 def generate_audience return shared_session_client_ids if client_config.shared_sessions? [client_config.client_id] end |
#perform ⇒ Object
11 12 13 |
# File 'app/services/sign_in/access_token_audience_generator.rb', line 11 def perform generate_audience end |
#shared_session_client_ids ⇒ Object (private)
25 26 27 28 29 |
# File 'app/services/sign_in/access_token_audience_generator.rb', line 25 def shared_session_client_ids @shared_session_client_ids ||= Rails.cache.fetch(SHARED_SESSION_CLIENT_IDS_CACHE_KEY, expires_in: 5.minutes) do ClientConfig.where(shared_sessions: true).pluck(:client_id) end end |