@Test public void testIsTrustedType() { JmsDestination destination = new JmsQueue("test-queue"); JmsDefaultDeserializationPolicy policy = new JmsDefaultDeserializationPolicy(); assertTrue(policy.isTrustedType(destination, null)); assertTrue(policy.isTrustedType(destination, UUID.class)); assertTrue(policy.isTrustedType(destination, String.class)); assertTrue(policy.isTrustedType(destination, Boolean.class)); assertTrue(policy.isTrustedType(destination, Double.class)); assertTrue(policy.isTrustedType(destination, Object.class)); policy.setAllowList("java.lang"); assertTrue(policy.isTrustedType(destination, null)); assertFalse(policy.isTrustedType(destination, UUID.class)); assertTrue(policy.isTrustedType(destination, String.class)); assertTrue(policy.isTrustedType(destination, Boolean.class)); assertFalse(policy.isTrustedType(destination, getClass())); policy.setAllowList("java.n"); assertFalse(policy.isTrustedType(destination, UUID.class)); assertFalse(policy.isTrustedType(destination, String.class)); assertFalse(policy.isTrustedType(destination, java.net.Socket.class)); policy.setAllowList("java.lang,org.apache.qpid.jms"); assertFalse(policy.isTrustedType(destination, UUID.class)); assertTrue(policy.isTrustedType(destination, String.class)); assertTrue(policy.isTrustedType(destination, getClass())); policy.setAllowList("java.lang.Integer"); assertTrue(policy.isTrustedType(destination, Integer.class)); assertFalse(policy.isTrustedType(destination, Boolean.class)); policy.setAllowList("java.lang.Integer"); policy.setDenyList("java.lang.Integer"); assertFalse(policy.isTrustedType(destination, Integer.class)); policy.setAllowList("java.lang.Integer"); policy.setDenyList("java.lang"); assertFalse(policy.isTrustedType(destination, Integer.class)); policy.setAllowList("java.lang.Integer"); policy.setDenyList("*"); assertFalse(policy.isTrustedType(destination, Integer.class)); }
@Override public boolean isTrustedType(JmsDestination destination, Class<?> clazz) { if (clazz == null) { return true; } String className = clazz.getCanonicalName(); if (className == null) { className = clazz.getName(); } for (String denyListEntry : denyList) { if (CATCH_ALL_WILDCARD.equals(denyListEntry)) { return false; } else if (isClassOrPackageMatch(className, denyListEntry)) { return false; } } for (String allowListEntry : allowList) { if (CATCH_ALL_WILDCARD.equals(allowListEntry)) { return true; } else if (isClassOrPackageMatch(className, allowListEntry)) { return true; } } return false; }
JmsDefaultDeserializationPolicy implements JmsDeserializationPolicy { @Override public boolean isTrustedType(JmsDestination destination, Class<?> clazz) { if (clazz == null) { return true; } String className = clazz.getCanonicalName(); if (className == null) { className = clazz.getName(); } for (String denyListEntry : denyList) { if (CATCH_ALL_WILDCARD.equals(denyListEntry)) { return false; } else if (isClassOrPackageMatch(className, denyListEntry)) { return false; } } for (String allowListEntry : allowList) { if (CATCH_ALL_WILDCARD.equals(allowListEntry)) { return true; } else if (isClassOrPackageMatch(className, allowListEntry)) { return true; } } return false; } }
JmsDefaultDeserializationPolicy implements JmsDeserializationPolicy { @Override public boolean isTrustedType(JmsDestination destination, Class<?> clazz) { if (clazz == null) { return true; } String className = clazz.getCanonicalName(); if (className == null) { className = clazz.getName(); } for (String denyListEntry : denyList) { if (CATCH_ALL_WILDCARD.equals(denyListEntry)) { return false; } else if (isClassOrPackageMatch(className, denyListEntry)) { return false; } } for (String allowListEntry : allowList) { if (CATCH_ALL_WILDCARD.equals(allowListEntry)) { return true; } else if (isClassOrPackageMatch(className, allowListEntry)) { return true; } } return false; } JmsDefaultDeserializationPolicy();  JmsDefaultDeserializationPolicy(JmsDefaultDeserializationPolicy source); }
JmsDefaultDeserializationPolicy implements JmsDeserializationPolicy { @Override public boolean isTrustedType(JmsDestination destination, Class<?> clazz) { if (clazz == null) { return true; } String className = clazz.getCanonicalName(); if (className == null) { className = clazz.getName(); } for (String denyListEntry : denyList) { if (CATCH_ALL_WILDCARD.equals(denyListEntry)) { return false; } else if (isClassOrPackageMatch(className, denyListEntry)) { return false; } } for (String allowListEntry : allowList) { if (CATCH_ALL_WILDCARD.equals(allowListEntry)) { return true; } else if (isClassOrPackageMatch(className, allowListEntry)) { return true; } } return false; } JmsDefaultDeserializationPolicy();  JmsDefaultDeserializationPolicy(JmsDefaultDeserializationPolicy source); @Override JmsDeserializationPolicy copy(); @Override boolean isTrustedType(JmsDestination destination, Class<?> clazz); @Deprecated String getWhiteList(); String getAllowList(); @Deprecated String getBlackList(); String getDenyList(); @Deprecated void setWhiteList(String allowList); void setAllowList(String allowList); @Deprecated void setBlackList(String denyList); void setDenyList(String denyList); @Override int hashCode(); @Override boolean equals(Object obj); }
JmsDefaultDeserializationPolicy implements JmsDeserializationPolicy { @Override public boolean isTrustedType(JmsDestination destination, Class<?> clazz) { if (clazz == null) { return true; } String className = clazz.getCanonicalName(); if (className == null) { className = clazz.getName(); } for (String denyListEntry : denyList) { if (CATCH_ALL_WILDCARD.equals(denyListEntry)) { return false; } else if (isClassOrPackageMatch(className, denyListEntry)) { return false; } } for (String allowListEntry : allowList) { if (CATCH_ALL_WILDCARD.equals(allowListEntry)) { return true; } else if (isClassOrPackageMatch(className, allowListEntry)) { return true; } } return false; } JmsDefaultDeserializationPolicy();  JmsDefaultDeserializationPolicy(JmsDefaultDeserializationPolicy source); @Override JmsDeserializationPolicy copy(); @Override boolean isTrustedType(JmsDestination destination, Class<?> clazz); @Deprecated String getWhiteList(); String getAllowList(); @Deprecated String getBlackList(); String getDenyList(); @Deprecated void setWhiteList(String allowList); void setAllowList(String allowList); @Deprecated void setBlackList(String denyList); void setDenyList(String denyList); @Override int hashCode(); @Override boolean equals(Object obj); static final String CATCH_ALL_WILDCARD; @Deprecated
    static final String DEPRECATED_ALLOWLIST_PROPERTY; @Deprecated
    static final String DEPRECATED_DENYLIST_PROPERTY; static final String ALLOWLIST_PROPERTY; static final String DENYLIST_PROPERTY; }