Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authenticate CypressOnRails commands #137

Open
RomainEndelin opened this issue Aug 28, 2023 · 4 comments
Open

Authenticate CypressOnRails commands #137

RomainEndelin opened this issue Aug 28, 2023 · 4 comments

Comments

@RomainEndelin
Copy link
Contributor

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 🙂

@grantspeelman
Copy link
Collaborator

I do like the idea, also like that it does not tie the code to anyone authentication solution.
We could also add to the generated code examples that cover the most basics things but it's commented out.

A PR will be most Welcomed 👍🏽

@cschambacher
Copy link

Hi @grantspeelman , I am working with @RomainEndelin and taking over from where he left.

We're glad the PR was merged, thank you so much 😄 We are wondering if a release is planned? We'd need a stable version with it so we can move forward with some of our work. Also I can help in releasing the gem if needed.

@grantspeelman
Copy link
Collaborator

released 👍🏽

@cschambacher
Copy link

@grantspeelman thank you for your quick reply and for the release! We are now using the new release successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants