Trait

com.m3.octoparts.auth

OctopartsAuthHandler

Related Doc: package auth

Permalink

trait OctopartsAuthHandler extends AnyRef

Authentication handler 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
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. OctopartsAuthHandler
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Abstract Value Members

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

    Permalink

    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]

    Permalink

    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]

    Permalink

    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]

    Permalink

    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

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

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

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

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

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

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

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

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

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

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

    Permalink

    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.

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

    Permalink
    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

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

    Permalink

    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.

  17. def savePrincipal(request: Request[_], result: Result, principal: Principal): Future[Result]

    Permalink

    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.

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

    Permalink
    Definition Classes
    AnyRef
  19. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped