Interface SecurityDirectives
- All Known Subinterfaces:
- Directives
- All Known Implementing Classes:
- Directives$,- HttpApp,- SecurityDirectives$
public interface SecurityDirectives
Provides directives for securing an inner route using the standard Http authentication headers {@link <code>WWW-Authenticate</code>}
 and 
Authorization. Most prominently, HTTP Basic authentication and OAuth 2.0 Authorization Framework
 as defined in RFC 2617 and RFC 6750 respectively.
 - 
Method SummaryModifier and TypeMethodDescription<T> AuthenticationDirective<T>authenticateBasic(String realm, scala.Function1<Credentials, scala.Option<T>> authenticator) Wraps the inner route with Http Basic authentication support using a givenAuthenticator[T].<T> AuthenticationDirective<T>authenticateBasicAsync(String realm, scala.Function1<Credentials, scala.concurrent.Future<scala.Option<T>>> authenticator) Wraps the inner route with Http Basic authentication support.<T> AuthenticationDirective<T>authenticateBasicPF(String realm, scala.PartialFunction<Credentials, T> authenticator) A directive that wraps the inner route with Http Basic authentication support.<T> AuthenticationDirective<T>authenticateBasicPFAsync(String realm, scala.PartialFunction<Credentials, scala.concurrent.Future<T>> authenticator) A directive that wraps the inner route with Http Basic authentication support.<T> AuthenticationDirective<T>authenticateOAuth2(String realm, scala.Function1<Credentials, scala.Option<T>> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support.<T> AuthenticationDirective<T>authenticateOAuth2Async(String realm, scala.Function1<Credentials, scala.concurrent.Future<scala.Option<T>>> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support.<T> AuthenticationDirective<T>authenticateOAuth2PF(String realm, scala.PartialFunction<Credentials, T> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support.<T> AuthenticationDirective<T>authenticateOAuth2PFAsync(String realm, scala.PartialFunction<Credentials, scala.concurrent.Future<T>> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support.<C extends HttpCredentials,T> 
 AuthenticationDirective<T>authenticateOrRejectWithChallenge(scala.Function1<scala.Option<C>, scala.concurrent.Future<scala.util.Either<HttpChallenge, T>>> authenticator, scala.reflect.ClassTag<C> evidence$1) Lifts an authenticator function into a directive.<T> AuthenticationDirective<T>authenticateOrRejectWithChallenge(scala.Function1<scala.Option<HttpCredentials>, scala.concurrent.Future<scala.util.Either<HttpChallenge, T>>> authenticator) Lifts an authenticator function into a directive.Directive<scala.runtime.BoxedUnit>Applies the given authorization check to the request.Directive<scala.runtime.BoxedUnit>authorize(scala.Function1<RequestContext, Object> check) Applies the given authorization check to the request.Directive<scala.runtime.BoxedUnit>authorizeAsync(scala.Function0<scala.concurrent.Future<Object>> check) Asynchronous version ofauthorize(scala.Function0<java.lang.Object>).Directive<scala.runtime.BoxedUnit>authorizeAsync(scala.Function1<RequestContext, scala.concurrent.Future<Object>> check) Asynchronous version ofauthorize(scala.Function0<java.lang.Object>).Directive<scala.Tuple1<scala.Option<HttpCredentials>>>Extracts the potentially presentHttpCredentialsprovided with the request'sAuthorizationheader.<C extends HttpCredentials,T> 
 AuthenticationDirective<T>extractCredentialsAndAuthenticateOrRejectWithChallenge(Directive<scala.Tuple1<scala.Option<C>>> extractCredentials, scala.Function1<scala.Option<C>, scala.concurrent.Future<scala.util.Either<HttpChallenge, T>>> authenticator) Lifts an authenticator function into a directive.
- 
Method Details- 
extractCredentialsDirective<scala.Tuple1<scala.Option<HttpCredentials>>> extractCredentials()Extracts the potentially presentHttpCredentialsprovided with the request'sAuthorizationheader.- Returns:
- (undocumented)
 
- 
authenticateBasic<T> AuthenticationDirective<T> authenticateBasic(String realm, scala.Function1<Credentials, scala.Option<T>> authenticator) Wraps the inner route with Http Basic authentication support using a givenAuthenticator[T]. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateBasicAsync<T> AuthenticationDirective<T> authenticateBasicAsync(String realm, scala.Function1<Credentials, scala.concurrent.Future<scala.Option<T>>> authenticator) Wraps the inner route with Http Basic authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateBasicPF<T> AuthenticationDirective<T> authenticateBasicPF(String realm, scala.PartialFunction<Credentials, T> authenticator) A directive that wraps the inner route with Http Basic authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateBasicPFAsync<T> AuthenticationDirective<T> authenticateBasicPFAsync(String realm, scala.PartialFunction<Credentials, scala.concurrent.Future<T>> authenticator) A directive that wraps the inner route with Http Basic authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateOAuth2<T> AuthenticationDirective<T> authenticateOAuth2(String realm, scala.Function1<Credentials, scala.Option<T>> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateOAuth2Async<T> AuthenticationDirective<T> authenticateOAuth2Async(String realm, scala.Function1<Credentials, scala.concurrent.Future<scala.Option<T>>> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateOAuth2PF<T> AuthenticationDirective<T> authenticateOAuth2PF(String realm, scala.PartialFunction<Credentials, T> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateOAuth2PFAsync<T> AuthenticationDirective<T> authenticateOAuth2PFAsync(String realm, scala.PartialFunction<Credentials, scala.concurrent.Future<T>> authenticator) A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.- Parameters:
- realm- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
extractCredentialsAndAuthenticateOrRejectWithChallenge<C extends HttpCredentials,T> AuthenticationDirective<T> extractCredentialsAndAuthenticateOrRejectWithChallenge(Directive<scala.Tuple1<scala.Option<C>>> extractCredentials, scala.Function1<scala.Option<C>, scala.concurrent.Future<scala.util.Either<HttpChallenge, T>>> authenticator) Lifts an authenticator function into a directive. The authenticator function gets passed in credentials from theAuthorizationheader of the request. If the function returnsRight(user)the user object is provided to the inner route. If the function returnsLeft(challenge)the request is rejected with anAuthenticationFailedRejectionthat contains this challenge to be added to the response.You can supply a directive to extract the credentials (to support alternative ways of providing credentials). - Parameters:
- extractCredentials- (undocumented)
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateOrRejectWithChallenge<T> AuthenticationDirective<T> authenticateOrRejectWithChallenge(scala.Function1<scala.Option<HttpCredentials>, scala.concurrent.Future<scala.util.Either<HttpChallenge, T>>> authenticator) Lifts an authenticator function into a directive. The authenticator function gets passed in credentials from theAuthorizationheader of the request. If the function returnsRight(user)the user object is provided to the inner route. If the function returnsLeft(challenge)the request is rejected with anAuthenticationFailedRejectionthat contains this challenge to be added to the response.- Parameters:
- authenticator- (undocumented)
- Returns:
- (undocumented)
 
- 
authenticateOrRejectWithChallenge<C extends HttpCredentials,T> AuthenticationDirective<T> authenticateOrRejectWithChallenge(scala.Function1<scala.Option<C>, scala.concurrent.Future<scala.util.Either<HttpChallenge, T>>> authenticator, scala.reflect.ClassTag<C> evidence$1) Lifts an authenticator function into a directive. Same asauthenticateOrRejectWithChallengebut only applies the authenticator function with a certain type of credentials.- Parameters:
- authenticator- (undocumented)
- evidence$1- (undocumented)
- Returns:
- (undocumented)
 
- 
authorizeApplies the given authorization check to the request. If the check fails the route is rejected with anAuthorizationFailedRejection.- Parameters:
- check- (undocumented)
- Returns:
- (undocumented)
 
- 
authorizeApplies the given authorization check to the request. If the check fails the route is rejected with anAuthorizationFailedRejection.- Parameters:
- check- (undocumented)
- Returns:
- (undocumented)
 
- 
authorizeAsyncDirective<scala.runtime.BoxedUnit> authorizeAsync(scala.Function0<scala.concurrent.Future<Object>> check) Asynchronous version ofauthorize(scala.Function0<java.lang.Object>). If theFuturefails or is completed withfalseauthorization fails and the route is rejected with anAuthorizationFailedRejection.- Parameters:
- check- (undocumented)
- Returns:
- (undocumented)
 
- 
authorizeAsyncDirective<scala.runtime.BoxedUnit> authorizeAsync(scala.Function1<RequestContext, scala.concurrent.Future<Object>> check) Asynchronous version ofauthorize(scala.Function0<java.lang.Object>). If theFuturefails or is completed withfalseauthorization fails and the route is rejected with anAuthorizationFailedRejection.- Parameters:
- check- (undocumented)
- Returns:
- (undocumented)
 
 
-