KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > security > jgss > GSSUtil


1 /*
2  * @(#)GSSUtil.java 1.9 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7   
8 package com.sun.security.jgss;
9
10 import javax.security.auth.Subject JavaDoc;
11 import org.ietf.jgss.GSSName JavaDoc;
12 import org.ietf.jgss.GSSCredential JavaDoc;
13
14 /**
15  * GSS-API Utilities for using in conjunction with Sun Microsystem's
16  * implementation of Java GSS-API.
17  */

18 public class GSSUtil {
19
20     /**
21      * Use this method to convert a GSSName and GSSCredential into a
22      * Subject. Typically this would be done by a server that wants to
23      * impersonate a client thread at the Java level by setting a client
24      * Subject in the current access control context. If the server is merely
25      * interested in using a principal based policy in its local JVM, then
26      * it only needs to provide the GSSName of the client.
27      *
28      * The elements from the GSSName are placed in the principals set of this
29      * Subject and those from the GSSCredential are placed in the private
30      * credentials set of the Subject. Any Kerberos specific elements that
31      * are added to the subject will be instances of the standard Kerberos
32      * implementation classes defined in javax.security.auth.kerberos.
33      *
34      * @return a Subject with the entries that contain elements from the
35      * given GSSName and GSSCredential.
36      *
37      * @param principals a GSSName containing one or more mechanism specific
38      * representations of the same entity. These mechanism specific
39      * representations will be populated in the returned Subject's principal
40      * set.
41      *
42      * @param credentials a GSSCredential containing one or more mechanism
43      * specific credentials for the same entity. These mechanism specific
44      * credentials will be populated in the returned Subject's private
45      * credential set. Passing in a value of null will imply that the private
46      * credential set should be left empty.
47      */

48     public static Subject JavaDoc createSubject(GSSName JavaDoc principals,
49                      GSSCredential JavaDoc credentials) {
50
51     return sun.security.jgss.GSSUtil.getSubject(principals,
52                              credentials);
53     }
54 }
55
Popular Tags