Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-18 Thread Chas Emerick
If you're being redirected to: http://localhost:4/login?&login_failed=Y&username=lawrence Then the problem is that you're not using the credentials for one of the users you've specified (e.g. "root" or "jane"). - Chas On Jan 17, 2013, at 1:43 PM, larry google groups wrote: > > Ho

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-17 Thread larry google groups
How should I debug this? What questions should I ask? At this point, for the sake of debugging, I have everything in one file, in one name space. I have recreated the dummy users database: (def users {"root"{:username "lawrence" :password (creds/hash-bcrypt "admin_password")

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread Chas Emerick
On Jan 16, 2013, at 12:03 PM, larry google groups wrote: > I am ignorant about the implications of using :: to namespace vars. > The fact that I have ::admin in one namespace: > >:users {"root"{:username "lawrence" > :password (creds/hash-bcrypt "admin_password") >

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
I am ignorant about the implications of using :: to namespace vars. The fact that I have ::admin in one namespace:    :users {"root"{:username "lawrence"                   :password (creds/hash-bcrypt "admin_password")                   :roles #{::admin}                   :created_at "2013-01-08 1

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
I am getting closer, I think. I changed the keys from keywords to strings and that seemed to let me login. But if I go to /logout, I get: 2013-01-16 11:37:25.875:WARN:oejs.AbstractHttpConnection:/logout java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentMap

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
Oh, I think I figured this out. I re-read this: https://github.com/cemerick/friend/#authentication And I see the keys here are strings: (def users {"root" {:username "root" :password (creds/hash-bcrypt "admin_password") :roles #{::admin}} "jane

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
I realize this is name space qualified: ::admin ::user I'm actually referencing these in my core namespace, though the user info is defined in (def fake-data ;; big map of fake data) which is in a different name space. I am not sure how that would effect the way Friend interprets the data. On

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
> > You're still not using wrap-keyword-params. > Thanks. I changed the routes so I now have: (def app (-> app-routes (friend/authenticate {:credential-fn (partial creds/bcrypt- credential-fn (:users @interactions)) :workflows [(workflows/interactive- for

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread Chas Emerick
On Jan 16, 2013, at 9:07 AM, larry google groups wrote: > > I define a var with user info like this: > > (ns kiosks-clojure.fake-data-for-development > (:require [cemerick.friend :as friend] >(cemerick.friend [workflows :as workflows] > [credentials :as c

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
I define a var with user info like this: (ns kiosks-clojure.fake-data-for-development (:require [cemerick.friend :as friend] (cemerick.friend [workflows :as workflows] [credentials :as creds]))) (def fake-data { :users {:root {:username "la...@wonde

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
I define a var with user info like this: (ns kiosks-clojure.fake-data-for-development (:require [cemerick.friend :as friend] (cemerick.friend [workflows :as workflows] [credentials :as creds]))) (def fake-data { :users {:root {:username "la...@wonde

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread larry google groups
> > Are you using the keyword-params middleware?  It's not in the code you > initially provided, and you don't mention adding it after seeing the note > about it being required.  If you are submitting a value for the >`username` parameter to /login, but the failure redirect does not echo >that user

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-16 Thread Chas Emerick
On Jan 16, 2013, at 1:45 AM, larry google groups wrote: > For anyone else who might make the same mistake I did, I changed this: > > (GET "/admin" request (friend/authorize #{::admin} (admin > request))) > > to this: > > (GET "/admin" request (friend/authorize #{::admin} {} (admin > request)

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-15 Thread larry google groups
For anyone else who might make the same mistake I did, I changed this: (GET "/admin" request (friend/authorize #{::admin} (admin request))) to this: (GET "/admin" request (friend/authorize #{::admin} {} (admin request))) adding an empty map before the string that is my actual HTML page. Th

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-15 Thread larry google groups
Looking here: https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj I see in the stacktrace that the problem seems to be with the last line of this function: (defn default-unauthenticated-handler [request] (-> request ::auth-config :login-uri (util/resolve-absol

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-15 Thread larry google groups
Reading here: https://github.com/cemerick/friend I see this: (Note that Friend itself requires some core Ring middlewares: params, keyword-params and nested-params. I did not have nested-params so I will add this. This might be a stupid question, but why doesn't Friend include the Ring middlew