KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > security > auth > module > SolarisSystem


1 /*
2  * @(#)SolarisSystem.java 1.8 06/06/23
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.security.auth.module;
9
10 import javax.security.auth.*;
11 import javax.security.auth.login.*;
12
13 /**
14  * <p> This class implementation retrieves and makes available Solaris
15  * UID/GID/groups information for the current user.
16  *
17  * @version 1.8, 01/11/00
18  */

19 public class SolarisSystem {
20
21     private native void getSolarisInfo();
22
23     protected String JavaDoc username;
24     protected long uid;
25     protected long gid;
26     protected long[] groups;
27
28     /**
29      * Instantiate a <code>SolarisSystem</code> and load
30      * the native library to access the underlying system information.
31      */

32     public SolarisSystem() {
33     System.loadLibrary("jaas_unix");
34     getSolarisInfo();
35     }
36
37     /**
38      * Get the username for the current Solaris user.
39      *
40      * <p>
41      *
42      * @return the username for the current Solaris user.
43      */

44     public String JavaDoc getUsername() {
45     return username;
46     }
47
48     /**
49      * Get the UID for the current Solaris user.
50      *
51      * <p>
52      *
53      * @return the UID for the current Solaris user.
54      */

55     public long getUid() {
56     return uid;
57     }
58
59     /**
60      * Get the GID for the current Solaris user.
61      *
62      * <p>
63      *
64      * @return the GID for the current Solaris user.
65      */

66     public long getGid() {
67     return gid;
68     }
69
70     /**
71      * Get the supplementary groups for the current Solaris user.
72      *
73      * <p>
74      *
75      * @return the supplementary groups for the current Solaris user.
76      */

77     public long[] getGroups() {
78     return groups;
79     }
80 }
81
Popular Tags