ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/startup/TesterMapRealm.java

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

      
    
Rootfs path

      
    
Size
1913 (1.9 KB)
MD5
98a6c276db1afeca0fd5c420ac1e13a4
SHA1
326f7e9bd591c8ff81cb982d301cfa164e7f2046
SHA256
b4ee8f10a615dc044f121514de6456b9fee0a49354134978def97d4d07dd9109
SHA512

      
    
SHA1_git
d45559ba90fb75b2a52c252afa7a434821d617ac
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TesterMapRealm.java | 1.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.startup; import java.security.Principal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.catalina.realm.GenericPrincipal; import org.apache.catalina.realm.RealmBase; /** * Simple Realm that uses a configurable {@link Map} to link user names and * passwords. */ public final class TesterMapRealm extends RealmBase { private Map<String,String> users = new HashMap<>(); private Map<String,List<String>> roles = new HashMap<>(); public void addUser(String username, String password) { users.put(username, password); } public void addUserRole(String username, String role) { roles.computeIfAbsent(username, k -> new ArrayList<>()).add(role); } @Override protected String getPassword(String username) { return users.get(username); } @Override protected Principal getPrincipal(String username) { return new GenericPrincipal(username, roles.get(username)); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
50.0
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