ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/util/net/TestCustomSsl.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/util/net/TestCustomSsl.java
Status
scanned
Type
file
Name
TestCustomSsl.java
Extension
.java
Programming language
Java
Mime type
text/html
File type
HTML document, ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
3302 (3.2 KB)
MD5
b3a060d08992688c676d5c0c8651e06d
SHA1
32be36979bbf95f3acbe01e8c42ece9903c83732
SHA256
d976c46474d1d78ac5a7800d5052ea57e13fad229f3e231ca1a9cd776b0b3497
SHA512

      
    
SHA1_git
760dd096dee8561f98d0b165163b439e29263807
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestCustomSsl.java | 3.2 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.tomcat.util.net; import java.io.File; import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.net.SSLHostConfigCertificate.Type; import org.apache.tomcat.util.net.jsse.TesterBug50640SslImpl; import org.apache.tomcat.websocket.server.WsContextListener; /** * The keys and certificates used in this file are all available in svn and were * generated using a test CA the files for which are in the Tomcat PMC private * repository since not all of them are AL2 licensed. */ public class TestCustomSsl extends TomcatBaseTest { @Test public void testCustomSslImplementation() throws Exception { TesterSupport.configureClientSsl(); Tomcat tomcat = getTomcatInstance(); Connector connector = tomcat.getConnector(); SSLHostConfig sslHostConfig = new SSLHostConfig(); SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(sslHostConfig, Type.UNDEFINED); sslHostConfig.addCertificate(certificate); connector.addSslHostConfig(sslHostConfig); Assert.assertTrue(connector.setProperty( "sslImplementationName", "org.apache.tomcat.util.net.jsse.TesterBug50640SslImpl")); // This setting will break ssl configuration unless the custom // implementation is used. sslHostConfig.setProtocols(TesterBug50640SslImpl.PROPERTY_VALUE); sslHostConfig.setSslProtocol("tls"); File keystoreFile = new File(TesterSupport.LOCALHOST_RSA_JKS); certificate.setCertificateKeystoreFile(keystoreFile.getAbsolutePath()); connector.setSecure(true); Assert.assertTrue(connector.setProperty("SSLEnabled", "true")); File appDir = new File(getBuildDirectory(), "webapps/examples"); Context ctxt = tomcat.addWebapp( null, "/examples", appDir.getAbsolutePath()); ctxt.addApplicationListener(WsContextListener.class.getName()); tomcat.start(); ByteChunk res = getUrl("https://localhost:" + getPort() + "/examples/servlets/servlet/HelloWorldExample"); Assert.assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
33.43
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