Class IsOnVaultPredicate
- All Implemented Interfaces:
org.springframework.cloud.gateway.handler.predicate.RoutePredicateFactory<IsOnVaultPredicate.Config>
,org.springframework.cloud.gateway.support.Configurable<IsOnVaultPredicate.Config>
,org.springframework.cloud.gateway.support.ShortcutConfigurable
This predicate examines the path of the incoming HTTP request and tries to extract a node UUID
from it using a predefined regular expression. If a valid node identifier is found, it queries
the MongoNodeRepositoryImpl
to determine whether the corresponding node is present.
The predicate returns true
if the node exists in the vault, otherwise false
.
Expected matching path format: any string containing "/nodes/{uuid}" where {uuid} is a valid UUID version 4.
Logging is performed for debugging purposes, indicating detection of the node ID and the result of the vault check.
Extends AbstractRoutePredicateFactory
to be used as a custom route predicate in gateway
routing configurations.
The inner static Config
class is required for Spring Cloud Gateway custom predicate factories.
Dependencies:
- MongoNodeRepositoryImpl
: Used for checking node existence by ID.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.springframework.cloud.gateway.support.ShortcutConfigurable
org.springframework.cloud.gateway.support.ShortcutConfigurable.GatewayEvaluationContext, org.springframework.cloud.gateway.support.ShortcutConfigurable.RestrictivePropertyAccessor, org.springframework.cloud.gateway.support.ShortcutConfigurable.ShortcutType
-
Field Summary
Fields inherited from interface org.springframework.cloud.gateway.handler.predicate.RoutePredicateFactory
PATTERN_KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPredicate
<org.springframework.web.server.ServerWebExchange> apply
(IsOnVaultPredicate.Config config) Methods inherited from class org.springframework.cloud.gateway.support.AbstractConfigurable
getConfigClass, newConfig, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.cloud.gateway.handler.predicate.RoutePredicateFactory
apply, applyAsync, applyAsync, beforeApply, getConfigClass, name, newConfig
Methods inherited from interface org.springframework.cloud.gateway.support.ShortcutConfigurable
shortcutFieldOrder, shortcutFieldPrefix, shortcutType
-
Constructor Details
-
IsOnVaultPredicate
-
-
Method Details
-
apply
public Predicate<org.springframework.web.server.ServerWebExchange> apply(IsOnVaultPredicate.Config config)
-