Folks,
I see the branch for OAuth 2 support in Unfiltered, I also saw the
discussion thread (
http://groups.google.com/group/unfiltered-scala/
browse_thread/thread/2240ea72589e314e/19c5d4977d5f2938?lnk=gst&q=oauth
+2#19c5d4977d5f2938)
Can someone provide a bit more "noob-oriented" set of steps, code
snippet, or unit test which would demonstrate what's need to make a
Client Credentials flow work with this OAuth 2 server support?
In other words, say I have my service like below, now I want to add
OAuth 2 server support to it, what are the steps? I.e. how to give
access to tokens, then validate tokens at request time?
Thanks a lot
class MyService extends unfiltered.filter.Planify(
{
case GET(UFPath("/get_person")) => {
val address = Address("Bulevard", "Helsinki")
val person = Person("Joe", address, 35)
import net.liftweb.json.Serialization
implicit val formats = Serialization.formats(NoTypeHints)
new ComposeResponse(JsonContent ~>
ResponseString(Serialization.write(person)))
}
case r @ POST(UFPath("/post_person")) => {
implicit val formats = DefaultFormats
val p = JsonBody(r).extract[Person]
// println("==> got person: " + p)
ResponseString("Posted Person OK") ~> Ok
}
})