class OmniAuth::Strategies::Crowd
Public Class Methods
new(app, options = {}, &block)
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/crowd.rb, line 11 def initialize(app, options = {}, &block) options.symbolize_keys!() super(app, {:name=> :crowd}.merge(options), &block) @configuration = OmniAuth::Strategies::Crowd::Configuration.new(options) end
Protected Instance Methods
auth_hash()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/crowd.rb, line 48 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => @user_info.delete("user"), 'info' => @user_info }) end
callback_phase()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/crowd.rb, line 37 def callback_phase creds = session.delete 'omniauth.crowd' return fail!(:no_credentials) unless creds validator = CrowdValidator.new(@configuration, creds['username'], creds['password']) @user_info = validator.user_info return fail!(:invalid_credentials) if @user_info.nil? || @user_info.empty? super end
get_credentials()
click to toggle source
# File lib/omniauth/strategies/crowd.rb, line 30 def get_credentials OmniAuth::Form.build(:title => (options[:title] || "Crowd Authentication")) do text_field 'Login', 'username' password_field 'Password', 'password' end.to_response end
request_phase()
click to toggle source
# File lib/omniauth/strategies/crowd.rb, line 19 def request_phase if env['REQUEST_METHOD'] == 'GET' get_credentials elsif (env['REQUEST_METHOD'] == 'POST') && (not request.params['username']) get_credentials else session['omniauth.crowd'] = {'username' => request['username'], 'password' => request['password']} redirect callback_url end end