本文整理汇总了Java中sun.security.jgss.krb5.ServiceCreds类的典型用法代码示例。如果您正苦于以下问题:Java ServiceCreds类的具体用法?Java ServiceCreds怎么用?Java ServiceCreds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceCreds类属于sun.security.jgss.krb5包,在下文中一共展示了ServiceCreds类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getServiceCreds
import sun.security.jgss.krb5.ServiceCreds; //导入依赖的package包/类
@Override
public Object getServiceCreds(AccessControlContext acc)
throws LoginException {
ServiceCreds serviceCreds =
Krb5Util.getServiceCreds(GSSCaller.CALLER_SSL_SERVER, null, acc);
return serviceCreds;
}
示例2: getServerPrincipalName
import sun.security.jgss.krb5.ServiceCreds; //导入依赖的package包/类
@Override
public String getServerPrincipalName(Object serviceCreds) {
return ((ServiceCreds)serviceCreds).getName();
}
示例3: getServiceCreds
import sun.security.jgss.krb5.ServiceCreds; //导入依赖的package包/类
@Override
public Object getServiceCreds(AccessControlContext acc) {
try {
ServiceCreds serviceCreds = AccessController.doPrivileged(
(PrivilegedExceptionAction<ServiceCreds>)
() -> Krb5Util.getServiceCreds(
GSSCaller.CALLER_SSL_SERVER, null, acc));
if (serviceCreds == null) {
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Kerberos serviceCreds not available");
}
return null;
}
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Using Kerberos creds");
}
String serverPrincipal = serviceCreds.getName();
if (serverPrincipal != null) {
// When service is bound, we check ASAP. Otherwise,
// will check after client request is received
// in in Kerberos ClientKeyExchange
SecurityManager sm = System.getSecurityManager();
try {
if (sm != null) {
// Eliminate dependency on ServicePermission
sm.checkPermission(new ServicePermission(
serverPrincipal, "accept"), acc);
}
} catch (SecurityException se) {
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Permission to access Kerberos"
+ " secret key denied");
}
return null;
}
}
return serviceCreds;
} catch (PrivilegedActionException e) {
// Likely exception here is LoginException
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Attempt to obtain Kerberos key failed: "
+ e.toString());
}
return null;
}
}