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 {
38 private static final long serialVersionUID = -1357683611240908638L;
40 private String tenantId;
42 public CSpacePrincipal(String name) {
46 public int hashCode() {
47 return name.hashCode();
50 public boolean equals(Object obj) {
51 Principal p = (Principal) obj;
52 return name.equals(p.getName());
55 public String toString() {
60 * Returns the name of this principal.
62 * @return the name of this principal.
64 public String getName() {
69 * Returns the id of the tenant this principal is associated with
72 public String getTenantId() {
77 * Set the id for the tenant to which princiapal is associated with
78 * The access to this method must be package private
81 void setTenantId(String tenantId) {
82 this.tenantId = tenantId;