httpAuth weird behaviour

31 views
Skip to first unread message

sebastian....@gmail.com

unread,
Jun 15, 2016, 10:38:33 AM6/15/16
to Lift
 
Hi,
i tried to add httpAuth to a website to have a version online which can be reviewed by a client.
However it behaves rather odd,by requiring multiple reloads on local dev to kick in, while it does not work at all in deployment mode.

This is the code:

LiftRules.httpAuthProtectedResource.prepend{
 
case _ => Full(AuthRole("admin"))
}

LiftRules.authentication = HttpBasicAuthentication("Authenticate Yourself") {
 
case("admin","whatever",req) => {
   logger
.info("Authentication Succeeded...Welcome!!")
   userRoles
(AuthRole("admin"))
   
true
 
}
}
   

The app is deployed on red hat cloud on jetty no idea why it does not work.

It would be nice, to have this behave the other way around ;)

Antonio Salazar Cardozo

unread,
Jun 16, 2016, 2:22:54 PM6/16/16
to Lift
How are you testing this? Can you perhaps post a sample project (https://app.assembla.com/wiki/show/liftweb/Posting_example_code) for us?

Last but not least, what happens if you add a `case other` and print what you're getting in
the authentication partial function? Is the value what you're expecting?
Thanks,
Antonio

sebastian....@gmail.com

unread,
Jun 18, 2016, 6:07:42 AM6/18/16
to Lift
Well i think i found the culprit...
Those red hat cloud free gears are rather crappy and get shut down constantly for whatever reason.
And since the ssh connection get dropped as well you will hardly ever notice it.

It just kills the build process half the time and thus i never got the project recompiled.
I still added that second case to log failed login attempts seems to be a good idea anyway.

Why i got problems on the local dev i can not replicate maybe some browser caching but it works fine now.
Thanks for your help :)

Antonio Salazar Cardozo

unread,
Jun 19, 2016, 10:27:10 AM6/19/16
to Lift
Sweet, excited you got that figured out! Sounds like a really nasty one haha—unfriendly
builds are the worst!
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages