Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoCredElement.java
38922 views
/*1* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package sun.security.jgss.spnego;2526import org.ietf.jgss.*;27import java.security.Provider;28import sun.security.jgss.GSSUtil;29import sun.security.jgss.ProviderList;30import sun.security.jgss.GSSCredentialImpl;31import sun.security.jgss.spi.GSSNameSpi;32import sun.security.jgss.spi.GSSCredentialSpi;3334/**35* This class is the cred element implementation for SPNEGO mech.36* NOTE: The current implementation can only support one mechanism.37* This should be changed once multi-mechanism support is needed.38*39* @author Valerie Peng40* @since 1.641*/42public class SpNegoCredElement implements GSSCredentialSpi {4344private GSSCredentialSpi cred = null;4546public SpNegoCredElement(GSSCredentialSpi cred) throws GSSException {47this.cred = cred;48}4950Oid getInternalMech() {51return cred.getMechanism();52}5354// Used by GSSUtil.populateCredentials()55public GSSCredentialSpi getInternalCred() {56return cred;57}5859public Provider getProvider() {60return SpNegoMechFactory.PROVIDER;61}6263public void dispose() throws GSSException {64cred.dispose();65}6667public GSSNameSpi getName() throws GSSException {68return cred.getName();69}7071public int getInitLifetime() throws GSSException {72return cred.getInitLifetime();73}7475public int getAcceptLifetime() throws GSSException {76return cred.getAcceptLifetime();77}7879public boolean isInitiatorCredential() throws GSSException {80return cred.isInitiatorCredential();81}8283public boolean isAcceptorCredential() throws GSSException {84return cred.isAcceptorCredential();85}8687public Oid getMechanism() {88return GSSUtil.GSS_SPNEGO_MECH_OID;89}9091@Override92public GSSCredentialSpi impersonate(GSSNameSpi name) throws GSSException {93return cred.impersonate(name);94}95}969798