KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > security > auth > NTSidPrimaryGroupPrincipal


1 /*
2  * @(#)NTSidPrimaryGroupPrincipal.java 1.14 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.security.auth;
9
10 /**
11  * <p> This class extends <code>NTSid</code>
12  * and represents a Windows NT user's primary group SID.
13  *
14  * <p> Principals such as this <code>NTSidPrimaryGroupPrincipal</code>
15  * may be associated with a particular <code>Subject</code>
16  * to augment that <code>Subject</code> with an additional
17  * identity. Refer to the <code>Subject</code> class for more information
18  * on how to achieve this. Authorization decisions can then be based upon
19  * the Principals associated with a <code>Subject</code>.
20  *
21  * @version 1.14, 12/19/03
22  * @see java.security.Principal
23  * @see javax.security.auth.Subject
24  */

25 public class NTSidPrimaryGroupPrincipal extends NTSid {
26
27     private static final long serialVersionUID = 8011978367305190527L;
28
29     /**
30      * Create an <code>NTSidPrimaryGroupPrincipal</code> with a Windows NT
31      * group SID.
32      *
33      * <p>
34      *
35      * @param name the primary Windows NT group SID for this user. <p>
36      *
37      * @exception NullPointerException if the <code>name</code>
38      * is <code>null</code>.
39      */

40     public NTSidPrimaryGroupPrincipal(String JavaDoc name) {
41     super(name);
42     }
43     
44     /**
45      * Return a string representation of this
46      * <code>NTSidPrimaryGroupPrincipal</code>.
47      *
48      * <p>
49      *
50      * @return a string representation of this
51      * <code>NTSidPrimaryGroupPrincipal</code>.
52      */

53     public String JavaDoc toString() {
54     java.text.MessageFormat JavaDoc form = new java.text.MessageFormat JavaDoc
55         (sun.security.util.ResourcesMgr.getString
56             ("NTSidPrimaryGroupPrincipal: name",
57             "sun.security.util.AuthResources"));
58     Object JavaDoc[] source = {getName()};
59     return form.format(source);
60     }
61     
62     /**
63      * Compares the specified Object with this
64      * <code>NTSidPrimaryGroupPrincipal</code>
65      * for equality. Returns true if the given object is also a
66      * <code>NTSidPrimaryGroupPrincipal</code> and the two
67      * NTSidPrimaryGroupPrincipals have the same SID.
68      *
69      * <p>
70      *
71      * @param o Object to be compared for equality with this
72      * <code>NTSidPrimaryGroupPrincipal</code>.
73      *
74      * @return true if the specified Object is equal equal to this
75      * <code>NTSidPrimaryGroupPrincipal</code>.
76      */

77     public boolean equals(Object JavaDoc o) {
78         if (o == null)
79             return false;
80
81         if (this == o)
82             return true;
83  
84         if (!(o instanceof NTSidPrimaryGroupPrincipal))
85             return false;
86         
87         return super.equals(o);
88     }
89  
90 }
91
Popular Tags