type AuthenticatorPF[T] = PartialFunction[Credentials, T]
def authenticateOAuth2PF[T](realm: String, authenticator: AuthenticatorPF[T]): AuthenticationDirective[T]
Wraps the inner route with OAuth Bearer Token authentication support using a given
AuthenticatorPF<T> - Partial function from
This directive does not implement the complete OAuth2 protocol, but instead enables implementing it, by extracting the needed token from the HTTP headers.
Refer to authenticateOAuth2 for a detailed description of this directive.
Its semantics are equivalent to
authenticateOAuth2PF ’s, where not handling a case in the Partial Function (PF) leaves the request to be rejected with a
Longer-running authentication tasks (like looking up credentials in a database) should use the authenticateOAuth2Async variant of this directive which allows it to run without blocking routing layer of Akka HTTP, freeing it for other requests.
See Credentials and password timing attacks for details about verifying the secret.
For more information on how OAuth2 works see RFC 6750.
Usage in code is exactly the same as authenticateBasicPF, with the difference that one must validate the token as OAuth2 dictates (which is currently not part of Akka HTTP itself).