Skip to content

Authenticate CypressOnRails commands #137

Open
@RomainEndelin

Description

@RomainEndelin

Would it be possible to perform authentication on CypressOnRails Commands?

There is a workaround: by injecting another middleware before cypress_on_rails, checking for the /__e2e__/command route and performing authentication.

But it would be great if we could configure it directly in Cypress On Rails 🙏 . One idea would be to accept a before_request block:

CypressOnRails.configure do |c|
  # ...

  c.before_request = lambda { |request|
    if !request.env['warden'].authenticate(:secret_key)
      [403, {}, ["forbidden"]]
    end

    return request.env
  }
end

This block would be executed as part of the CypressOnRails middleware.

If you like the idea, I'm happy to open a PR 🙂

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