KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)NTSidGroupPrincipal.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 one of the groups to which a Windows NT user belongs.
13  *
14  * <p> Principals such as this <code>NTSidGroupPrincipal</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  * @see com.sun.security.auth.NTSid
25  */

26 public class NTSidGroupPrincipal extends NTSid {
27
28     private static final long serialVersionUID = -1373347438636198229L;
29
30     /**
31      * Create an <code>NTSidGroupPrincipal</code> with a Windows NT group name.
32      *
33      * <p>
34      *
35      * @param name the 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 NTSidGroupPrincipal(String JavaDoc name) {
41         super(name);
42     }
43
44     /**
45      * Return a string representation of this <code>NTSidGroupPrincipal</code>.
46      *
47      * <p>
48      *
49      * @return a string representation of this <code>NTSidGroupPrincipal</code>.
50      */

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

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