01: /*
02: * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package com.sun.security.auth.module;
27:
28: import javax.security.auth.*;
29: import javax.security.auth.login.*;
30:
31: /**
32: * <p> This class implementation retrieves and makes available Solaris
33: * UID/GID/groups information for the current user.
34: *
35: * @version 1.8, 01/11/00
36: */
37: public class SolarisSystem {
38:
39: private native void getSolarisInfo();
40:
41: protected String username;
42: protected long uid;
43: protected long gid;
44: protected long[] groups;
45:
46: /**
47: * Instantiate a <code>SolarisSystem</code> and load
48: * the native library to access the underlying system information.
49: */
50: public SolarisSystem() {
51: System.loadLibrary("jaas_unix");
52: getSolarisInfo();
53: }
54:
55: /**
56: * Get the username for the current Solaris user.
57: *
58: * <p>
59: *
60: * @return the username for the current Solaris user.
61: */
62: public String getUsername() {
63: return username;
64: }
65:
66: /**
67: * Get the UID for the current Solaris user.
68: *
69: * <p>
70: *
71: * @return the UID for the current Solaris user.
72: */
73: public long getUid() {
74: return uid;
75: }
76:
77: /**
78: * Get the GID for the current Solaris user.
79: *
80: * <p>
81: *
82: * @return the GID for the current Solaris user.
83: */
84: public long getGid() {
85: return gid;
86: }
87:
88: /**
89: * Get the supplementary groups for the current Solaris user.
90: *
91: * <p>
92: *
93: * @return the supplementary groups for the current Solaris user.
94: */
95: public long[] getGroups() {
96: return groups;
97: }
98: }
|