1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
40 * intended to provide a "login to the network" function, as such a
41 * function would involve the creation of new credentials rather than
42 * merely acquiring a handle to existing credentials. The
43 * <a href=package-summary.html#useSubjectCredsOnly>section on credential
44 * acquisition</a> in the package level description describes
45 * how existing credentials are acquired in the Java platform. GSS-API
46 * implementations must impose a local access-control policy on callers to
47 * prevent unauthorized callers from acquiring credentials to which they
48 * are not entitled. <p>
49 *
50 * Applications will create a credential object passing the desired
51 * parameters. The application can then use the query methods to obtain
52 * specific information about the instantiated credential object.
53 * When the credential is no longer needed, the application should call
54 * the {@link #dispose() dispose} method to release any resources held by
55 * the credential object and to destroy any cryptographically sensitive
56 * information.<p>
57 *
58 * This example code demonstrates the creation of a GSSCredential
59 * implementation for a specific entity, querying of its fields, and its
60 * release when it is no longer needed:<p>
61 * <pre>
62 * GSSManager manager = GSSManager.getInstance();
63 *
64 * // start by creating a name object for the entity
65 * GSSName name = manager.createName("myusername", GSSName.NT_USER_NAME);
66 *
67 * // now acquire credentials for the entity
68 * GSSCredential cred = manager.createCredential(name,
69 * GSSCredential.ACCEPT_ONLY);
70 *
71 * // display credential information - name, remaining lifetime,
72 * // and the mechanisms it has been acquired over
73 * System.out.println(cred.getName().toString());
74 * System.out.println(cred.getRemainingLifetime());
75 *
76 * Oid [] mechs = cred.getMechs();
77 * if (mechs != null) {
78 * for (int i = 0; i < mechs.length; i++)
79 * System.out.println(mechs[i].toString());
80 * }
|
1 /*
2 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
40 * intended to provide a "login to the network" function, as such a
41 * function would involve the creation of new credentials rather than
42 * merely acquiring a handle to existing credentials. The
43 * <a href=package-summary.html#useSubjectCredsOnly>section on credential
44 * acquisition</a> in the package level description describes
45 * how existing credentials are acquired in the Java platform. GSS-API
46 * implementations must impose a local access-control policy on callers to
47 * prevent unauthorized callers from acquiring credentials to which they
48 * are not entitled. <p>
49 *
50 * Applications will create a credential object passing the desired
51 * parameters. The application can then use the query methods to obtain
52 * specific information about the instantiated credential object.
53 * When the credential is no longer needed, the application should call
54 * the {@link #dispose() dispose} method to release any resources held by
55 * the credential object and to destroy any cryptographically sensitive
56 * information.<p>
57 *
58 * This example code demonstrates the creation of a GSSCredential
59 * implementation for a specific entity, querying of its fields, and its
60 * release when it is no longer needed:
61 * <pre>
62 * GSSManager manager = GSSManager.getInstance();
63 *
64 * // start by creating a name object for the entity
65 * GSSName name = manager.createName("myusername", GSSName.NT_USER_NAME);
66 *
67 * // now acquire credentials for the entity
68 * GSSCredential cred = manager.createCredential(name,
69 * GSSCredential.ACCEPT_ONLY);
70 *
71 * // display credential information - name, remaining lifetime,
72 * // and the mechanisms it has been acquired over
73 * System.out.println(cred.getName().toString());
74 * System.out.println(cred.getRemainingLifetime());
75 *
76 * Oid [] mechs = cred.getMechs();
77 * if (mechs != null) {
78 * for (int i = 0; i < mechs.length; i++)
79 * System.out.println(mechs[i].toString());
80 * }
|