Package io.vertx.ext.web.openapi.router
Interface Security
-
public interface SecurityAn authentication handler factory. This class will hold factories for creatingAuthenticationHandlerobjects.Handlers will be used when creating the router. This class will configure the handlers to some extent:
APIKeyHandler- api key handlers will be configured from the document to avoid setup mistakesBasicAuthHandler- nothing is required to be configured, they will be used as isDigestAuthHandler- nothing is required to be configured, they will be used as isJWTAuthHandler- nothing is required to be configured, they will be used as is. Note that for scopes you may need to configure the provider to locate the claims in the right placeOAuth2AuthHandlercan be used in two forms:oauth2oropenIdConnect. When usingoauth2the function will receive the openapi configuration and it is the function implementor responsibility to configure the handler correctly. ForopenIdConnectmode the asynchronous function can be used to use the discovery mechanism.
OAuth2AuthHandlercallback. The callback is optional and if not provided the default behavior is to validate tokens as bearer tokens. When specified the callback must be an absolute path relative to the root of the router.- Author:
- Paulo Lopes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description RouterBuilderapiKeyHandler(APIKeyHandler handler)Configure theAPIKeyHandlerto be used when creating the router.RouterBuilderhttpHandler(BasicAuthHandler handler)Configure theBasicAuthHandlerto be used when creating the router.RouterBuilderhttpHandler(DigestAuthHandler handler)Configure theDigestAuthHandlerto be used when creating the router.RouterBuilderhttpHandler(JWTAuthHandler handler)Configure theJWTAuthHandlerto be used when creating the router.RouterBuilderoauth2Handler(String callback, Function<SecurityScheme,OAuth2AuthHandler> factory)Configure theOAuth2AuthHandlerto be used when creating the router.default RouterBuilderoauth2Handler(Function<SecurityScheme,OAuth2AuthHandler> factory)Configure theOAuth2AuthHandlerto be used when creating the router.Future<RouterBuilder>openIdConnectHandler(String callback, Function<String,Future<OAuth2AuthHandler>> factory)Configure theOAuth2AuthHandlerto be used when creating the router.default Future<RouterBuilder>openIdConnectHandler(Function<String,Future<OAuth2AuthHandler>> factory)Configure theOAuth2AuthHandlerto be used when creating the router.
-
-
-
Method Detail
-
apiKeyHandler
RouterBuilder apiKeyHandler(APIKeyHandler handler)
Configure theAPIKeyHandlerto be used when creating the router.- Parameters:
handler- the handler to be used- Returns:
- caller builder
-
httpHandler
RouterBuilder httpHandler(BasicAuthHandler handler)
Configure theBasicAuthHandlerto be used when creating the router.- Parameters:
handler- the handler to be used- Returns:
- caller builder
-
httpHandler
RouterBuilder httpHandler(DigestAuthHandler handler)
Configure theDigestAuthHandlerto be used when creating the router.- Parameters:
handler- the handler to be used- Returns:
- caller builder
-
httpHandler
RouterBuilder httpHandler(JWTAuthHandler handler)
Configure theJWTAuthHandlerto be used when creating the router.- Parameters:
handler- the handler to be used- Returns:
- caller builder
-
oauth2Handler
RouterBuilder oauth2Handler(String callback, Function<SecurityScheme,OAuth2AuthHandler> factory)
Configure theOAuth2AuthHandlerto be used when creating the router.- Parameters:
callback- the callback path to be used to validate tokensfactory- the handler factory that will receive the configuration and return the handler- Returns:
- caller builder
-
oauth2Handler
default RouterBuilder oauth2Handler(Function<SecurityScheme,OAuth2AuthHandler> factory)
Configure theOAuth2AuthHandlerto be used when creating the router. In this mode the callback is not used and will not handleauthorization_codeflows.- Parameters:
factory- the handler factory that will receive the configuration and return the handler- Returns:
- caller builder
-
openIdConnectHandler
Future<RouterBuilder> openIdConnectHandler(String callback, Function<String,Future<OAuth2AuthHandler>> factory)
Configure theOAuth2AuthHandlerto be used when creating the router.- Parameters:
callback- the callback path to be used to validate tokensfactory- the handler factory that will receive theopenIdConnectdiscovery url and return the handler- Returns:
- caller builder
-
openIdConnectHandler
default Future<RouterBuilder> openIdConnectHandler(Function<String,Future<OAuth2AuthHandler>> factory)
Configure theOAuth2AuthHandlerto be used when creating the router. In this mode the callback is not used and will not handleauthorization_codeflows.- Parameters:
factory- the handler factory that will receive theopenIdConnectdiscovery url and return the handler- Returns:
- caller builder
-
-