An authenticated request, i.e.
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)) } }
A principal, i.e.
A principal, i.e. an authenticated user
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.
An authenticated request, i.e. one with a valid principal