OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/open_project/authentication/manager.rb

43 lines
980 B

module OpenProject
module Authentication
class Manager < Warden::Manager
serialize_into_session do |user|
user.id
end
serialize_from_session do |id|
User.find id
end
10 years ago
def initialize(app, options = {}, &configure)
block = lambda do |config|
self.class.configure config
configure.call config if configure
end
super app, options, &block
end
class << self
def scope_strategies
@scope_strategies ||= {}
end
def store_defaults
@store_defaults ||= Hash.new false
end
def configure(config)
config.default_strategies :session
config.failure_app = OpenProject::Authentication::FailureApp.new
scope_strategies.each do |scope, strategies|
config.scope_defaults scope, strategies: strategies, store: store_defaults[scope]
end
end
end
end
end
end