Class: NulogySSO::CookieTokenStore
- Inherits:
-
Object
- Object
- NulogySSO::CookieTokenStore
- Defined in:
- app/services/nulogy_sso/cookie_token_store.rb
Overview
A class for storing the SSO token in cookies
This uses the Rack level API instead of going through the Rails API because we have found that for our GraphQL based applications, using the cookiejar API has not been working. The cookies are not being set correctly, likely because the requests are resulting in 302 redirects.
Instance Method Summary collapse
- #fetch ⇒ Object
- #forget! ⇒ Object
-
#initialize(request, response) ⇒ CookieTokenStore
constructor
A new instance of CookieTokenStore.
- #store!(access_token_value) ⇒ Object
Constructor Details
#initialize(request, response) ⇒ CookieTokenStore
Returns a new instance of CookieTokenStore.
9 10 11 12 |
# File 'app/services/nulogy_sso/cookie_token_store.rb', line 9 def initialize(request, response) @request = request @response = response end |
Instance Method Details
#fetch ⇒ Object
14 15 16 |
# File 'app/services/nulogy_sso/cookie_token_store.rb', line 14 def fetch @request.[NulogySSO.] end |
#forget! ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/services/nulogy_sso/cookie_token_store.rb', line 30 def forget! @response.( NulogySSO., path: "/", domain: all_domains ) end |
#store!(access_token_value) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/nulogy_sso/cookie_token_store.rb', line 18 def store!(access_token_value) @response.( NulogySSO., value: access_token_value, path: "/", domain: all_domains, expires: 36_000.seconds.from_now, # TODO: Fetch this value from the JWT httponly: true, secure: @request.ssl? ) end |