2010-08-31 7 views
0

J'essaye d'écrire un client pour consommer DFS (Documentum Foundation Services) et essayer d'utiliser Kerberos pour l'authentification unique. Java et C# code échantillon (couche de productivité) dans la documentation donne la ligne suivante qui obtient le jeton binaire Kerberos:Comment obtenir un jeton nécessaire pour l'authentification DFS Kerberos?

octet [] ticket = ...

Je ne suis pas sûr de savoir comment à effectivement obtenir le jeton binaire, et le "..." ne m'aide pas. Est-ce que quelqu'un sait comment obtenir un ticket réel (jeton Kerberos) en utilisant Java ou C#?

Voici les exemples donnés pour Java et C#:

Java: Invoquer un service avec l'authentification Kerberos

KerberosTokenHandler handler = new KerberosTokenHandler(); 
IObjectService service = ServiceFactory 
.getInstance().getRemoteService(..., contextRoot, Arrays.asList((Handler) handler)); 
byte[] ticket = ...; 
handler.setBinarySecurityToken(
new KerberosBinarySecurityToken(ticket, KerberosValueType.KERBEROSV5_AP_REQ)); 
service.create(...) 

C#: Invoquer un service avec l'authentification Kerberos

KerberosTokenHandler handler = new KerberosTokenHandler(); 
List<IEndpointBehavior> handlers = new List<IEndpointBehavior>(); 
handlers.Add(handler); 
IObjectService service = ServiceFactory 
.Instance.GetRemoteService<IObjectService>(..., contextRoot, handlers); 
byte[] ticket = ...; 
handler.SetBinarySecurityToken(
new KerberosBinarySecurityToken(ticket, KerberosValueType.GSS_KERBEROSV5_AP_REQ)); 
service.create(...); 

Répondre

0

Je viens de comprendre cela pour .NET et je voudrais partager fo r ceux qui peuvent être intéressés. Ce qui est nécessaire, c'est la bibliothèque WSE3. Assurez-vous de configurer votre compte de service DFS pour la délégation Kerberos.

Donc ce que vous devez faire est de définir votre KerberosTokenHandler avec le jeton Kerberos. Le KerberosBinarySecurityToken provient de WSE3. Le code ressemblerait à ceci:

KerberosTokenHandler kerberosTokenHandler = new KerberosTokenHandler(); 

String servicePrincipalName = “DFS/example66”; // this is the service principal name for your DFS service account in Active Directory. 
using (KerberosClientContext kerberosClientContext = new KerberosClientContext(servicePrincipalName, true, ImpersonationLevel.Delegation)) 
{ 
     KerberosBinarySecurityToken token = new KerberosBinarySecurityToken(kerberosClientContext.InitializeContext(), KerberosValueType.KERBEROSV5_AP_REQ); 
     kerberosTokenHandlerandler.SetBinarySecurityToken(token); 
} 
Questions connexes