Skip to content

Set failure_app per scope, instead of failure_action? #40

@JeanMertz

Description

@JeanMertz

I was wondering if it's possible to set the failure_app per scope.

This is my current setup:

Rails.application.config.middleware.use Warden::Manager do |config|
  config.failure_app = lambda { |env| SessionsController.action(:new).call(env) }
  config.default_scope = :user

  config.scope_defaults :backend,   strategies: [:password], store: true, action: :backend_new
  config.scope_defaults :frontend,  strategies: [:password], store: true, action: :frontend_new

end

However, keeping everything REST-ful and since the scenario's of logging in from the backend or the frontend differ a lot, I'd rather be able to set the failure app to Backend::SessionsController.action(:new) for one scope, and Frontend::SessionsController.action(:new) for the other.

Is this possible, and if not, is there a reason for this, am I trying to solve this problem the wrong way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions