Questions tagged [warden]

Warden is a Rack-based middleware, designed to provide a mechanism for authentication in Ruby web applications. It is a common mechanism that fits into the Rack Machinery to offer powerful options for authentication. Warden is designed to be lazy. That is, if you don’t use it, it doesn’t do anything, but when you do use it, it will spring into action and provide an underlying mechanism to allow authentication in any Rack-based application.

warden
Filter by
Sorted by
Tagged with
0 votes
1 answer
677 views

How to sign in without warden callback on rspec (request spec)

I'd like to call sign_in(user) on request spec without warden callback. Does anybody know a workaround? I want to use something like bypass_sign_in on request spec. I tried below. I added Devise::...
0 votes
1 answer
862 views

Unable to perform Enqueue now in sidekiq-cron UI after authentication

I am using sidekiq gem to process the background jobs and sidekiq-cron to schedule the jobs at certain time interval. In config/routes.rb, I have added the following to provide authentication to ...
2 votes
1 answer
1k views

Rails 5 Integration test fails with NoMethodError: undefined method `[]=' for nil:NilClass when using Devise helper sign_in

I'm writing an integration test for Rails v5.1 using built-in Minitest. Here's the integration test class: require 'test_helper' class PuppiesEndpointsTest < ActionDispatch::IntegrationTest ...
2 votes
1 answer
1k views

Sessions not persisting in Rails 5.2 integration tests

I have a multi-tenant app that uses Apartment for postgreSQL schemas and Devise for user authentication. Everything is running smoothly until I attempt to write some integration tests. Here is a ...
13 votes
2 answers
13k views

What is last_sign_in_at used for in Devise?

A standard User column in Devise is last_sign_in_at, which holds the previous value of current_sign_in_at when current_sign_in_at is updated. Does last_sign_in_at have any utility for Devise's core ...
53 votes
3 answers
18k views

Why is my RSpec not loading Devise::Test::ControllerHelpers?

I'm using Rails 5, and Devise 3.5.1. Going through a nice (older) book about creating/testing an API, which uses Devise authentication. It was written before Rails 5, so I chose not to use the new ...
11 votes
2 answers
2k views

Allow unconfirmed users to access certain pages which require authentication

I use the Rails Stack with devise warden confirmable Now I have a certain requirement related to email confirmation and access provision to unverified users. Let's say there are 3 categories of ...
3 votes
2 answers
6k views

How to structure authenticated routes when using Devise?

In my question How to have root view when user is not logged in rails? max answered that we can use authenticated to make routes available only when someone is authenticated. I am having a probem that ...
10 votes
2 answers
10k views

Undefined method failure_app for nil:NilClass

I am trying to use devise from a Rails app to grant access to a Sinatra application within the Rack middleware. My config/routes.rb has: authenticate "admin" do mount Admins::Dashboard, :at => "...
10 votes
5 answers
6k views

Devise: rememberable means that last_sign_in_at is not updated by trackable

I have being using Devise, and relying on last_sign_in_at of the user model to work out if my customers have not returned within X days. However, I recently discovered that last_sign_in_at is only ...
13 votes
2 answers
14k views

RSpec, authenticating Devise user in request specs

I'm trying to write RSpec request specs in order to test my service API and for that I need the user to be authenticated. I found some examples on the net but nothing works, for the moment I'm stuck ...
1 vote
1 answer
501 views

rails session store sets cookie with wrong domain

We are using rails with devise to provide user authentication. Recently we changed the domain of the cookie_store in the session_store configuration to .example.com. Everything worked as expected, the ...
1 vote
0 answers
126 views

How to switch from Sqlite to Postgres while installing Warden on Sinatra on Heroku

This is partly a problem-solving question, partly a "I'm trying to understand what's going on" question. I hope that's allowed. Basically, I'm trying to get Warden user authentication to work with ...
8 votes
2 answers
2k views

How use Aplication.renderer.render from rails 5 with devise

I want to make my app in real time This is my error ActionView::Template::Error (Devise could not find the Warden::Proxy instance on your request environment. Make sure that your application is ...
1 vote
1 answer
282 views

How to view the call stack when an object is thrown in Ruby

The warden gem uses throw and catch functions to handle control flow. This makes it super hard to debug authentication systems, especially in devise where the gem throws the :warden symbol and the ...
0 votes
1 answer
141 views

Rails test setup causing warden's UncaughtThrowError

I'm trying to adapt a pre-devise unit test to make sure that an unconfirmed user is not logged in and is redirected to the sign in page with the devise.failure.unconfirmed message. I keep running into ...
0 votes
1 answer
2k views

Rails devise, find current_user by session_store key

We have a production system (main app) running on Rails with devise gem configured (using Redis session store)(session is enabled for all subdomain) I need to build a custom authentication service ...
12 votes
1 answer
11k views

Devise - Sign In with Ajax

Is here any possibility to modify devise SessionsController for ajax communication? Edit I found the solution, and posted it into answers, thanks
1 vote
0 answers
2k views

Devise could not find the `Warden::Proxy` in docker

I found some SO answers about this problem. I have this error when I load the web from the Docker container. I tried what's is suggested here Helper Devise: could not find the `Warden::Proxy` ...
0 votes
0 answers
1k views

runtimeError (invalid strategy some_external_strategy)

I have been trying for eternity to get my rails app to use google sign-in and calendars to no avail. I can get the google sign in page but when after I enter my password I get a runtime error when ...
2 votes
1 answer
1k views

Warden authentication is failing when I use failure app

I am having trouble authenticating using Warden (Warden only, without Devise) when I use the failure app. This error does not happen when I use Warden configured not to use the failure app. Help me! ...
3 votes
2 answers
2k views

Authenticate custom strategy without creating Devise user

My setup: Rails 3.0.9, Ruby 1.9.2, Devise 1.3.4, Warden 1.0.4 I'm trying to figure out if it possible to authenticate a custom strategy and not have to create a devise user in the process upon ...
3 votes
1 answer
208 views

In warden json parameters are not working

I am working on rails json webservices. I am using warden for authentication in that, its working fine with html format , but in json its not working. because passed parameter is not working in ...
1 vote
1 answer
981 views

Warden skips strategy

I have two warden strategies in a Rails API app, for basic authentication and for token authentication. initializers/warden.rb Warden::Strategies.add(:auth_token, AuthTokenStrategy) Warden::...
0 votes
1 answer
393 views

Sinatra::Warden undefined method `authenticated?' for nil:NilClass

I'm trying to use authentication for my Sinatra web application with Sinatra_warden module, but when I point to an authorized site, it says: NoMethodError at /admin undefined method `authenticated?' ...
1 vote
1 answer
371 views

Devise form : <input name="email"/> instead of name"user[email]"

autofill on Chrome on iOs is not working when there is <input name="user[email]"/>, only when there is <input name="email"/> Is there a way to post { email: 'xx' }, instead of { user: { ...
0 votes
0 answers
2k views

How to use Devise helper methods

I am trying to build a Rails server for my client while implementing Devise controllers, and am facing a lot of issues. When using Warden.authenticate(resource_name)! for logging purpose, I get "401 ...
5 votes
3 answers
19k views

How to authenticate using warden.authenticate!

I would like to do a 'sign-in or register' on the fly when posting a comment to my forum. I am using Devise/Warden. I want to do something like this: user = warden.authenticate!(params[:email], ...
1 vote
1 answer
722 views

How can I make tests DRY in Rails and still use Capybara and Warden? (using minitest)

My intention is to create a few tests for the same form, and in these tests I need Capybara to fill the form completely. Still, I wanted to avoid rewriting the code for filling the form. I'm not ...
2 votes
1 answer
1k views

Cannot update params when use warden.authenticate in devise

I have upgrade my rails from 3.2.8 to rails 4, also devise is upgrade from 2.1.2 to 3.5.6 and warden from 1.2.3 to 1.2.6. I found an issue that I don't know what it should belongs to devise or warden. ...
1 vote
1 answer
2k views

How to sign users in and out for testing with Rspec + Devise + FactoryGirl

I'm new to Rspec, but I've managed to put together a working (at least in my tests so far) setup that lets me test various behavior in logged in/logged out states using FactoryGirl + Devise and Warden ...
8 votes
3 answers
4k views

"uncaught throw :warden" when testing redirects for users not logged in

This is a spec for a very typical controller with a before_filter which redirects to login page when a not-logged-in user (a.k.a. a guest) tries to access /projects/new. describe ProjectsController ...
0 votes
1 answer
2k views

A way to access devise/Warden's auth cookie in a callback

I am using Warden's callback to save certain data into Cookie. This is what I have: //This is in devise.rb Warden::Manager.after_authentication do |user, auth, opts| auth.cookies[:signed_in] ...
4 votes
4 answers
1k views

How to Redirect Unconfirmed Users Using Ruby on Rails and the Devise Gem

I would like to change the user sign-in behaviour of devise in a way to redirect a user to a different page when that user is not confirmed. I have the following code in my app/controllers/...
1 vote
0 answers
73 views

Test if someone is logged out on another device

We are using Rails and Devise, and I want to test when a user changes his password, that they are logged out on every device, except for the device which he does the password change with. Manually I ...
1 vote
0 answers
2k views

Kill all user sessions after password change on Devise

When a User updates their password, I want to invalidate all their sessions (like on the phone or another browser) and give out a single new session to the current device. It seems to work if I just ...
1 vote
1 answer
800 views

How to set authentication in Sinatra?

I need simple authentication for blog. For a single person. Just login to the website Can't configure sinatra_warden. Write the line require 'rubygems' require 'sinatra' require 'pry-byebug' ...
0 votes
0 answers
76 views

undefined method authenticated? (Sinatra + Warden)

When I add the authorize! method in controller, I get an error NoMethodError - undefined method authenticated? for nil:NilClass My controller require 'rubygems' require 'sinatra' require '...
0 votes
1 answer
635 views

Devise login with computed / manipulated username param

I'm trying to create a login using devise with a username that I've computed. As an example, let's assume we want to namespace our usernames - and I want to receive a username from the login form, and ...
0 votes
2 answers
2k views

Checking If Devise User Logged In In Application Layout

I am trying to use the application.html.erb file to create a navbar on all of my pages. I want some of the links to only show if a user is logged in, and some to show if a user is not logged in, so I ...
4 votes
3 answers
3k views

Testing Devise session timeout with RSpec

I'd like to customize the time period after which my Rails app will automatically end a user's session. I found this question to give me exactly what I need, but I'd like to approach this through TDD....
0 votes
0 answers
63 views

When authenticated using API, Devise redirects to its default login view page every second time on failure

I am using token based authentication system for my APIs which is built based on Devise. The user is authorised to access the pages only when the email and mobile number linked with his/her account ...
5 votes
2 answers
859 views

Warden :renew option

I'm using devise (1.5.3) and warden (1.1.1) and I don't need to renew session_id after user login/registration https://github.com/hassox/warden/blob/master/lib/warden/proxy.rb#L160 if opts[:store] ...
9 votes
1 answer
5k views

Rails test - checking if user is signed in with Devise

I am trying to test that someone is able to login to my site by making a POST request to my SessionsController. I've seen this way recommended in a few places: it 'must be able to sign in a user' do ...
0 votes
3 answers
2k views

starting warden after zookeeper of MapR

I am installing the MapR and I stucked at starting warden after start zookeeper on a single node. # service mapr-warden start Error: warden can not be started. See /opt/mapr/logs/warden.log for ...
9 votes
4 answers
9k views

How to access session from Warden/Devise after_authentication callback in Rails

I'm trying to access the current session from Warden's after_authenticate callback (running underneath Devise) in Rails 3. At the top of my application controller I want to do something like: Warden:...
1 vote
1 answer
1k views

Why isn't Warden using all of the default strategies?

I'm migrating a Rails 3.2 app to greener (higher numbered) pastures. AuthLogic, which served me well forever, apparently doesn't work in 4. So I'm transitioning to Warden. The warden.rb file below ...
0 votes
1 answer
429 views

Does Warden manage sessions?

I've created a login app in Sinatra and authenticated with Warden. I can login, logout, manage protected page using Warden, but can't access my session information afterwards. Why is that? Is Warden ...
7 votes
4 answers
7k views

Devise warden error thrown for authenticate_user in functional Rails test

I have a resource where the new action requires a user to be logged in to view. If a user tries to create a new resource without being logged in, they are redirected (302'd) to the login page. My ...
0 votes
0 answers
3k views

Rails + Devise -> clearing session cookie

I got a situation like this: using Rails 4 + Devise I log out user, during that I got my chrome developer tools opened and check in Network what headers are flying around. The thing that interests ...