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.util.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<String> _roleNames;
35
36
37 public UserInfo (String userName, Credential credential, List<String> roleNames)
38 {
39 _userName = userName;
40 _credential = credential;
41 _roleNames = new ArrayList<String>();
42 if (roleNames != null)
43 {
44 _roleNames.addAll(roleNames);
45 }
46 }
47
48 public String getUserName()
49 {
50 return this._userName;
51 }
52
53 public List<String> getRoleNames ()
54 {
55 return new ArrayList<String>(_roleNames);
56 }
57
58 public boolean checkCredential (Object suppliedCredential)
59 {
60 return _credential.check(suppliedCredential);
61 }
62
63 protected Credential getCredential ()
64 {
65 return _credential;
66 }
67
68 }