[dancer-users] Dancer2 Authentication Problem
CHONG Yu Meng
yumeng.chong at invictus.com.sg
Thu Jul 13 15:24:15 BST 2017
Hi all,
Still learning Dancer2. Managed to get the database part working, but now I have a strange authentication problem - probably something I am missing.
I want to password protect several routes:
/secret
/secretpg1
/secretpg2
In config.yml, I have configured just one user, who should be able to access all the above routes:
engines:
session:
YAML:
cookie_name: invictus.session
is_secure: 1
is_http_only: 1
plugins:
Auth::Extensible:
realms:
config:
provider: Config
users:
- user: 'joeblow'
pass: 'sikrit123'
name: 'Joe Blow'
roles:
- Marketing
In my Dancer2 code, I have this:
get '/secret' => require_login sub { 'You are logged in as user: ' . logged_in_user->{name} };
get '/secretpg1' => require_login sub { 'This is page 1.'; };
get '/secretpg2' => require_login sub { 'This is page 2.'; };
If I go to /secret, I will get the default login page.
If I then go to /secretpg1, I thought I would get the page without having to login again, but I get redirected to the default login page again. If I login successfully then go to /secretpg2, I get asked to login again.
What am I doing wrong here? Is there some additional configuration? I suspect there is something wrong with my config.yml, but I cannot find any information on Google that helps. All the examples I see have only one route. Help!
Thanks in Advance!
pascal chong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20170713/d0c66e6b/attachment.html>
More information about the dancer-users
mailing list