Sha256: 549c112e22c3f8a06d6d52c9c3970492d6dfb7439446c7918462d8d947cffa31

Contents?: true

Size: 723 Bytes

Versions: 3

Compression:

Stored size: 723 Bytes

Contents

class ExvoAuth::Strategies::NonInteractive < ExvoAuth::Strategies::Base
  def initialize(app, options = {})
    super(app, :non_interactive, options)
  end
  
  def request_phase(options = {})
    redirect @client.non_interactive.authorize_url(:redirect_uri => callback_url, :scope => request["scope"])
  end
  
  def callback_url
    key   = ExvoAuth::Config.callback_key
    value = request[key]
    
    if value
      super + "?" + Rack::Utils.build_query(key => value)
    else
      super
    end
  end
  
  def fail!(message_key)
    body = MultiJson.encode(:error => "Please sign in!")
    [401, { 
      "Content-Type"   => "application/json", 
      "Content-Length" => body.length.to_s 
    }, [body]]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exvo-auth-0.4.3 lib/exvo_auth/strategies/non_interactive.rb
exvo-auth-0.4.2 lib/exvo_auth/strategies/non_interactive.rb
exvo-auth-0.4.1 lib/exvo_auth/strategies/non_interactive.rb