class OmniAuth::Strategies::Ews

Public Instance Methods

callback_phase() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/ews.rb, line 40
def callback_phase
  return fail!(:invalid_credentials) if !authentication_response
  super
end
request_phase() click to toggle source
# File lib/omniauth/strategies/ews.rb, line 33
def request_phase
  OmniAuth::Form.build(:title => options.title, :url => callback_path) do
    text_field 'Username', 'username'
    password_field 'Password', 'password'
  end.to_response
end

Protected Instance Methods

authentication_response() click to toggle source
# File lib/omniauth/strategies/ews.rb, line 59
def authentication_response
  unless @authentication_response
    return unless username && password && endpoint

    begin
      cli = Viewpoint::EWSClient.new endpoint, username, password, http_opts: {ssl_verify_mode: 0}
      u = cli.search_contacts(username)
      return if u.empty?
      @authentication_response = {}
      @authentication_response[:name] = u[0].name
      @authentication_response[:email] = u[0].email_address
    rescue Viewpoint::EWS::Errors::UnauthorizedResponseError => e
      return
    end
  end
  @authentication_response
end
endpoint() click to toggle source
# File lib/omniauth/strategies/ews.rb, line 47
def endpoint
  options[:endpoint]
end
password() click to toggle source
# File lib/omniauth/strategies/ews.rb, line 55
def password
  request['password']
end
username() click to toggle source
# File lib/omniauth/strategies/ews.rb, line 51
def username
  request['username']
end