com.m3.octoparts

auth

package auth

Visibility
  1. Public
  2. All

Type Members

  1. case class AuthenticatedRequest[A](request: Request[A], principal: Principal) extends WrappedRequest[A] with Product with Serializable

    An authenticated request, i.e.

    An authenticated request, i.e. one with a valid principal

  2. trait OctopartsAuthPlugin extends Plugin

    Authentication plugin for Octoparts should implement this trait.

    Authentication plugin for Octoparts should implement this trait.

    e.g.

    class MyAuthPlugin(application: Application) extends OctopartsAuthPlugin {
    def onNotAuthenticated(request: Request[_])(implicit exec: ExecutionContext) = {
      // redirect to authentication server ...
    }
    
    def isAuthorized(authenticatedRequest: AuthenticatedRequest[_])(implicit exec: ExecutionContext) = {
      // Only authorize admin users
      Future.successful(authenticatedRequest.principal.roles.exists("admin")
    }
    
    def onUnauthorized(authenticatedRequest: AuthenticatedRequest[_])(implicit exec: ExecutionContext) = {
      Future.successful(Forbidden)
    }
    
    def onAuthenticationCallback(request:Request)(implicit exec: ExecutionContext) = {
      val nickname = ...
      Future.successful(Principal(nickname, email, roles))
    }
    }
  3. case class Principal(id: String, nickname: String, email: String, roles: Seq[String]) extends Product with Serializable

    A principal, i.e.

    A principal, i.e. an authenticated user

Value Members

  1. object Principal extends Serializable

  2. object PrincipalSessionPersistence

    Helper methods for persisting the Principal using the Play session cookie.

    Helper methods for persisting the Principal using the Play session cookie. This is the default behaviour of the auth plugin, but custom auth plugins may want to override it, e.g. to store sessions in a DB.

Ungrouped