ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/authenticator/jaspic/TestSimpleServerAuthConfig.java

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

      
    
Rootfs path

      
    
Size
2929 (2.9 KB)
MD5
d9d73417e7cd61724878f49e82c0b820
SHA1
1d15052e0ec30956f7aee6633198be4638ab9b18
SHA256
8c7a5d8ffb101252f6d83bbb6eb6deb5bd3713057beac5d5205b17db30ac8056
SHA512

      
    
SHA1_git
f05d3636ade6098728a334298a03538ba6faaa1b
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestSimpleServerAuthConfig.java | 2.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.authenticator.jaspic; import java.util.HashMap; import java.util.Map; import jakarta.security.auth.message.AuthException; import jakarta.security.auth.message.MessageInfo; import jakarta.security.auth.message.config.ServerAuthConfig; import jakarta.security.auth.message.config.ServerAuthContext; import org.junit.Assert; import org.junit.Test; public class TestSimpleServerAuthConfig { private static final String SERVER_AUTH_MODULE_KEY_PREFIX = "org.apache.catalina.authenticator.jaspic.ServerAuthModule."; private static final Map<String,Object> CONFIG_PROPERTIES; static { CONFIG_PROPERTIES = new HashMap<>(); CONFIG_PROPERTIES.put(SERVER_AUTH_MODULE_KEY_PREFIX + "1", TesterServerAuthModuleA.class.getName()); } @Test public void testConfigOnServerAuthConfig() throws Exception { ServerAuthConfig serverAuthConfig = new SimpleServerAuthConfig(null, null, null, CONFIG_PROPERTIES); ServerAuthContext serverAuthContext = serverAuthConfig.getAuthContext(null, null, null); validateServerAuthContext(serverAuthContext); } @Test public void testConfigOnGetAuthContext() throws Exception { ServerAuthConfig serverAuthConfig = new SimpleServerAuthConfig(null, null, null, null); ServerAuthContext serverAuthContext = serverAuthConfig.getAuthContext(null, null, CONFIG_PROPERTIES); validateServerAuthContext(serverAuthContext); } @Test(expected = AuthException.class) public void testConfigNone() throws Exception { ServerAuthConfig serverAuthConfig = new SimpleServerAuthConfig(null, null, null, null); serverAuthConfig.getAuthContext(null, null, null); } private void validateServerAuthContext(ServerAuthContext serverAuthContext) throws Exception { MessageInfo msgInfo = new TesterMessageInfo(); serverAuthContext.cleanSubject(msgInfo, null); Assert.assertEquals("init()-cleanSubject()-", msgInfo.getMap().get("trace")); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
39.67
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