liberator

bostonaholic 2017-03-21T15:58:30.858118Z

what, libraries and methods, are people using for authentication?

ordnungswidrig 2017-03-21T16:01:34.957104Z

I know that buddy was used sucessfully with liberator, although it needs some glue code. In the end all you need to do is to implement the :authorized? decision to check for authorization and make sure the necessary headers are set in the response.

☝️ 1
bostonaholic 2017-03-21T16:02:14.978074Z

so it’s preferred over ring middleware?

ordnungswidrig 2017-03-21T16:03:32.018557Z

not necessarily. You can take advantage of ring middleware within liberator. Say, some authentication middleware set’s a special request attribute :auth-middleware/authorized? you can inspect that value in authorized? and act accordingly.

bostonaholic 2017-03-21T16:03:59.032287Z

ah, that makes total sense

ordnungswidrig 2017-03-21T16:04:00.032447Z

If false, return false and maybe update the context to override the middleware response.

ordnungswidrig 2017-03-21T16:04:27.046623Z

Or maybe you can just fallback to the middleware and rely on the fact it would return a 403 response

bostonaholic 2017-03-21T16:05:55.090358Z

I’m also looking into friend, but it is not making any sense to me

ordnungswidrig 2017-03-21T16:08:03.152942Z

Friend is very powerful but to my knowledge hard to integrate with liberator. If you can use it simply as a wrapper then fine. The liberator resources can ignore authentication all together and consider it handled.

bostonaholic 2017-03-21T16:08:33.167292Z

oic

bostonaholic 2017-03-21T16:09:06.183061Z

so if I chose friend, probably best to separate liberator resources from friend

ordnungswidrig 2017-03-21T16:09:17.188019Z

This post is a little aged but in general still valid: http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/

ordnungswidrig 2017-03-21T16:09:40.199059Z

Liberator at least didn’t change fundamentally in the last 3 years 😉

bostonaholic 2017-03-21T16:09:40.199283Z

I’ve been reading that, and was concerned with the age of the post

bostonaholic 2017-03-21T16:09:59.208267Z

heh, that’s true

bostonaholic 2017-03-21T16:21:02.523049Z

thanks for your help @ordnungswidrig

ordnungswidrig 2017-03-21T16:21:17.529635Z

you’re welcome 🙂