Sha256: f1084d6699e1f8da3a721758c06cc1ff5ddbcdf6d010b2ce0293c9ea91761aba

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 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"], :state => request["state"])
  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

1 entries across 1 versions & 1 rubygems

Version Path
exvo-auth-0.5.0 lib/exvo_auth/strategies/non_interactive.rb