I am using Guardian for Authentication, After Token generated All the expected results working correctly,if user logged outEnsureAuthenticated working correctly, But if i delete the user from my db directly Guardian.Plug.EnsureAuthenticated still allow him to access Protected Page How can i rectify??
My router.ex
pipeline :browser_auth do
plug Guardian.Plug.VerifySession
plug Guardian.Plug.LoadResource
plug Guardian.Plug.EnsureAuthenticated, handler: MyApp.Web.SecurityController
end
scope "/", MyApp.Web do
pipe_through [ :browser, :browser_auth ]
get "/profile/show", ProfileController, :show
end
def find_by_id(id) do
filter = %{"_id" => BSON.ObjectId.decode!(id) }
cursor = Mongo.find(:mongo, "users", filter, limit: 1)
result = Enum.to_list(cursor)
if length(result) == 1 do
struct_from_map(hd(result))
else
{:error, id}
end
end
everything works correctly, but after adding put_status(401) it shows You are being redirected., but page not redirected until i click redirected, why adding status not allow to redirect the page