Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 551 Bytes

warden.md

File metadata and controls

20 lines (15 loc) · 551 Bytes

Using Warden

Warden is a rack middleware that allows you to put hooks in for authentication with multiple rack applications. Here is how I set up the config for an app using invitations:

# config/initializers/warden.rb

WhiteBoardV2::Application.middleware.use Warden::Manager

Warden::Manager.after_set_user do |user, auth, opts|
  invitation = auth.request.session[:invitation_token]
  if invitation.present?
    TeamInvitations::Redemption.new(user, invitation).persist!
    auth.request.session[:invitation_token] = ''
  end
end