ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/authenticator/SingleSignOnSessionKey.java

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

      
    
Rootfs path

      
    
Size
4019 (3.9 KB)
MD5
cbebb44f21d73abd3f465671bb467cef
SHA1
19e93d161ede8cc5199770cfb06fc15c3d733d1b
SHA256
c22eba3bb7bdaacd2f4e92b0272de1d07c93ccf027bd166c88e3d54c41742838
SHA512

      
    
SHA1_git
e1a539dc0c1fb364568a1b080a16da7cf479a5cd
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
SingleSignOnSessionKey.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.authenticator; import java.io.Serial; import java.io.Serializable; import org.apache.catalina.Context; import org.apache.catalina.Session; /** * Key used by SSO to identify a session. This key is used rather than the actual session to facilitate the replication * of the SSO information across a cluster where replicating the entire session would generate significant, unnecessary * overhead. */ public class SingleSignOnSessionKey implements Serializable { @Serial private static final long serialVersionUID = 1L; private final String sessionId; private final String contextName; private final String hostName; public SingleSignOnSessionKey(Session session) { this.sessionId = session.getId(); Context context = session.getManager().getContext(); this.contextName = context.getName(); this.hostName = context.getParent().getName(); } public SingleSignOnSessionKey(Session session, String sessionId) { this.sessionId = sessionId; Context context = session.getManager().getContext(); this.contextName = context.getName(); this.hostName = context.getParent().getName(); } public String getSessionId() { return sessionId; } public String getContextName() { return contextName; } public String getHostName() { return hostName; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((sessionId == null) ? 0 : sessionId.hashCode()); result = prime * result + ((contextName == null) ? 0 : contextName.hashCode()); result = prime * result + ((hostName == null) ? 0 : hostName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SingleSignOnSessionKey other = (SingleSignOnSessionKey) obj; if (sessionId == null) { if (other.sessionId != null) { return false; } } else if (!sessionId.equals(other.sessionId)) { return false; } if (contextName == null) { if (other.contextName != null) { return false; } } else if (!contextName.equals(other.contextName)) { return false; } if (hostName == null) { return other.hostName == null; } else { return hostName.equals(other.hostName); } } @Override public String toString() { // Session ID is 32. Standard text is 36. Host could easily be 20+. // Context could be anything from 0 upwards. 128 seems like a reasonable // size to accommodate most cases without being too big. return "Host: [" + hostName + "], Context: [" + contextName + "], SessionID: [" + sessionId + ']'; } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
28.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