Skip to content
gakuzzzz edited this page Dec 26, 2012 · 2 revisions

Play2.x module for Authentication and Authorization

This module offers Authentication and Authorization features to Play2.x applications

Target

This module targets the Scala version of Play2.x.

For the Java version of Play2.x, there is an authorization module called Deadbolt 2.

This module has been tested on Play2.1-RC1 and Play2.0.4.

Motivation

Play2.x's Existing Security trait

The existing Security trait in Play2.x API does not define an identifier that identifies a user.

If you use an Email or a userID as an identier, users can not invalidate their session if the session cookie is intercepted.

This module creates a unique SessionID using a secure random number generator. Even if the sessionId cookie is intercepted, users can invalidate the session by logging in again. Your application can expire sessions after a set time limit.

Flexiblity

Since the Security trait in Play2.x API returns Action, complicated action methods wind up deeply nested.

Play2x-Auth provides an interface that returns an Either[PlainResult, User] making writing complicated action methods easier. Either is a wrapper similar to Option