Class: OmniAuth::Shopify::OAuthSession

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/shopify/oauth_session.rb

Constant Summary collapse

EXPIRES =
'_encrypted_cookie_expires_'
KEY =
'shopify_oauth_session'

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ OAuthSession

Returns a new instance of OAuthSession.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/omniauth/shopify/oauth_session.rb', line 12

def initialize(app, options={})
  @app = app
  @key = options[:key] || KEY
  @secret = options[:secret]
  fail "Error! A secret is required to use encrypted cookies. Do something like this:\n\nuse OmniAuth::Shopify::OauthSession, :secret => YOUR_VERY_LONG_VERY_RANDOM_SECRET_KEY_HERE" unless @secret
  @default_options = {:domain => nil,
    :path => "/",
    :time_to_live => 1800,
    :expire_after => nil}.merge(options)
  @encryptor = Encryptor.new(@secret)
end

Instance Method Details

#call(env) ⇒ Object



24
25
26
27
28
# File 'lib/omniauth/shopify/oauth_session.rb', line 24

def call(env)
  load_session(env)
  status, headers, body = @app.call(env)
  commit_session(env, status, headers, body)
end