APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.naming.internal

public final Class ObjectFactoriesFilter

extends Object
Class Inheritance
Imports
sun.security.util.SecurityProperties, javax.naming.Reference, java.io.ObjectInputFilter, .ObjectInputFilter.FilterInfo, .ObjectInputFilter.Status

This class implements the filter that validates object factories classes instantiated during Reference lookups. There is one system-wide filter instance per VM that can be set via the "jdk.jndi.object.factoriesFilter" system property value, or via setting the property in the security properties file. The system property value supersedes the security property value. If none of the properties are specified the default "*" value is used. The filter is implemented as ObjectInputFilter with capabilities limited to the validation of a factory's class types only (FilterInfo#serialClass()). Array length, number of object references, depth, and stream size filtering capabilities are not supported by the filter.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
private static interface
private static record
private static record

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private static final ObjectFactoriesFilter.ConfiguredFilter
private static final String
private static final ObjectFactoriesFilter.ConfiguredFilter
private static final String
private static final ObjectFactoriesFilter.ConfiguredFilter

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true - if the factory is allowed to be instantiated; false - otherwise
checkGlobalFilter
(Class<?>
objects factory class
serialClass
)

Checks if serial filter configured with "jdk.jndi.object.factoriesFilter" system property value allows instantiation of the specified objects factory class.

private static boolean
public static boolean

Returns:

true - if the factory is allowed to be instantiated; false - otherwise
checkLdapFilter
(Class<?>
objects factory class
serialClass
)

Checks if the factory filters allow the given factory class for LDAP.

public static boolean

Returns:

true - if the factory is allowed to be instantiated; false - otherwise
checkRmiFilter
(Class<?>
objects factory class
serialClass
)

Checks if the factory filters allow the given factory class for RMI.

private static String
getFilterPropertyValue(String propertyName, String defaultValue)

private static ObjectFactoriesFilter.ConfiguredFilter
initializeFilter(String filterPropertyName, String filterDefaultValue)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_GLOBAL_SP_VALUEback to summary
private static final String DEFAULT_GLOBAL_SP_VALUE
DEFAULT_LDAP_SP_VALUEback to summary
private static final String DEFAULT_LDAP_SP_VALUE
DEFAULT_RMI_SP_VALUEback to summary
private static final String DEFAULT_RMI_SP_VALUE
GLOBAL_FACTORIES_FILTER_PROPNAMEback to summary
private static final String GLOBAL_FACTORIES_FILTER_PROPNAME
GLOBAL_FILTERback to summary
private static final ObjectFactoriesFilter.ConfiguredFilter GLOBAL_FILTER
LDAP_FACTORIES_FILTER_PROPNAMEback to summary
private static final String LDAP_FACTORIES_FILTER_PROPNAME
LDAP_FILTERback to summary
private static final ObjectFactoriesFilter.ConfiguredFilter LDAP_FILTER
RMI_FACTORIES_FILTER_PROPNAMEback to summary
private static final String RMI_FACTORIES_FILTER_PROPNAME
RMI_FILTERback to summary
private static final ObjectFactoriesFilter.ConfiguredFilter RMI_FILTER

Constructor Detail

ObjectFactoriesFilterback to summary
private ObjectFactoriesFilter()

Method Detail

checkGlobalFilterback to summary
public static boolean checkGlobalFilter(Class<?> serialClass)

Checks if serial filter configured with "jdk.jndi.object.factoriesFilter" system property value allows instantiation of the specified objects factory class. If the filter result is ALLOWED, the filter will allow the instantiation of objects factory class.

Parameters
serialClass:Class<?>

objects factory class

Returns:boolean

true - if the factory is allowed to be instantiated; false - otherwise

checkInputback to summary
private static boolean checkInput(ObjectFactoriesFilter.ConfiguredFilter filter, ObjectFactoriesFilter.FactoryInfo serialClass)
checkLdapFilterback to summary
public static boolean checkLdapFilter(Class<?> serialClass)

Checks if the factory filters allow the given factory class for LDAP. This method combines the global and LDAP specific filter results to determine if the given factory class is allowed. The given factory class is rejected if any of these two filters reject it, or if none of them allow it.

Parameters
serialClass:Class<?>

objects factory class

Returns:boolean

true - if the factory is allowed to be instantiated; false - otherwise

checkRmiFilterback to summary
public static boolean checkRmiFilter(Class<?> serialClass)

Checks if the factory filters allow the given factory class for RMI. This method combines the global and RMI specific filter results to determine if the given factory class is allowed. The given factory class is rejected if any of these two filters reject it, or if none of them allow it.

Parameters
serialClass:Class<?>

objects factory class

Returns:boolean

true - if the factory is allowed to be instantiated; false - otherwise

getFilterPropertyValueback to summary
private static String getFilterPropertyValue(String propertyName, String defaultValue)
initializeFilterback to summary
private static ObjectFactoriesFilter.ConfiguredFilter initializeFilter(String filterPropertyName, String filterDefaultValue)
com.sun.naming.internal back to summary

private Interface ObjectFactoriesFilter.ConfiguredFilter

Known Direct Implementers
com.sun.naming.internal.ObjectFactoriesFilter.ValidFilter, com.sun.naming.internal.ObjectFactoriesFilter.InvalidFilter

Method Summary

Modifier and TypeMethod and Description
public ObjectInputFilter

Method Detail

filterback to summary
public ObjectInputFilter filter()
com.sun.naming.internal back to summary

private Interface ObjectFactoriesFilter.FactoryInfo

extends FilterInfo
Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public default long
arrayLength()

Implements java.io.ObjectInputFilter.FilterInfo.arrayLength.

The number of array elements when deserializing an array of the class.

public default long
depth()

Implements java.io.ObjectInputFilter.FilterInfo.depth.

The current depth.

public default long
references()

Implements java.io.ObjectInputFilter.FilterInfo.references.

The current number of object references.

public default long
streamBytes()

Implements java.io.ObjectInputFilter.FilterInfo.streamBytes.

The current number of bytes consumed.

Inherited from java.io.ObjectInputFilter.FilterInfo:
serialClass

Method Detail

arrayLengthback to summary
public default long arrayLength()

Implements java.io.ObjectInputFilter.FilterInfo.arrayLength.

Doc from java.io.ObjectInputFilter.FilterInfo.arrayLength.

The number of array elements when deserializing an array of the class.

Annotations
@Override
depthback to summary
public default long depth()

Implements java.io.ObjectInputFilter.FilterInfo.depth.

Doc from java.io.ObjectInputFilter.FilterInfo.depth.

The current depth. The depth starts at 1 and increases for each nested object and decrements when each nested object returns.

Annotations
@Override
referencesback to summary
public default long references()

Implements java.io.ObjectInputFilter.FilterInfo.references.

Doc from java.io.ObjectInputFilter.FilterInfo.references.

The current number of object references.

Annotations
@Override
streamBytesback to summary
public default long streamBytes()

Implements java.io.ObjectInputFilter.FilterInfo.streamBytes.

Doc from java.io.ObjectInputFilter.FilterInfo.streamBytes.

The current number of bytes consumed.

Annotations
@Override
com.sun.naming.internal back to summary

private final Record ObjectFactoriesFilter.InvalidFilter

extends Record
implements ConfiguredFilter
Class Inheritance
All Implemented Interfaces
com.sun.naming.internal.ObjectFactoriesFilter.ConfiguredFilter
Record Components
filterPropertyName:String 
error:IllegalArgumentException 

Field Summary

Modifier and TypeField and Description
private final IllegalArgumentException
error

Record Component accessed by error().

private final String
filterPropertyName

Record Component accessed by filterPropertyName().

Constructor Summary

AccessConstructor and Description
private
InvalidFilter(String filterPropertyName, IllegalArgumentException error)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public IllegalArgumentException
error()

Record Component getter of error.

public ObjectInputFilter
public String
filterPropertyName()

Record Component getter of filterPropertyName.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

errorback to summary
private final IllegalArgumentException error

Record Component accessed by error().

filterPropertyNameback to summary
private final String filterPropertyName

Record Component accessed by filterPropertyName().

Constructor Detail

InvalidFilterback to summary
private InvalidFilter(String filterPropertyName, IllegalArgumentException error)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
errorback to summary
public IllegalArgumentException error()

Record Component getter of error.

filterback to summary
public ObjectInputFilter filter()

Implements com.sun.naming.internal.ObjectFactoriesFilter.ConfiguredFilter.filter.

Annotations
@Override
filterPropertyNameback to summary
public String filterPropertyName()

Record Component getter of filterPropertyName.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

com.sun.naming.internal back to summary

private final Record ObjectFactoriesFilter.ValidFilter

extends Record
implements ConfiguredFilter
Class Inheritance
All Implemented Interfaces
com.sun.naming.internal.ObjectFactoriesFilter.ConfiguredFilter
Record Components
filter:ObjectInputFilter 

Field Summary

Modifier and TypeField and Description
private final ObjectInputFilter
filter

Record Component accessed by filter().

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public ObjectInputFilter
public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

filterback to summary
private final ObjectInputFilter filter

Record Component accessed by filter().

Constructor Detail

ValidFilterback to summary
private ValidFilter(ObjectInputFilter filter)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
filterback to summary
public ObjectInputFilter filter()

Record Component getter of filter.

Implements com.sun.naming.internal.ObjectFactoriesFilter.ConfiguredFilter.filter.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.