Class OAuth2Auth


  • public class OAuth2Auth
    extends AuthenticationProvider
    Factory interface for creating OAuth2 based AuthenticationProvider instances.

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • OAuth2Auth

        public OAuth2Auth​(io.vertx.ext.auth.oauth2.OAuth2Auth delegate)
      • OAuth2Auth

        public OAuth2Auth​(Object delegate)
    • Method Detail

      • create

        public static OAuth2Auth create​(Vertx vertx)
        Parameters:
        vertx - the Vertx instance
        Returns:
        the auth provider
      • create

        public static OAuth2Auth create​(Vertx vertx,
                                        io.vertx.ext.auth.oauth2.OAuth2Options config)
        Parameters:
        vertx - the Vertx instance
        config - the config
        Returns:
        the auth provider
      • jWKSet

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> jWKSet()
        Retrieve the public server JSON Web Key (JWK) required to verify the authenticity of issued ID and access tokens. The provider will refresh the keys according to: https://openid.net/specs/openid-connect-core-1_0.html#RotateEncKeys This means that the provider will look at the cache headers and will refresh when the max-age is reached. If the server does not return any cache headers it shall be up to the end user to call this method to refresh. To avoid the refresh to happen too late, this means that they keys will be invalid, if the OAuth2Options JWTOptions config contains a positive leeway, it will be used to request the refresh ahead of time. Key rotation can be controled by OAuth2Options.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • jWKSetAndAwait

        public Void jWKSetAndAwait()
        Blocking variant of jWKSet().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • jWKSetAndForget

        public OAuth2Auth jWKSetAndForget()
        Variant of jWKSet() that ignores the result of the operation.

        This method subscribes on the result of jWKSet(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from jWKSet() but you don't need to compose it with other operations.

        Returns:
        the instance of OAuth2Auth to chain method calls.
      • authorizeURL

        public String authorizeURL​(io.vertx.core.json.JsonObject params)
        Parameters:
        params - extra params to be included in the final URL.
        Returns:
        the url to be used to authorize the user.
      • refresh

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<User> refresh​(User user)
        Refresh the current User (access token).

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        user - the user (access token) to be refreshed.
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • refreshAndAwait

        public User refreshAndAwait​(User user)
        Blocking variant of refresh(io.vertx.mutiny.ext.auth.User).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        user - the user (access token) to be refreshed.
        Returns:
        the User instance produced by the operation.
      • revoke

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> revoke​(User user,
                                                   String tokenType)
        Revoke an obtained access or refresh token. More info https://tools.ietf.org/html/rfc7009.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        user - the user (access token) to revoke.
        tokenType - the token type (either access_token or refresh_token).
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • revokeAndAwait

        public Void revokeAndAwait​(User user,
                                   String tokenType)
        Blocking variant of revoke(io.vertx.mutiny.ext.auth.User,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        user - the user (access token) to revoke.
        tokenType - the token type (either access_token or refresh_token).
        Returns:
        the Void instance produced by the operation.
      • revoke

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> revoke​(User user)
        Revoke an obtained access token. More info https://tools.ietf.org/html/rfc7009.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        user - the user (access token) to revoke.
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • revokeAndAwait

        public Void revokeAndAwait​(User user)
        Blocking variant of revoke(io.vertx.mutiny.ext.auth.User).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        user - the user (access token) to revoke.
        Returns:
        the Void instance produced by the operation.
      • userInfo

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> userInfo​(User user)
        Retrieve profile information and other attributes for a logged-in end-user. More info https://openid.net/specs/openid-connect-core-1_0.html#UserInfo

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        user - the user (access token) to fetch the user info.
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • userInfoAndAwait

        public io.vertx.core.json.JsonObject userInfoAndAwait​(User user)
        Blocking variant of userInfo(io.vertx.mutiny.ext.auth.User).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        user - the user (access token) to fetch the user info.
        Returns:
        the JsonObject instance produced by the operation.
      • endSessionURL

        public String endSessionURL​(User user,
                                    io.vertx.core.json.JsonObject params)
        Parameters:
        user - the user to generate the url for
        params - extra parameters to apply to the url
        Returns:
        the url to end the session.
      • endSessionURL

        public String endSessionURL​(User user)
        Parameters:
        user - the user to generate the url for
        Returns:
        the url to end the session.
      • close

        public void close()
      • newInstance

        public static OAuth2Auth newInstance​(io.vertx.ext.auth.oauth2.OAuth2Auth arg)