01: /*
02: * Copyright 2005 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: package sun.security.jgss.spnego;
26:
27: import org.ietf.jgss.*;
28: import java.security.Provider;
29: import sun.security.jgss.GSSUtil;
30: import sun.security.jgss.ProviderList;
31: import sun.security.jgss.GSSCredentialImpl;
32: import sun.security.jgss.spi.GSSNameSpi;
33: import sun.security.jgss.spi.GSSCredentialSpi;
34:
35: /**
36: * This class is the cred element implementation for SPNEGO mech.
37: * NOTE: The current implementation can only support one mechanism.
38: * This should be changed once multi-mechanism support is needed.
39: *
40: * @author Valerie Peng
41: * @version 1.9, 05/05/07
42: * @since 1.6
43: */
44: public class SpNegoCredElement implements GSSCredentialSpi {
45:
46: private GSSCredentialSpi cred = null;
47:
48: SpNegoCredElement(GSSCredentialSpi cred) throws GSSException {
49: this .cred = cred;
50: }
51:
52: Oid getInternalMech() {
53: return cred.getMechanism();
54: }
55:
56: // Used by GSSUtil.populateCredentials()
57: public GSSCredentialSpi getInternalCred() {
58: return cred;
59: }
60:
61: public Provider getProvider() {
62: return SpNegoMechFactory.PROVIDER;
63: }
64:
65: public void dispose() throws GSSException {
66: cred.dispose();
67: }
68:
69: public GSSNameSpi getName() throws GSSException {
70: return cred.getName();
71: }
72:
73: public int getInitLifetime() throws GSSException {
74: return cred.getInitLifetime();
75: }
76:
77: public int getAcceptLifetime() throws GSSException {
78: return cred.getAcceptLifetime();
79: }
80:
81: public boolean isInitiatorCredential() throws GSSException {
82: return cred.isInitiatorCredential();
83: }
84:
85: public boolean isAcceptorCredential() throws GSSException {
86: return cred.isAcceptorCredential();
87: }
88:
89: public Oid getMechanism() {
90: return GSSUtil.GSS_SPNEGO_MECH_OID;
91: }
92: }
|