jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/NTSystem.java
changeset 30044 bab15bbe2ca3
parent 25859 3317bb8137f4
child 31538 0981099a3e54
equal deleted inserted replaced
30043:b0dd05ec3db1 30044:bab15bbe2ca3
    24  */
    24  */
    25 
    25 
    26 package com.sun.security.auth.module;
    26 package com.sun.security.auth.module;
    27 
    27 
    28 /**
    28 /**
    29  * <p> This class implementation retrieves and makes available NT
    29  * This class implementation retrieves and makes available NT
    30  * security information for the current user.
    30  * security information for the current user.
    31  *
    31  *
    32  */
    32  */
    33 @jdk.Exported
    33 @jdk.Exported
    34 public class NTSystem {
    34 public class NTSystem {
    43     private String groupIDs[];
    43     private String groupIDs[];
    44     private String primaryGroupID;
    44     private String primaryGroupID;
    45     private long   impersonationToken;
    45     private long   impersonationToken;
    46 
    46 
    47     /**
    47     /**
    48      * Instantiate an <code>NTSystem</code> and load
    48      * Instantiate an {@code NTSystem} and load
    49      * the native library to access the underlying system information.
    49      * the native library to access the underlying system information.
    50      */
    50      */
    51     public NTSystem() {
    51     public NTSystem() {
    52         this(false);
    52         this(false);
    53     }
    53     }
    54 
    54 
    55     /**
    55     /**
    56      * Instantiate an <code>NTSystem</code> and load
    56      * Instantiate an {@code NTSystem} and load
    57      * the native library to access the underlying system information.
    57      * the native library to access the underlying system information.
    58      */
    58      */
    59     NTSystem(boolean debug) {
    59     NTSystem(boolean debug) {
    60         loadNative();
    60         loadNative();
    61         getCurrent(debug);
    61         getCurrent(debug);
    62     }
    62     }
    63 
    63 
    64     /**
    64     /**
    65      * Get the username for the current NT user.
    65      * Get the username for the current NT user.
    66      *
    66      *
    67      * <p>
       
    68      *
       
    69      * @return the username for the current NT user.
    67      * @return the username for the current NT user.
    70      */
    68      */
    71     public String getName() {
    69     public String getName() {
    72         return userName;
    70         return userName;
    73     }
    71     }
    74 
    72 
    75     /**
    73     /**
    76      * Get the domain for the current NT user.
    74      * Get the domain for the current NT user.
    77      *
       
    78      * <p>
       
    79      *
    75      *
    80      * @return the domain for the current NT user.
    76      * @return the domain for the current NT user.
    81      */
    77      */
    82     public String getDomain() {
    78     public String getDomain() {
    83         return domain;
    79         return domain;
    84     }
    80     }
    85 
    81 
    86     /**
    82     /**
    87      * Get a printable SID for the current NT user's domain.
    83      * Get a printable SID for the current NT user's domain.
    88      *
    84      *
    89      * <p>
       
    90      *
       
    91      * @return a printable SID for the current NT user's domain.
    85      * @return a printable SID for the current NT user's domain.
    92      */
    86      */
    93     public String getDomainSID() {
    87     public String getDomainSID() {
    94         return domainSID;
    88         return domainSID;
    95     }
    89     }
    96 
    90 
    97     /**
    91     /**
    98      * Get a printable SID for the current NT user.
    92      * Get a printable SID for the current NT user.
    99      *
       
   100      * <p>
       
   101      *
    93      *
   102      * @return a printable SID for the current NT user.
    94      * @return a printable SID for the current NT user.
   103      */
    95      */
   104     public String getUserSID() {
    96     public String getUserSID() {
   105         return userSID;
    97         return userSID;
   106     }
    98     }
   107 
    99 
   108     /**
   100     /**
   109      * Get a printable primary group SID for the current NT user.
   101      * Get a printable primary group SID for the current NT user.
   110      *
   102      *
   111      * <p>
       
   112      *
       
   113      * @return the primary group SID for the current NT user.
   103      * @return the primary group SID for the current NT user.
   114      */
   104      */
   115     public String getPrimaryGroupID() {
   105     public String getPrimaryGroupID() {
   116         return primaryGroupID;
   106         return primaryGroupID;
   117     }
   107     }
   118 
   108 
   119     /**
   109     /**
   120      * Get the printable group SIDs for the current NT user.
   110      * Get the printable group SIDs for the current NT user.
   121      *
   111      *
   122      * <p>
       
   123      *
       
   124      * @return the group SIDs for the current NT user.
   112      * @return the group SIDs for the current NT user.
   125      */
   113      */
   126     public String[] getGroupIDs() {
   114     public String[] getGroupIDs() {
   127         return groupIDs == null ? null : groupIDs.clone();
   115         return groupIDs == null ? null : groupIDs.clone();
   128     }
   116     }
   129 
   117 
   130     /**
   118     /**
   131      * Get an impersonation token for the current NT user.
   119      * Get an impersonation token for the current NT user.
   132      *
       
   133      * <p>
       
   134      *
   120      *
   135      * @return an impersonation token for the current NT user.
   121      * @return an impersonation token for the current NT user.
   136      */
   122      */
   137     public synchronized long getImpersonationToken() {
   123     public synchronized long getImpersonationToken() {
   138         if (impersonationToken == 0) {
   124         if (impersonationToken == 0) {