com.sksamuel.scruffy.security.authentication

AuthenticationStrategy

trait AuthenticationStrategy extends AnyRef

An AuthenticationStrategy is responsible for retriving a Principal for the current request. How the Principal is retrieved is dependent on the type of strategy used.

For example, the BasicAuthenticationStrategy, named after HTTP Basic Auth, creates a Principal based on the credentials provided in the Authorization header. If no credentials are supplied an appropriate 401 is returned.

A SessionAuthenticationStrategy looks up a Principal from the current session. The session would have been populated previously by some previous mechanism (login page for example).

Another type of AuthenticationStrategy might be to use an API header key to lookup details from a key database.

To implement a custom strategy, extend from AuthenticationStrategy and implement authenticate. This method must return a Success[Principal] if the request should be authorized, or it should return a Failure with an error message if the request failed.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. AuthenticationStrategy
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def authenticate(req: HttpRequest): Future[Try[Principal]]

    Authenticate must either return a Scala Try with the result of the authentication.

    Authenticate must either return a Scala Try with the result of the authentication. If the authentication was successful then it should return a Success of Principal. Otherwise it should return a Failure with some exception indicating the failure.

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

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

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

    Definition Classes
    AnyRef → Any
  10. def failureHandler: AuthenticationFailureHandler

    Returns an AuthenticationFailureHandler which is invoked with the result of authenticate if the authentication process fails.

    Returns an AuthenticationFailureHandler which is invoked with the result of authenticate if the authentication process fails.

    By default, a DefaultAuthenticationFailureHandler is returned which returns a Http 401.

  11. def finalize(): Unit

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

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

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

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

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

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

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

    Definition Classes
    AnyRef
  19. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped