1 // ========================================================================
2 // Copyright (c) 1999-2009 Mort Bay Consulting Pty. Ltd.
3 // ------------------------------------------------------------------------
4 // All rights reserved. This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v1.0
6 // and Apache License v2.0 which accompanies this distribution.
7 // The Eclipse Public License is available at
8 // http://www.eclipse.org/legal/epl-v10.html
9 // The Apache License v2.0 is available at
10 // http://www.opensource.org/licenses/apache2.0.php
11 // You may elect to redistribute this code under either of these licenses.
12 // ========================================================================
13
14 package org.eclipse.jetty.plus.jaas.spi;
15
16 import java.util.ArrayList;
17 import java.util.List;
18
19 import org.eclipse.jetty.http.security.Credential;
20
21 /**
22 * UserInfo
23 *
24 * This is the information read from the external source
25 * about a user.
26 *
27 * Can be cached by a UserInfoCache implementation
28 */
29 public class UserInfo
30 {
31
32 private String userName;
33 private Credential credential;
34 private List roleNames;
35
36
37 public UserInfo (String userName, Credential credential, List roleNames)
38 {
39 this.userName = userName;
40 this.credential = credential;
41 this.roleNames = new ArrayList();
42 if (roleNames != null)
43 this.roleNames.addAll(roleNames);
44 }
45
46 public String getUserName()
47 {
48 return this.userName;
49 }
50
51 public List getRoleNames ()
52 {
53 return new ArrayList(this.roleNames);
54 }
55
56 public boolean checkCredential (Object suppliedCredential)
57 {
58 return this.credential.check(suppliedCredential);
59 }
60
61 protected Credential getCredential ()
62 {
63 return this.credential;
64 }
65
66 }