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.
25 * To change this template, choose Tools | Templates
26 * and open the template in the editor.
29 package org.collectionspace.authentication.realm;
33 import javax.security.auth.login.AccountException;
35 import org.collectionspace.authentication.CSpaceTenant;
38 * Interface for the CollectionSpace realm.
40 public interface CSpaceRealm {
43 * Retrieves the "salt" used to encrypt the user's password
46 * @throws AccountException
48 public String getSalt(String username) throws AccountException;
51 * Retrieves the hashed password used to authenticate a user.
54 * @return the password
55 * @throws AccountNotFoundException if the user is not found
56 * @throws AccountException if the password could not be retrieved
58 public String getPassword(String username) throws AccountException;
61 * Retrieves the roles for a user.
64 * @return a collection of roles
65 * @throws AccountException if the roles could not be retrieved
67 public Set<String> getRoles(String username) throws AccountException;
70 * Retrieves the enabled tenants associated with a user.
73 * @return a collection of tenants
74 * @throws AccountException if the tenants could not be retrieved
76 public Set<CSpaceTenant> getTenants(String username) throws AccountException;
79 * Retrieves the tenants associated with a user, optionally including disabled tenants.
82 * @param includeDisabledTenants if true, include disabled tenants
83 * @return a collection of tenants
84 * @throws AccountException if the tenants could not be retrieved
86 public Set<CSpaceTenant> getTenants(String username, boolean includeDisabledTenants) throws AccountException;