public InitializeStep(string servicePrincipalName, string authorizationId, Sspi.SecurityContext context, byte[] bytesToSendToServer) { _servicePrincipalName = servicePrincipalName; _authorizationId = authorizationId; _context = context; _bytesToSendToServer = bytesToSendToServer ?? new byte[0]; }
// static methods public static SecurityContext Initialize(SecurityCredential credential, string servicePrincipalName, byte[] input, out byte[] output) { var context = new SecurityContext(); context._credential = credential; context.Initialize(servicePrincipalName, input, out output); return context; }
public FirstStep(string serviceName, string hostName, string realm, string username, SecureString password, SaslConversation conversation) { _authorizationId = username; _password = password; _servicePrincipalName = string.Format("{0}/{1}", serviceName, hostName); if (!string.IsNullOrEmpty(realm)) { _servicePrincipalName += "@" + realm; } SecurityCredential securityCredential; try { securityCredential = SecurityCredential.Acquire(SspiPackage.Kerberos, _authorizationId, _password); conversation.RegisterItemForDisposal(securityCredential); } catch (Win32Exception ex) { throw new MongoAuthenticationException(conversation.ConnectionId, "Unable to acquire security credential.", ex); } try { _context = Sspi.SecurityContext.Initialize(securityCredential, _servicePrincipalName, null, out _bytesToSendToServer); } catch (Win32Exception ex) { if (_password != null) { throw new MongoAuthenticationException(conversation.ConnectionId, "Unable to initialize security context. Ensure the username and password are correct.", ex); } else { throw new MongoAuthenticationException(conversation.ConnectionId, "Unable to initialize security context.", ex); } } }
public NegotiateStep(string authorizationId, Sspi.SecurityContext context, byte[] bytesToSendToServer) { _authorizationId = authorizationId; _context = context; _bytesToSendToServer = bytesToSendToServer ?? new byte[0]; }
public NegotiateStep(string authorizationId, Sspi.SecurityContext context, byte[] bytesToSendToServer) { _authorizationId = authorizationId; _context = context; _bytesToSendToServer = bytesToSendToServer ?? new byte[0]; }
public InitializeStep(string servicePrincipalName, string authorizationId, Sspi.SecurityContext context, byte[] bytesToSendToServer) { _servicePrincipalName = servicePrincipalName; _authorizationId = authorizationId; _context = context; _bytesToSendToServer = bytesToSendToServer ?? new byte[0]; }