01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/dav/tags/sakai_2-4-1/dav-common/src/java/org/sakaiproject/dav/DavPrincipal.java $
03: * $Id: DavPrincipal.java 8482 2006-04-28 20:28:09Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.dav;
21:
22: import java.security.Principal;
23:
24: /**
25: * Implementation of Principal for Dav support in Sakai - holds the user name and password
26: */
27: public class DavPrincipal implements Principal {
28: /** The username of the user represented by this Principal. */
29: protected String m_name = null;
30:
31: /** The authentication credentials for the user represented by this Principal. */
32: protected String m_password = null;
33:
34: /**
35: * Construct with this name and password.
36: *
37: * @param name
38: * The username of the user represented by this Principal
39: * @param password
40: * Credentials used to authenticate this user
41: */
42: public DavPrincipal(String name, String password) {
43: m_name = name;
44: m_password = password;
45: }
46:
47: public String getName() {
48: return m_name;
49: }
50:
51: public String getPassword() {
52: return m_password;
53: }
54:
55: /**
56: * Does the user represented by this Principal possess the specified role?
57: *
58: * @param role
59: * Role to be tested.
60: * @return true if the Principal has the role, false if not.
61: */
62: public boolean hasRole(String role) {
63: if (role == null)
64: return (false);
65: return (true);
66: }
67:
68: public String toString() {
69: return "DavPrincipal: " + m_name;
70: }
71: }
|