io.vertx.serviceproxy

## Class ServiceAuthInterceptor

- java.lang.Object
- - io.vertx.serviceproxy.ServiceAuthInterceptor

- All Implemented Interfaces:
    java.util.function.Function<Message<JsonObject>,Future<Message<JsonObject>>>

      public class ServiceAuthInterceptor
      extends Object
      implements java.util.function.Function<Message<JsonObject>,Future<Message<JsonObject>>>

  Create an event bus service interceptor using a token based authentication provider (e.g.: JWT or Oauth2) that will verify all requests before the service is invoked.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceAuthInterceptor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ServiceAuthInterceptor` | `addAuthorization(Authorization authorization)` Add a single authority to the authorities set.
    `Future<Message<JsonObject>>` | `apply(Message<JsonObject> msg)`
    `ServiceAuthInterceptor` | `setAuthenticationProvider(AuthenticationProvider provider)` Set an authentication provider that will verify all requests before the service is invoked.
    `ServiceAuthInterceptor` | `setAuthorizationProvider(AuthorizationProvider provider)`
    `ServiceAuthInterceptor` | `setAuthorizations(Set<Authorization> authorizations)` Set the required authorities for the service, once a JWT is validated it will be queried for these authorities.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.function.Function

      `andThen, compose, identity`

- - ### Constructor Detail

    - #### ServiceAuthInterceptor

          public ServiceAuthInterceptor()

  - ### Method Detail

    - #### setAuthenticationProvider

          public ServiceAuthInterceptor setAuthenticationProvider(AuthenticationProvider provider)

      Set an authentication provider that will verify all requests before the service is invoked.
      Parameters:
        `provider` - an authentication provider
      Returns:
        self

    - #### setAuthorizationProvider

          public ServiceAuthInterceptor setAuthorizationProvider(AuthorizationProvider provider)

    - #### setAuthorizations

          public ServiceAuthInterceptor setAuthorizations(Set<Authorization> authorizations)

      Set the required authorities for the service, once a JWT is validated it will be queried for these authorities. If authorities are missing a error 403 is returned.
      Parameters:
        `authorizations` - set of authorities
      Returns:
        self

    - #### addAuthorization

          public ServiceAuthInterceptor addAuthorization(Authorization authorization)

      Add a single authority to the authorities set.
      Parameters:
        `authorization` - authority
      Returns:
        self

    - #### apply

          public Future<Message<JsonObject>> apply(Message<JsonObject> msg)

      Specified by:
        `apply` in interface `java.util.function.Function<Message<JsonObject>,Future<Message<JsonObject>>>`

Copyright © 2021 Eclipse. All rights reserved.