jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java
changeset 30044 bab15bbe2ca3
parent 28059 e576535359cc
child 34894 3248b89d1921
equal deleted inserted replaced
30043:b0dd05ec3db1 30044:bab15bbe2ca3
    24  */
    24  */
    25 
    25 
    26 package com.sun.security.auth;
    26 package com.sun.security.auth;
    27 
    27 
    28 /**
    28 /**
    29  * <p> This class abstracts an NT security token
    29  * This class abstracts an NT security token
    30  * and provides a mechanism to do same-process security impersonation.
    30  * and provides a mechanism to do same-process security impersonation.
    31  *
       
    32  */
    31  */
    33 
    32 
    34 @jdk.Exported
    33 @jdk.Exported
    35 public class NTNumericCredential {
    34 public class NTNumericCredential {
    36 
    35 
    37     private long impersonationToken;
    36     private long impersonationToken;
    38 
    37 
    39     /**
    38     /**
    40      * Create an <code>NTNumericCredential</code> with an integer value.
    39      * Create an {@code NTNumericCredential} with an integer value.
    41      *
    40      *
    42      * <p>
    41      * @param token the Windows NT security token for this user.
    43      *
       
    44      * @param token the Windows NT security token for this user. <p>
       
    45      *
       
    46      */
    42      */
    47     public NTNumericCredential(long token) {
    43     public NTNumericCredential(long token) {
    48         this.impersonationToken = token;
    44         this.impersonationToken = token;
    49     }
    45     }
    50 
    46 
    51     /**
    47     /**
    52      * Return an integer representation of this
    48      * Return an integer representation of this
    53      * <code>NTNumericCredential</code>.
    49      * {@code NTNumericCredential}.
    54      *
       
    55      * <p>
       
    56      *
    50      *
    57      * @return an integer representation of this
    51      * @return an integer representation of this
    58      *          <code>NTNumericCredential</code>.
    52      *          {@code NTNumericCredential}.
    59      */
    53      */
    60     public long getToken() {
    54     public long getToken() {
    61         return impersonationToken;
    55         return impersonationToken;
    62     }
    56     }
    63 
    57 
    64     /**
    58     /**
    65      * Return a string representation of this <code>NTNumericCredential</code>.
    59      * Return a string representation of this {@code NTNumericCredential}.
    66      *
    60      *
    67      * <p>
    61      * @return a string representation of this {@code NTNumericCredential}.
    68      *
       
    69      * @return a string representation of this <code>NTNumericCredential</code>.
       
    70      */
    62      */
    71     public String toString() {
    63     public String toString() {
    72         java.text.MessageFormat form = new java.text.MessageFormat
    64         java.text.MessageFormat form = new java.text.MessageFormat
    73                 (sun.security.util.ResourcesMgr.getString
    65                 (sun.security.util.ResourcesMgr.getString
    74                         ("NTNumericCredential.name",
    66                         ("NTNumericCredential.name",
    76         Object[] source = {Long.toString(impersonationToken)};
    68         Object[] source = {Long.toString(impersonationToken)};
    77         return form.format(source);
    69         return form.format(source);
    78     }
    70     }
    79 
    71 
    80     /**
    72     /**
    81      * Compares the specified Object with this <code>NTNumericCredential</code>
    73      * Compares the specified Object with this {@code NTNumericCredential}
    82      * for equality.  Returns true if the given object is also a
    74      * for equality.  Returns true if the given object is also a
    83      * <code>NTNumericCredential</code> and the two NTNumericCredentials
    75      * {@code NTNumericCredential} and the two NTNumericCredentials
    84      * represent the same NT security token.
    76      * represent the same NT security token.
    85      *
    77      *
    86      * <p>
       
    87      *
       
    88      * @param o Object to be compared for equality with this
    78      * @param o Object to be compared for equality with this
    89      *          <code>NTNumericCredential</code>.
    79      *          {@code NTNumericCredential}.
    90      *
    80      *
    91      * @return true if the specified Object is equal to this
    81      * @return true if the specified Object is equal to this
    92      *          <code>NTNumericCredential</code>.
    82      *          {@code NTNumericCredential}.
    93      */
    83      */
    94     public boolean equals(Object o) {
    84     public boolean equals(Object o) {
    95         if (o == null)
    85         if (o == null)
    96             return false;
    86             return false;
    97 
    87 
   106             return true;
    96             return true;
   107         return false;
    97         return false;
   108     }
    98     }
   109 
    99 
   110     /**
   100     /**
   111      * Return a hash code for this <code>NTNumericCredential</code>.
   101      * Return a hash code for this {@code NTNumericCredential}.
   112      *
   102      *
   113      * <p>
   103      * @return a hash code for this {@code NTNumericCredential}.
   114      *
       
   115      * @return a hash code for this <code>NTNumericCredential</code>.
       
   116      */
   104      */
   117     public int hashCode() {
   105     public int hashCode() {
   118         return (int)this.impersonationToken;
   106         return (int)this.impersonationToken;
   119     }
   107     }
   120 }
   108 }