APIdia Launch Partner
Top Description Inners Constructors Methods
sun.security.krb5.internal

public Class CredentialsUtil

extends Object
Class Inheritance
Imports
sun.security.krb5.*, java.io.IOException, java.util.LinkedList, .List

This class is a utility that contains much of the TGS-Exchange protocol. It is used by ../Credentials.java for service ticket acquisition in both the normal and the x-realm case.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Credentials

Returns:

the creds (cname=user, sname=backend)
acquireS4U2proxyCreds
(String
the name of the backend service
backend
,
Credentials
containing the user's service ticket to the middle server
userCreds
,
PrincipalName client, Credentials
the TGT of the middle server
middleTGT
)

Used by a middle server to acquire a service ticket to a backend server using the S4U2proxy extension.

public static Credentials

Returns:

the new creds (cname=user, sname=middle)
acquireS4U2selfCreds
(PrincipalName
the user to impersonate
user
,
Credentials
the TGT of the middle service
middleTGT
)

Used by a middle server to acquire credentials on behalf of a user to itself using the S4U2self extension.

public static Credentials
acquireServiceCreds(String
the name of service principal
service
,
Credentials
client's initial credential
initCreds
)

Acquires credentials for a specified service using initial credential.

private static Credentials

Returns:

the TGT for the other realm, null if cannot find a path
getTGTforRealm
(String
this realm
localRealm
,
String
the other realm, cannot equals to localRealm
serviceRealm
,
Credentials
TGT in this realm
localTGT
,
boolean[]
an [out] argument to receive the okAsDelegate property. True only if all realms allow delegation.
okAsDelegate
)

Gets a TGT to another realm

private static String

Returns:

the backend realm for the last S4U2Proxy request
handleS4U2ProxyReferral
(Credentials
middle service credentials used for the first S4U2Proxy request
asCreds
,
Credentials[]
(in/out parameter): * input: first S4U2Proxy referral TGT received, null * output: referral TGT for final S4U2Proxy service request, client referral TGT for final S4U2Proxy service request (to be sent as additional-ticket)
credsInOut
,
PrincipalName
the backend service name
sname
)

This method is called after receiving the first realm referral for a S4U2Proxy request.

private static void
handleS4U2SelfReferral(PAData[] pas, PrincipalName user, Credentials newCreds)

PA-FOR-USER may need to be regenerated if credentials change.

private static Credentials
private static Credentials
serviceCreds(KDCOptions options, Credentials asCreds, PrincipalName cname, PrincipalName sname, PrincipalName user, Credentials additionalCreds, PAData[] extraPAs, CredentialsUtil.S4U2Type s4u2Type)

private static Credentials
serviceCredsReferrals(KDCOptions options, Credentials asCreds, PrincipalName cname, PrincipalName sname, CredentialsUtil.S4U2Type s4u2Type, PrincipalName user, Credentials additionalCreds, PAData[] extraPAs)

private static Credentials
serviceCredsSingle(KDCOptions options, Credentials asCreds, PrincipalName cname, PrincipalName clientAlias, PrincipalName refSname, PrincipalName sname, CredentialsUtil.S4U2Type s4u2Type, PrincipalName user, Credentials additionalCreds, PAData[] extraPAs)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CredentialsUtilback to summary
public CredentialsUtil()

Method Detail

acquireS4U2proxyCredsback to summary
public static Credentials acquireS4U2proxyCreds(String backend, Credentials userCreds, PrincipalName client, Credentials middleTGT) throws KrbException, IOException

Used by a middle server to acquire a service ticket to a backend server using the S4U2proxy extension.

Parameters
backend:String

the name of the backend service

userCreds:Credentials

containing the user's service ticket to the middle server

middleTGT:Credentials

the TGT of the middle server

Returns:Credentials

the creds (cname=user, sname=backend)

acquireS4U2selfCredsback to summary
public static Credentials acquireS4U2selfCreds(PrincipalName user, Credentials middleTGT) throws KrbException, IOException

Used by a middle server to acquire credentials on behalf of a user to itself using the S4U2self extension.

Parameters
user:PrincipalName

the user to impersonate

middleTGT:Credentials

the TGT of the middle service

Returns:Credentials

the new creds (cname=user, sname=middle)

acquireServiceCredsback to summary
public static Credentials acquireServiceCreds(String service, Credentials initCreds) throws KrbException, IOException

Acquires credentials for a specified service using initial credential. When the service has a different realm from the initial credential, we do cross-realm authentication - first, we use the current credential to get a cross-realm credential from the local KDC, then use that cross-realm credential to request service credential from the foreign KDC.

Parameters
service:String

the name of service principal

initCreds:Credentials

client's initial credential

getTGTforRealmback to summary
private static Credentials getTGTforRealm(String localRealm, String serviceRealm, Credentials localTGT, boolean[] okAsDelegate) throws KrbException

Gets a TGT to another realm

Parameters
localRealm:String

this realm

serviceRealm:String

the other realm, cannot equals to localRealm

localTGT:Credentials

TGT in this realm

okAsDelegate:boolean[]

an [out] argument to receive the okAsDelegate property. True only if all realms allow delegation.

Returns:Credentials

the TGT for the other realm, null if cannot find a path

Exceptions
KrbException:
if something goes wrong
handleS4U2ProxyReferralback to summary
private static String handleS4U2ProxyReferral(Credentials asCreds, Credentials[] credsInOut, PrincipalName sname) throws KrbException, IOException

This method is called after receiving the first realm referral for a S4U2Proxy request. The credentials and tickets needed for the final S4U2Proxy request (in the referrals chain) are returned. Referrals are handled as described by MS-SFU (section 3.1.5.2.2 Receives Referral).

Parameters
asCreds:Credentials

middle service credentials used for the first S4U2Proxy request

credsInOut:Credentials[]

(in/out parameter): * input: first S4U2Proxy referral TGT received, null * output: referral TGT for final S4U2Proxy service request, client referral TGT for final S4U2Proxy service request (to be sent as additional-ticket)

sname:PrincipalName

the backend service name

Returns:String

the backend realm for the last S4U2Proxy request

handleS4U2SelfReferralback to summary
private static void handleS4U2SelfReferral(PAData[] pas, PrincipalName user, Credentials newCreds) throws Asn1Exception, KrbException, IOException

PA-FOR-USER may need to be regenerated if credentials change. This may happen when obtaining a TGT for a different realm or when using a referral TGT.

serviceCredsback to summary
private static Credentials serviceCreds(PrincipalName service, Credentials initCreds) throws KrbException, IOException
serviceCredsback to summary
private static Credentials serviceCreds(KDCOptions options, Credentials asCreds, PrincipalName cname, PrincipalName sname, PrincipalName user, Credentials additionalCreds, PAData[] extraPAs, CredentialsUtil.S4U2Type s4u2Type) throws KrbException, IOException
serviceCredsReferralsback to summary
private static Credentials serviceCredsReferrals(KDCOptions options, Credentials asCreds, PrincipalName cname, PrincipalName sname, CredentialsUtil.S4U2Type s4u2Type, PrincipalName user, Credentials additionalCreds, PAData[] extraPAs) throws KrbException, IOException
serviceCredsSingleback to summary
private static Credentials serviceCredsSingle(KDCOptions options, Credentials asCreds, PrincipalName cname, PrincipalName clientAlias, PrincipalName refSname, PrincipalName sname, CredentialsUtil.S4U2Type s4u2Type, PrincipalName user, Credentials additionalCreds, PAData[] extraPAs) throws KrbException, IOException
sun.security.krb5.internal back to summary

private final Enum CredentialsUtil.S4U2Type

extends Enum<CredentialsUtil.S4U2Type>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final CredentialsUtil.S4U2Type
public static final CredentialsUtil.S4U2Type
public static final CredentialsUtil.S4U2Type

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CredentialsUtil.S4U2Type
public static CredentialsUtil.S4U2Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

NONEback to summary
public static final CredentialsUtil.S4U2Type NONE
PROXYback to summary
public static final CredentialsUtil.S4U2Type PROXY
SELFback to summary
public static final CredentialsUtil.S4U2Type SELF

Constructor Detail

S4U2Typeback to summary
private S4U2Type()

Method Detail

valueOfback to summary
public static CredentialsUtil.S4U2Type valueOf(String name)
valuesback to summary
public static CredentialsUtil.S4U2Type[] values()