Package org.restheart.security
Class AclVarsInterpolator
java.lang.Object
org.restheart.security.AclVarsInterpolator
Helper class that allows to interpolate variables (@user, @request, @now) in
permissions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bson.BsonValueinterpolateBson(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 wellstatic io.undertow.predicate.PredicateinterpolatePredicate(Request<?> request, String predicate, ClassLoader classLoader) interpolate the permission predicate substituting @user.x variablesstatic org.bson.BsonValueinterpolatePropValue(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.
-
Constructor Details
-
AclVarsInterpolator
public AclVarsInterpolator()
-
-
Method Details
-
interpolateBson
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 requestpredicate- the predicate containing the placeholder valiable to interpolateclassLoader- the classloader to resolve the predicates, see java.util.ServiceLoader- Returns:
- the interpolated predicate
- Throws:
ConfigurationException
-