ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/dbcp/dbcp2/datasources/UserPassKey.java

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

      
    
Rootfs path

      
    
Size
3690 (3.6 KB)
MD5
4af71c6bd0540baacbebb472adc8da71
SHA1
1ec4182aedc1675e0e27bef96da0533b46c864d0
SHA256
8ad60caf94d39e68e04584b96fee27185c01fc8e069552ce12f8ee89ad9968ae
SHA512

      
    
SHA1_git
75e6661590b6b3d5a47f912d3d5e4703ba3c5efe
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
UserPassKey.java | 3.6 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 * * https://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.dbcp.dbcp2.datasources; import java.io.Serializable; import java.util.Objects; import org.apache.tomcat.dbcp.pool2.KeyedObjectPool; /** * <p> * Holds a user name and password pair. Serves as a poolable object key for the {@link KeyedObjectPool} backing a * {@link SharedPoolDataSource}. Two instances with the same user name are considered equal. This ensures that there * will be only one keyed pool for each user in the pool. The password is used (along with the user name) by the * {@link KeyedCPDSConnectionFactory} when creating new connections. * </p> * * <p> * {@link InstanceKeyDataSource#getConnection(String, String)} validates that the password used to create a connection * matches the password provided by the client. * </p> * * @since 2.0 */ final class UserPassKey implements Serializable { private static final long serialVersionUID = 5142970911626584817L; private final CharArray name; private final CharArray password; UserPassKey(final CharArray userName, final CharArray userPassword) { this.name = userName; this.password = userPassword; } UserPassKey(final String userName) { this(new CharArray(userName), CharArray.NULL); } UserPassKey(final String userName, final char[] password) { this(new CharArray(userName), new CharArray(password)); } UserPassKey(final String userName, final String userPassword) { this(new CharArray(userName), new CharArray(userPassword)); } /** * Clears the content of the name and password. * * @return {@code this} instance. */ UserPassKey clear() { name.clear(); password.clear(); return this; } /** * Only takes the user name into account. */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final UserPassKey other = (UserPassKey) obj; return Objects.equals(name, other.name); } /** * Gets the value of password. * * @return value of password. */ String getPassword() { return password.asString(); } /** * Gets the value of password. * * @return value of password. */ char[] getPasswordCharArray() { return password.get(); } /** * Gets the value of user name. * * @return value of user name. */ String getUserName() { return name.asString(); } /** * Only takes the user name into account. */ @Override public int hashCode() { return Objects.hash(name); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
28.95
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-eb6b5ae0-4f88-4e9b-d67c-c6c8e733b1cd apache-2.0 Apache-2.0
URL Start line End line
https://www.apache.org/licenses/LICENSE-2.0 9 9