Class IsOnVaultPredicate

java.lang.Object
org.springframework.cloud.gateway.support.AbstractConfigurable<IsOnVaultPredicate.Config>
org.springframework.cloud.gateway.handler.predicate.AbstractRoutePredicateFactory<IsOnVaultPredicate.Config>
org.saidone.gateway.predicate.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

@Component public class IsOnVaultPredicate extends org.springframework.cloud.gateway.handler.predicate.AbstractRoutePredicateFactory<IsOnVaultPredicate.Config>
Predicate implementation for Spring Cloud Gateway that checks if a node is present in the vault.

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 Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Predicate<org.springframework.web.server.ServerWebExchange>
     

    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