ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/realm/TestJNDIRealmAttributeValueEscape.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/realm/TestJNDIRealmAttributeValueEscape.java
Status
scanned
Type
file
Name
TestJNDIRealmAttributeValueEscape.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
3956 (3.9 KB)
MD5
c57807f29755150928ad0d6d1101e626
SHA1
20faeee803b22927caae414a50dc6afbb8be5497
SHA256
1bb1159bcc6abdc91ed75210911ce00453f6c79ab8924ea61e1bc9b145d4b133
SHA512

      
    
SHA1_git
86886a100f0b199fc0f92675a1cf8ae44b2dc488
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestJNDIRealmAttributeValueEscape.java | 3.9 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina.realm; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; @RunWith(Parameterized.class) public class TestJNDIRealmAttributeValueEscape { @Parameterized.Parameters(name = "{index}: in[{0}], out[{1}]") public static Collection<Object[]> parameters() { List<Object[]> parameterSets = new ArrayList<>(); // No escaping required parameterSets.add(new String[] { "none", "none" }); // Simple cases (same order as RFC 4512 section 2) // Each appearing at the beginning, middle and ent parameterSets.add(new String[] { " test", "\\20test" }); parameterSets.add(new String[] { "te st", "te st" }); parameterSets.add(new String[] { "test ", "test\\20" }); parameterSets.add(new String[] { "#test", "\\23test" }); parameterSets.add(new String[] { "te#st", "te#st" }); parameterSets.add(new String[] { "test#", "test#" }); parameterSets.add(new String[] { "\"test", "\\22test" }); parameterSets.add(new String[] { "te\"st", "te\\22st" }); parameterSets.add(new String[] { "test\"", "test\\22" }); parameterSets.add(new String[] { "+test", "\\2Btest" }); parameterSets.add(new String[] { "te+st", "te\\2Bst" }); parameterSets.add(new String[] { "test+", "test\\2B" }); parameterSets.add(new String[] { ",test", "\\2Ctest" }); parameterSets.add(new String[] { "te,st", "te\\2Cst" }); parameterSets.add(new String[] { "test,", "test\\2C" }); parameterSets.add(new String[] { ";test", "\\3Btest" }); parameterSets.add(new String[] { "te;st", "te\\3Bst" }); parameterSets.add(new String[] { "test;", "test\\3B" }); parameterSets.add(new String[] { "<test", "\\3Ctest" }); parameterSets.add(new String[] { "te<st", "te\\3Cst" }); parameterSets.add(new String[] { "test<", "test\\3C" }); parameterSets.add(new String[] { ">test", "\\3Etest" }); parameterSets.add(new String[] { "te>st", "te\\3Est" }); parameterSets.add(new String[] { "test>", "test\\3E" }); parameterSets.add(new String[] { "\ est", "\\5Ctest" }); parameterSets.add(new String[] { "te\\st", "te\\5Cst" }); parameterSets.add(new String[] { "test\\", "test\\5C" }); parameterSets.add(new String[] { "\u0000test", "\\00test" }); parameterSets.add(new String[] { "te\u0000st", "te\\00st" }); parameterSets.add(new String[] { "test\u0000", "test\\00" }); return parameterSets; } @Parameter(0) public String in; @Parameter(1) public String out; private JNDIRealm realm = new JNDIRealm(); @Test public void testConvertToHexEscape() throws Exception { String result = realm.doAttributeValueEscaping(in); Assert.assertEquals(out, result); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
26.5
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9