class OmniAuth::Strategies::WIND
Constants
- AuthHashSchemaKeys
As required by github.com/intridea/omniauth/wiki/Auth-Hash-Schema
Attributes
raw_info[RW]
user_info[RW]
Public Instance Methods
append_params(base, params)
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 156 def append_params(base, params) params = params.each { |k,v| v = Rack::Utils.escape(v) } Addressable::URI.parse(base).tap do |base_uri| base_uri.query_values = (base_uri.query_values || {}).merge(params) end.to_s end
callback_phase()
click to toggle source
Calls superclass method
# File lib/omni_auth/strategies/wind.rb, line 124 def callback_phase if on_sso_path? single_sign_out_phase else @ticket = request.params['ticketid'] return fail!(:no_ticket, MissingWINDTicket.new('No WIND Ticket')) unless @ticket fetch_raw_info(@ticket) return fail!(:invalid_ticket, InvalidWINDTicket.new('Invalid WIND Ticket')) if raw_info.empty? super end end
extract_url()
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 99 def extract_url url = Addressable::URI.parse(options.delete('url')) options.merge!( 'host' => url.host, 'port' => url.port, 'path' => url.path, 'ssl' => url.scheme == 'https' ) end
login_url(service)
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 77 def login_url(service) wind_url + append_params(options.login_url, { destination: service, service: options.service }) end
logout_url(service)
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 80 def logout_url(service) wind_url + append_params(options.logout_url, { destination: service}) end
on_sso_path?()
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 148 def on_sso_path? request.post? && request.params.has_key?('logoutRequest') end
request_phase()
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 135 def request_phase service_url = append_params(callback_url, return_url) [ 302, { 'Location' => login_url(service_url), 'Content-Type' => 'text/plain' }, ["You are being redirected to WIND for sign-in."] ] end
service_validate_url(service_url, ticket)
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 115 def service_validate_url(service_url, ticket) service_url = Addressable::URI.parse(service_url) service_url.query_values = service_url.query_values.tap { |qs| qs.delete('ticketid') } r = wind_url + append_params(options.service_validate_url, { ticketid: ticket }) r end
single_sign_out_phase()
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 152 def single_sign_out_phase logout_request_service.new(self, request).call(options) end
validate_service_ticket(ticket)
click to toggle source
Validate the Service Ticket @return [Object] the validated Service Ticket
# File lib/omni_auth/strategies/wind.rb, line 165 def validate_service_ticket(ticket) OmniAuth::Strategies::WIND::ServiceTicketValidator.new(self, options, callback_url, ticket).call end
validate_wind_setup()
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 109 def validate_wind_setup if options.host.nil? || options.login_url.nil? raise ArgumentError.new(":host and :login_url MUST be provided") end end
wind_url()
click to toggle source
Build a WIND
host with protocol and port
# File lib/omni_auth/strategies/wind.rb, line 86 def wind_url extract_url if options['url'] validate_wind_setup @wind_url ||= begin uri = Addressable::URI.new uri.host = options.host uri.scheme = options.ssl ? 'https' : 'http' uri.port = options.port uri.path = options.path uri.to_s end end
Private Instance Methods
fetch_raw_info(ticket)
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 171 def fetch_raw_info(ticket) ticket_user_info = validate_service_ticket(ticket).user_info custom_user_info = options.fetch_raw_info.call(self, options, ticket, ticket_user_info) self.raw_info = ticket_user_info.merge(custom_user_info) end
logout_request_service()
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 195 def logout_request_service LogoutRequest end
prune!(hash)
click to toggle source
Deletes Hash pairs with `nil` values. From github.com/mkdynamic/omniauth-facebook/blob/972ed5e3456bcaed7df1f55efd7c05c216c8f48e/lib/omniauth/strategies/facebook.rb#L122-127
# File lib/omni_auth/strategies/wind.rb, line 179 def prune!(hash) hash.delete_if do |_, value| prune!(value) if value.is_a?(Hash) value.nil? || (value.respond_to?(:empty?) && value.empty?) end end
return_url()
click to toggle source
# File lib/omni_auth/strategies/wind.rb, line 186 def return_url # If the request already has a `url` parameter, then it will already be appended to the callback URL. if request.params && request.params['url'] {} else { url: request.referer } end end