Domanda

Sto cercando di scrivere un client per consumare DFS (Documentum Foundation Services) e cercando di utilizzare Kerberos per il single sign-on. Entrambi # codice di esempio Java e C (strato di produttività) nella documentazione ha pronunciato la seguente linea che ottiene il Kerberos binario token:

  

byte [] = biglietto ...

Non sono sicuro di come effettivamente ottenere il file binario del token , e la "..." non mi aiuti. Qualcuno sa come ottenere un biglietto vero e proprio (Kerberos token) utilizzando Java o C #?

Ecco gli esempi forniti sia per Java e C #:

Java: Invocare un servizio con l'autenticazione 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 #: Invocare un servizio con l'autenticazione 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(...);
È stato utile?

Soluzione

Ho appena capito questo per NET e vorrebbe quota per coloro che forse interessava. Ciò che serve è la libreria WSE3. Assicurarsi di configurare il proprio account servizio DFS per la delega Kerberos.

Allora, cosa dobbiamo fare è impostare il KerberosTokenHandler con il token Kerberos. Il KerberosBinarySecurityToken viene da WSE3. Il codice dovrebbe essere simile a questa:

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);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top