Class AclVarsInterpolator

java.lang.Object
org.restheart.security.AclVarsInterpolator

public class AclVarsInterpolator extends Object
Helper class that allows to interpolate variables (@user, @request, @now) in permissions
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bson.BsonValue
    interpolateBson(MongoRequest request, org.bson.BsonValue bson)
    Interpolate values in doc like '@user', '@user.property', @now Supports accounts handled by MongoRealAuthenticator, FileRealmAuthenticator and JwtAuthenticationMechanism Legacy variable names %USER, %ROLES and %NOW are supported as well
    static io.undertow.predicate.Predicate
    interpolatePredicate(Request<?> request, String predicate, ClassLoader classLoader)
    interpolate the permission predicate substituting @user.x variables
    static org.bson.BsonValue
    If value is a '@user', '@user.property', '@request', '@request.remoteIp', '@mongoPermissions', '@mongoPermissions.readFilter', '@now', '@filter' returns the interpolated value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AclVarsInterpolator

      public AclVarsInterpolator()
  • Method Details

    • interpolateBson

      public static org.bson.BsonValue interpolateBson(MongoRequest request, org.bson.BsonValue bson)
      Interpolate values in doc like '@user', '@user.property', @now Supports accounts handled by MongoRealAuthenticator, FileRealmAuthenticator and JwtAuthenticationMechanism Legacy variable names %USER, %ROLES and %NOW are supported as well
      Parameters:
      request -
      bson -
      Returns:
      bson with interpolated variables
    • interpolatePropValue

      public static org.bson.BsonValue interpolatePropValue(MongoRequest request, String key, String value)
      If value is a '@user', '@user.property', '@request', '@request.remoteIp', '@mongoPermissions', '@mongoPermissions.readFilter', '@now', '@filter' returns the interpolated value. For '@user' and '@mongoPermissions' supports accounts handled by MongoRealAuthenticator, FileRealmAuthenticator and JwtAuthenticationMechanism Legacy variable names %USER, %ROLES and %NOW are supported as well
      Parameters:
      request -
      key -
      value -
      Returns:
    • interpolatePredicate

      public static io.undertow.predicate.Predicate interpolatePredicate(Request<?> request, String predicate, ClassLoader classLoader) throws ConfigurationException
      interpolate the permission predicate substituting @user.x variables
      Parameters:
      request - the request
      predicate - the predicate containing the placeholder valiable to interpolate
      classLoader - the classloader to resolve the predicates, see java.util.ServiceLoader
      Returns:
      the interpolated predicate
      Throws:
      ConfigurationException