Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoCredElement.java
38922 views
1
/*
2
* Copyright (c) 2005, 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
23
* 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
* @since 1.6
42
*/
43
public class SpNegoCredElement implements GSSCredentialSpi {
44
45
private GSSCredentialSpi cred = null;
46
47
public SpNegoCredElement(GSSCredentialSpi cred) throws GSSException {
48
this.cred = cred;
49
}
50
51
Oid getInternalMech() {
52
return cred.getMechanism();
53
}
54
55
// Used by GSSUtil.populateCredentials()
56
public GSSCredentialSpi getInternalCred() {
57
return cred;
58
}
59
60
public Provider getProvider() {
61
return SpNegoMechFactory.PROVIDER;
62
}
63
64
public void dispose() throws GSSException {
65
cred.dispose();
66
}
67
68
public GSSNameSpi getName() throws GSSException {
69
return cred.getName();
70
}
71
72
public int getInitLifetime() throws GSSException {
73
return cred.getInitLifetime();
74
}
75
76
public int getAcceptLifetime() throws GSSException {
77
return cred.getAcceptLifetime();
78
}
79
80
public boolean isInitiatorCredential() throws GSSException {
81
return cred.isInitiatorCredential();
82
}
83
84
public boolean isAcceptorCredential() throws GSSException {
85
return cred.isAcceptorCredential();
86
}
87
88
public Oid getMechanism() {
89
return GSSUtil.GSS_SPNEGO_MECH_OID;
90
}
91
92
@Override
93
public GSSCredentialSpi impersonate(GSSNameSpi name) throws GSSException {
94
return cred.impersonate(name);
95
}
96
}
97
98