Actions
Workbench authentication process » History » Revision 13
« Previous |
Revision 13/26
(diff)
| Next »
Peter Amstutz, 11/17/2014 07:24 PM
Workbench authentication process¶
- In workbench, when the user goes to a page, it checks for a session or
?api_token=xxxin the URL for the API token. If no API token is found, the user is directed to the workbench "welcome" page. - In workbench, the "welcome" page has a "log in" button that directs the user to the API server login URL, with a
?return_to=xxxlink embedded in the URL. - In API server, the 'login' endpoint goes to
UserSessionsController#loginin the API server. This redirects to/auth/joshid?return_to=xxx - In API server,
/auth/joshidis intercepted by the OmniAuth Rack middleware and invokes thejosh_idOmniAuth strategy.- The
josh_idOmniAuth strategy is implemented inarvados/services/api/lib/josh_id.rband is a subclass ofOmniAuth::Strategies::OAuth2 - OmniAuth starts the "request_phase" of
OmniAuth::Strategies::OAuth2. This redirects to#{options[:custom_provider_url]}/auth/josh_id/authorizeusing CUSTOM_PROVIDER_URL defined inarvados/services/api/config/initializers/omniauth.rb
- The
- In sso-provider,
/auth/josh_idis routed toAuthController#authorize, and is intercepted bybefore_filter :authenticate_user!(part of the devise gem)devise :omniauthable, :omniauth_providers => [:google]configuressso-provider/app/models/user.rbauthenticate_user!is not explicitly defined but instead monkey patched into the controller indevise/lib/devise/controllers/helper.rbauthenticate_user!callswarden.authenticate!(warden/lib/warden/proxy.rb) with a scope of:user(warden is another Rack-based authentication gem)- Warden proxy tries the TokenAuthenticatable and DatabaseAuthenticatable strategies, but these strategies fail and it raises a :warden exception. This causes it to call
failure_appwhich is set up indevise/lib/devise.rbto beDevise::Delegator.new - This maps to
devise/lib/devise/failure_app.rbwhich redirects to the new_user_session_path/users/sign_inwhich routes to the SSOSessionsController#newwhich subclassesDevise::SessionsController
- In sso-provider,
SessionsController#newredirects to/users/auth/google - In sso-provider, OmniAuth intercepts
/users/auth/google- OmniAuth is configured with a path prefix of
/users/authby devise sso-provider/config/initializers/devise.rbconfigures a:open_idomniauth strategy named of 'google'- This enters the request phase at
omniauth-open-id/lib/omniauth/strategies/open_id.rb - This creates a rack layer with
Rack::OpenID.new(therack-openidgem) executes it withcall - The Rack layer passes through the request to the underlying
@appand checks for a 401 response code, if so it callsbegin_authentication begin_authenticationconstructs an::OpenID::Consumerobject and calls redirects toopen_id_redirect_url
- OmniAuth is configured with a path prefix of
Questions¶
- What is workbench's "secret_token" for?
Updated by Peter Amstutz over 11 years ago · 26 revisions