com.m3.octoparts.auth

OctopartsAuthPlugin

trait OctopartsAuthPlugin extends Plugin

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))
}
}
Linear Supertypes
Plugin, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. OctopartsAuthPlugin
  2. Plugin
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def isAuthorized(authenticatedRequest: AuthenticatedRequest[_])(implicit exec: ExecutionContext): Future[Boolean]

    Whether the given principal is authorized to use the Octoparts admin UI.

    Whether the given principal is authorized to use the Octoparts admin UI.

    authenticatedRequest

    an authenticated request with a com.m3.octoparts.auth.Principal

    returns

    your decision

  2. abstract def onAuthenticationCallback(request: Request[_])(implicit exec: ExecutionContext): Future[Principal]

    Use a post-authentication callback from an external authentication provider to construct a com.m3.octoparts.auth.Principal

    Use a post-authentication callback from an external authentication provider to construct a com.m3.octoparts.auth.Principal

    returns

    a Principal constructed from the HTTP request

  3. abstract def onNotAuthenticated(request: Request[_], callbackUrl: String)(implicit exec: ExecutionContext): Future[Result]

    What action to take when a request is not authenticated, e.g.

    What action to take when a request is not authenticated, e.g. redirect to an authentication server.

    request

    The unauthenticated request

    callbackUrl

    An absolute URL that you can use for a post-authentication callback. It will include the current (relative) URL as a query parameter, e.g. "http://octoparts:9000/auth/callback?origUrl=%2Fadmin"

  4. abstract def onUnauthorized(authenticatedRequest: AuthenticatedRequest[_])(implicit exec: ExecutionContext): Future[Result]

    What action to take when a request is authenticated but the principal is not authorized.

    What action to take when a request is authenticated but the principal is not authorized.

    authenticatedRequest

    an authenticated request with a com.m3.octoparts.auth.Principal

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def enabled: Boolean

    Definition Classes
    Plugin
  7. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  13. def loadPrincipal(request: Request[_])(implicit exec: ExecutionContext): Future[Option[Principal]]

    Try to extract a Principal from the session.

    Try to extract a Principal from the session. The default implementation extracts the JSON-serialized Principal from the Play session cookie.

  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. def onLogout(request: Request[_], result: Result): Future[Result]

    When the user logs out, they are redirected to the top page.

    When the user logs out, they are redirected to the top page. This callback is your chance to clean up their session, e.g. delete cookies. The default implementation removes the Principal from the Play session cookie.

  18. def onStart(): Unit

    Definition Classes
    Plugin
  19. def onStop(): Unit

    Definition Classes
    Plugin
  20. def savePrincipal(request: Request[_], result: Result, principal: Principal): Future[Result]

    This is called when redirecting to the original URL after authentication has successfully completed.

    This is called when redirecting to the original URL after authentication has successfully completed. This callback is your change to save the principal to a session. The default implementation saves it as JSON to the Play session cookie.

  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Plugin

Inherited from AnyRef

Inherited from Any

Ungrouped