01: // ========================================================================
02: // $Id: UserInfo.java 305 2006-03-07 10:32:14Z janb $
03: // Copyright 1999-2004 Mort Bay Consulting Pty. Ltd.
04: // ------------------------------------------------------------------------
05: // Licensed under the Apache License, Version 2.0 (the "License");
06: // you may not use this file except in compliance with the License.
07: // You may obtain a copy of the License at
08: // http://www.apache.org/licenses/LICENSE-2.0
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14: // ========================================================================
15:
16: package org.mortbay.jetty.plus.jaas.spi;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.mortbay.jetty.security.Credential;
22:
23: /**
24: * UserInfo
25: *
26: * This is the information read from the external source
27: * about a user.
28: *
29: * Can be cached by a UserInfoCache implementation
30: */
31: public class UserInfo {
32:
33: private String userName;
34: private Credential credential;
35: private List roleNames;
36:
37: public UserInfo(String userName, Credential credential,
38: List roleNames) {
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: return this .userName;
48: }
49:
50: public List getRoleNames() {
51: return new ArrayList(this .roleNames);
52: }
53:
54: public boolean checkCredential(Object suppliedCredential) {
55: return this .credential.check(suppliedCredential);
56: }
57:
58: protected Credential getCredential() {
59: return this.credential;
60: }
61:
62: }
|