01: /*
02: * JOSSO: Java Open Single Sign-On
03: *
04: * Copyright 2004-2008, Atricore, Inc.
05: *
06: * This is free software; you can redistribute it and/or modify it
07: * under the terms of the GNU Lesser General Public License as
08: * published by the Free Software Foundation; either version 2.1 of
09: * the License, or (at your option) any later version.
10: *
11: * This software is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this software; if not, write to the Free
18: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20: */
21: package org.josso.gateway.identity.service.store;
22:
23: import org.josso.gateway.identity.exceptions.NoSuchUserException;
24: import org.josso.gateway.identity.exceptions.SSOIdentityException;
25: import org.josso.gateway.identity.service.BaseRole;
26: import org.josso.gateway.identity.service.BaseUser;
27:
28: /**
29: * Represents a resource to store user information.
30: * Implementations define the specific persistence mechanism to store data.
31: * User data is accessed using the username as key.
32: *
33: * @author <a href="mailto:sgonzalez@josso.org">Sebastian Gonzalez Oyuela</a>
34: * @version $Id: IdentityStore.java 508 2008-02-18 13:32:29Z sgonzalez $
35: */
36:
37: public interface IdentityStore {
38:
39: /**
40: * Loads user information from the store.
41: *
42: * @param key the user name, this is a unique identifier.
43: *
44: * @return the found user
45: *
46: * @throws NoSuchUserException if the user does not exist.
47: */
48: BaseUser loadUser(UserKey key) throws NoSuchUserException,
49: SSOIdentityException;
50:
51: /**
52: * Finds the list of roles associated to a given username.
53: *
54: * @param key
55: * @return a list with BaseRole instances.
56: *
57: * @throws SSOIdentityException
58: */
59: BaseRole[] findRolesByUserKey(UserKey key)
60: throws SSOIdentityException;
61:
62: /**
63: * Checks if the user is registered in the store.
64: * @param key
65: *
66: * @throws SSOIdentityException
67: */
68: boolean userExists(UserKey key) throws SSOIdentityException;
69:
70: }
|