yetu / oauth2-resource-server

scala / playframework library for creation of OAuth2 Resource Servers with the yetu OAuth2 Provider server.

Version Matrix

OAuth2 Resource Server library

Contains re-usable code for access token validation with the yetu oauth2provider server.

Currently (October 2014) the process of registering an app with yetu is not yet supported for people outside the yetu organization - but we want to change this soon. Also, we intend on open-sourcing our oauth2-provider implementation in the upcoming months, then you would be able to use both projects for your own use. Until that is done, this library will be only of limited use outside of yetu.

The main feature is the Authorized playframework action that validates with a configurable oauth2 provider (currently only yetu's oauth2provider is supported) whether a given access token is valid:

# conf/routes
GET     /                           @controllers.Application.index
import com.yetu.oauth2resource.actions.Authorized

class Application(auth: Authorized) extends Controller {

  def index = auth.async {
    Future.successful(Ok("Great! The access token you provided was correct."))

call with:



Since we use JWT in the project that validates tokens against public key from we cache public key in memory. If you change it, please restart server with app using this library.

Versions and dependencies

This library is cross-compiled against Scala 2.10.4 and 2.11.2

It uses the Play 2.3.5 version plugin, and macwire for dependency injection.

How to use this library


The best way is to have a look at the sample project, located in the sampleOAuth2ResourceServer sub folder.

Specifically have a look at these configuration files:

As well as into the code structure of the sampleOAuth2ResourceServer/app/controllers.Application and the sampleOAuth2ResourceServer/app/registry.MyRegistry classes.

###More about JWT

Used library JWT general info


We use the MIT license. See license for details.

How to develop locally / contribute to this library

See contributing for details on running the project, contributing, and releasing new versions.