Module: GorillaProxy::CurrentTokenHelper

Included in:
ApplicationController
Defined in:
app/helpers/gorilla_proxy/current_token_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_tokenObject



21
22
23
# File 'app/helpers/gorilla_proxy/current_token_helper.rb', line 21

def current_token
  @current_token ||= GorillaProxy::Token.new(gorilla_token)
end

#forget_token!Object



16
17
18
19
# File 'app/helpers/gorilla_proxy/current_token_helper.rb', line 16

def forget_token!
  cookies.delete(token_session_key)
  @current_token = nil
end

#gorilla_tokenObject



4
5
6
# File 'app/helpers/gorilla_proxy/current_token_helper.rb', line 4

def gorilla_token
  cookies.signed[token_session_key]
end

#remember_token!(token) ⇒ Object



8
9
10
11
12
13
14
# File 'app/helpers/gorilla_proxy/current_token_helper.rb', line 8

def remember_token!(token)
  @current_token = nil
  cookies.signed[token_session_key] = {
    value: token,
    expires: 1.year.from_now
  }
end