01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10:
11: package org.mmbase.security.implementation.basic;
12:
13: import org.mmbase.security.Rank;
14: import org.mmbase.security.BasicUser;
15: import org.mmbase.security.SecurityException;
16:
17: /**
18: * A UserContext implementation based only on user name, which serves as the identifier for the
19: * user.
20: *
21: * @author Eduard Witteveen
22: * @version $Id: NameContext.java,v 1.6 2005/03/01 14:08:33 michiel Exp $
23: */
24: public class NameContext extends BasicUser {
25:
26: private String identifier = null;
27: private Rank rank = null;
28:
29: public NameContext(Rank rank, String authenticationType) {
30: super (authenticationType);
31: this .rank = rank;
32: }
33:
34: public String getIdentifier() {
35: if (identifier == null) {
36: throw new SecurityException(
37: "No user name was set by the security implementation. This is required.");
38: }
39: return identifier;
40: }
41:
42: public Rank getRank() {
43: if (rank == null) {
44: throw new SecurityException(
45: "No rank was provider by the security implementation. This is required.");
46: }
47: return rank;
48: }
49:
50: /**
51: * @since MMBase-1.8
52: */
53: void setRank(Rank r) {
54: rank = r;
55: }
56:
57: void setIdentifier(String ident) {
58: this.identifier = ident;
59: }
60: }
|