1. /*
  2. * @(#)NTSidPrimaryGroupPrincipal.java 1.12 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.security.auth;
  8. /**
  9. * <p> This class extends <code>NTSid</code>
  10. * and represents a Windows NT user's primary group SID.
  11. *
  12. * <p> Principals such as this <code>NTSidPrimaryGroupPrincipal</code>
  13. * may be associated with a particular <code>Subject</code>
  14. * to augment that <code>Subject</code> with an additional
  15. * identity. Refer to the <code>Subject</code> class for more information
  16. * on how to achieve this. Authorization decisions can then be based upon
  17. * the Principals associated with a <code>Subject</code>.
  18. *
  19. * @version 1.12, 01/23/03
  20. * @see java.security.Principal
  21. * @see javax.security.auth.Subject
  22. */
  23. public class NTSidPrimaryGroupPrincipal extends NTSid {
  24. /**
  25. * Create an <code>NTSidPrimaryGroupPrincipal</code> with a Windows NT
  26. * group SID.
  27. *
  28. * <p>
  29. *
  30. * @param name the primary Windows NT group SID for this user. <p>
  31. *
  32. * @exception NullPointerException if the <code>name</code>
  33. * is <code>null</code>.
  34. */
  35. public NTSidPrimaryGroupPrincipal(String name) {
  36. super(name);
  37. }
  38. /**
  39. * Return a string representation of this
  40. * <code>NTSidPrimaryGroupPrincipal</code>.
  41. *
  42. * <p>
  43. *
  44. * @return a string representation of this
  45. * <code>NTSidPrimaryGroupPrincipal</code>.
  46. */
  47. public String toString() {
  48. java.text.MessageFormat form = new java.text.MessageFormat
  49. (sun.security.util.ResourcesMgr.getString
  50. ("NTSidPrimaryGroupPrincipal: name",
  51. "sun.security.util.AuthResources"));
  52. Object[] source = {getName()};
  53. return form.format(source);
  54. }
  55. /**
  56. * Compares the specified Object with this
  57. * <code>NTSidPrimaryGroupPrincipal</code>
  58. * for equality. Returns true if the given object is also a
  59. * <code>NTSidPrimaryGroupPrincipal</code> and the two
  60. * NTSidPrimaryGroupPrincipals have the same SID.
  61. *
  62. * <p>
  63. *
  64. * @param o Object to be compared for equality with this
  65. * <code>NTSidPrimaryGroupPrincipal</code>.
  66. *
  67. * @return true if the specified Object is equal equal to this
  68. * <code>NTSidPrimaryGroupPrincipal</code>.
  69. */
  70. public boolean equals(Object o) {
  71. if (o == null)
  72. return false;
  73. if (this == o)
  74. return true;
  75. if (!(o instanceof NTSidPrimaryGroupPrincipal))
  76. return false;
  77. return super.equals(o);
  78. }
  79. }