MCPcopy Create free account
hub / github.com/apache/tomcat / GenericPrincipal

Class GenericPrincipal

java/org/apache/catalina/realm/GenericPrincipal.java:38–306  ·  view source on GitHub ↗

Generic implementation of java.security.Principal that is available for use by Realm implementations.

Source from the content-addressed store, hash-verified

36 * implementations.
37 */
38public class GenericPrincipal implements TomcatPrincipal, Serializable {
39
40 @Serial
41 private static final long serialVersionUID = 1L;
42
43
44 // ----------------------------------------------------------- Constructors
45
46 /**
47 * Construct a new Principal, associated with the specified Realm, for the specified username, with no roles.
48 *
49 * @param name The username of the user represented by this Principal
50 */
51 public GenericPrincipal(String name) {
52 this(name, null);
53 }
54
55 /**
56 * Construct a new Principal, associated with the specified Realm, for the specified username, with the specified
57 * role names (as Strings).
58 *
59 * @param name The username of the user represented by this Principal
60 * @param roles List of roles (must be Strings) possessed by this user
61 */
62 public GenericPrincipal(String name, List<String> roles) {
63 this(name, roles, null);
64 }
65
66 /**
67 * Construct a new Principal, associated with the specified Realm, for the specified username, with the specified
68 * role names (as Strings).
69 *
70 * @param name The username of the user represented by this Principal
71 * @param roles List of roles (must be Strings) possessed by this user
72 * @param userPrincipal - the principal to be returned from the request getUserPrincipal call if not null; if null,
73 * this will be returned
74 */
75 public GenericPrincipal(String name, List<String> roles, Principal userPrincipal) {
76 this(name, roles, userPrincipal, null);
77 }
78
79 /**
80 * Construct a new Principal, associated with the specified Realm, for the specified username, with the specified
81 * role names (as Strings).
82 *
83 * @param name The username of the user represented by this Principal
84 * @param roles List of roles (must be Strings) possessed by this user
85 * @param userPrincipal - the principal to be returned from the request getUserPrincipal call if not null; if null,
86 * this will be returned
87 * @param loginContext - If provided, this will be used to log out the user at the appropriate time
88 */
89 public GenericPrincipal(String name, List<String> roles, Principal userPrincipal, LoginContext loginContext) {
90 this(name, roles, userPrincipal, loginContext, null, null);
91 }
92
93 /**
94 * Construct a new Principal, associated with the specified Realm, for the specified username, with the specified
95 * role names (as Strings).

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected