2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
24 package org.collectionspace.authentication;
26 import java.security.Principal;
29 * CSpacePrincipal provides additional tenant-specific context to application
32 final public class CSpacePrincipal
33 implements Principal, java.io.Serializable {
36 private String tenantId;
38 public CSpacePrincipal(String name) {
42 public int hashCode() {
43 return name.hashCode();
46 public boolean equals(Object obj) {
47 Principal p = (Principal) obj;
48 return name.equals(p.getName());
51 public String toString() {
56 * Returns the name of this principal.
58 * @return the name of this principal.
60 public String getName() {
65 * Returns the id of the tenant this principal is associated with
68 public String getTenantId() {
73 * Set the id for the tenant to which princiapal is associated with
74 * The access to this method must be package private
77 void setTenantId(String tenantId) {
78 this.tenantId = tenantId;