16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.net.httpserver;
27 import java.net.*;
28 import java.io.*;
29 import java.util.*;
30 import java.security.Principal;
31
32 /**
33 * Represents a user authenticated by HTTP Basic or Digest
34 * authentication.
35 */
36 public class HttpPrincipal implements Principal {
37 private String username, realm;
38
39 /**
40 * creates a HttpPrincipal from the given username and realm
41 * @param username The name of the user within the realm
42 * @param realm The realm.
43 * @throws NullPointerException if either username or realm are null
44 */
45 public HttpPrincipal (String username, String realm) {
46 if (username == null || realm == null) {
47 throw new NullPointerException();
48 }
49 this.username = username;
50 this.realm = realm;
51 }
52
53 /**
54 * Compares two HttpPrincipal. Returns <code>true</code>
55 * if <i>another</i> is an instance of HttpPrincipal, and its
|
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.net.httpserver;
27 import java.net.*;
28 import java.io.*;
29 import java.util.*;
30 import java.security.Principal;
31
32 /**
33 * Represents a user authenticated by HTTP Basic or Digest
34 * authentication.
35 */
36 @jdk.Supported
37 public class HttpPrincipal implements Principal {
38 private String username, realm;
39
40 /**
41 * creates a HttpPrincipal from the given username and realm
42 * @param username The name of the user within the realm
43 * @param realm The realm.
44 * @throws NullPointerException if either username or realm are null
45 */
46 public HttpPrincipal (String username, String realm) {
47 if (username == null || realm == null) {
48 throw new NullPointerException();
49 }
50 this.username = username;
51 this.realm = realm;
52 }
53
54 /**
55 * Compares two HttpPrincipal. Returns <code>true</code>
56 * if <i>another</i> is an instance of HttpPrincipal, and its
|