Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OmniAuth initializer overridden (or documentation issue) #2128

Closed
borgand opened this issue Nov 5, 2012 · 1 comment · Fixed by #2138
Closed

OmniAuth initializer overridden (or documentation issue) #2128

borgand opened this issue Nov 5, 2012 · 1 comment · Fixed by #2138

Comments

@borgand
Copy link

borgand commented Nov 5, 2012

I have set up Devise and Omniauth with Shibboleth strategy.

All of Omniauth documentation as well as the Shibboleth strategy docs and links from Devise Omniauth overview (the wiki page itself was sole exception, but I thought it was Facebook specific) indicate that I should set up extra configuration in Omniauth initializer: config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :shibboleth, 
    :info_fields => {:email => 'mail'},
    :extra_fields => [:cn, :sn, :schacHomeOrganization],
    :debug => false
end

Devise Omniauth documentation does not highlight enough the fact that Devise actually overrides Omniauth initializing (or parts of it) and I should actually have written this into config/initializers/devise.rb:

config.omniauth :shibboleth, {:uid_field => 'eppn',
  :info_fields => {:email => 'mail', :name => 'cn', :last_name => 'sn'},
  :extra_fields => [:schacHomeOrganization],
  :debug => false
}

It took me best part of several days to figure this out, because, for some reason, the :debug option was received by omniauth-shibboleth while the others were not. That is why it did not occur to me earlier that I am configuring in the wrong place.

Is there a bug in how Devise sets up Omniauth, that the :debug option had effect but not the :info_fields and :extra_fields when written into omniauth initializer (maybe specific to shibboleth strategy only).

Or maybe this should be highlighted more strongly in the documentation that Devise takes care of all of Omniauth setup and no separate initializer is consulted.

@josevalim
Copy link
Contributor

Is there a bug in how Devise sets up Omniauth, that the :debug option had effect but not the :info_fields and :extra_fields when written into omniauth initializer (maybe specific to shibboleth strategy only).

Devise simply forward the given option, so at first it is unexpected to have it working for some, but not all.

Or maybe this should be highlighted more strongly in the documentation that Devise takes care of all of Omniauth setup and no separate initializer is consulted.

Definitely this. Could you please provide a pull request updating the docs in the appropriate place? Thanks!!

@nashby nashby mentioned this issue Nov 10, 2012
oki pushed a commit to oki/devise that referenced this issue Jan 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants