module UserPlane::OmniAuth
Public Class Methods
callback_path_criteria_for(provider)
click to toggle source
# File lib/user_plane/omniauth.rb, line 15 def self.callback_path_criteria_for provider lambda do |env| path_parameters = env["action_dispatch.request.path_parameters"] path_parameters[:action] == 'oauth_callback' end end
custom_path(env)
click to toggle source
# File lib/user_plane/omniauth.rb, line 22 def self.custom_path env path_parameters = env["action_dispatch.request.path_parameters"] custom_callback_path = path_parameters.merge(action: 'oauth_callback', only_path: true) env['action_dispatch.routes'].url_for custom_callback_path end
middleware(&block)
click to toggle source
Configures the omniauth middleware for the application
# File lib/user_plane/omniauth.rb, line 30 def self.middleware &block controllers = [User::SignInsController, User::SignUpsController, User::InvitesController] controllers.each do |controller| controller.middleware.use Builder, &block end end
request_path_criteria_for(provider)
click to toggle source
Lets actiondispatch figure out the request path. Looks like request_path needs to return the callback path to generate the correct link
# File lib/user_plane/omniauth.rb, line 8 def self.request_path_criteria_for provider lambda do |env| path_parameters = env["action_dispatch.request.path_parameters"] path_parameters[:action] == 'oauth_request' && UserPlane::OmniAuth.custom_path(env) end end