Class: OmniAuth::Strategies::FacebookSignup::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/strategies/facebook_signup/configuration.rb

Constant Summary collapse

DEFAULT_LOGIN_URL =
"%s/auth/facebook/prerequest"
DEFAULT_SERVICE_VALIDATE_URL =
"%s/serviceValidate"

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Configuration

Returns a new instance of Configuration.

Parameters:

  • params (Hash)

    configuration options

Options Hash (params):

  • :cas_server (String, nil)

    the CAS server root URL; probably something like ‘cas.mycompany.com` or `cas.mycompany.com/cas`; optional.

  • :cas_login_url (String, nil) — default: :cas_server + '/login'

    the URL to which to redirect for logins; options if ‘:cas_server` is specified, required otherwise.

  • :cas_service_validate_url (String, nil) — default: :cas_server + '/serviceValidate'

    the URL to use for validating service tickets; optional if ‘:cas_server` is specified, requred otherwise.



21
22
23
# File 'lib/omniauth/strategies/facebook_signup/configuration.rb', line 21

def initialize(params)
  parse_params params
end

Instance Method Details

#login_url(service) ⇒ String

Build a CAS login URL from service.

Parameters:

  • service (String)

    the service (a.k.a. return-to) URL

Returns:



30
31
32
# File 'lib/omniauth/strategies/facebook_signup/configuration.rb', line 30

def (service)
  append_service @login_url, service
end

#service_validate_url(service, ticket) ⇒ String

Build a service-validation URL from service and ticket. If service has a ticket param, first remove it. URL-encode service and add it and the ticket as paraemters to the CAS serviceValidate URL.

Parameters:

  • service (String)

    the service (a.k.a. return-to) URL

  • ticket (String)

    the ticket to validate

Returns:



43
44
45
46
47
# File 'lib/omniauth/strategies/facebook_signup/configuration.rb', line 43

def service_validate_url(service, ticket)
  service = service.sub(/[?&]ticket=[^?&]+/, '')
  url = append_service(@service_validate_url, service)
  url << '&ticket=' << Rack::Utils.escape(ticket)
end