public ClientRequestInfo(ClientInfo sender, ClientRequest request, DateTime receivedAt) { Request = request; Sender = sender; ReceivedAt = receivedAt; }
public ClientRequestInfo(ClientInfo sender, ClientRequest request) : this(sender, request, DateTime.Now) { }
private bool VerifySecurity(ClientInfo client) { // Set current thread principal to remote client's user principal. Thread.CurrentPrincipal = client.ClientUser; // Retrieve previously initialized security provider of the remote client's user. if (SecurityProviderCache.CurrentProvider == null) SecurityProviderCache.CurrentProvider = SecurityProviderUtility.CreateProvider(string.Empty); // Initialize security provider for the remote client's user from specified credentials. if (!Thread.CurrentPrincipal.Identity.IsAuthenticated && !string.IsNullOrEmpty(client.ClientUserCredentials)) { string[] credentialParts = client.ClientUserCredentials.Split(':'); if (credentialParts.Length == 2) { ISecurityProvider provider = SecurityProviderUtility.CreateProvider(credentialParts[0]); provider.Initialize(); if (provider.Authenticate(credentialParts[1])) SecurityProviderCache.CurrentProvider = provider; } } // Save the initialized security provider of remote client's user for subsequent uses. if (client.ClientUser != Thread.CurrentPrincipal) client.SetClientUser(Thread.CurrentPrincipal); return client.ClientUser.Identity.IsAuthenticated; }
/// <summary> /// Initializes a new instance of the <see cref="ClientRequestInfo"/> class. /// </summary> /// <param name="sender"><see cref="ClientInfo"/> object of the <paramref name="request"/> sender.</param> /// <param name="request"><see cref="ClientRequest"/> object sent by the <paramref name="sender"/>.</param> public ClientRequestInfo(ClientInfo sender, ClientRequest request) { Request = request; Sender = sender; ReceivedAt = DateTime.Now; }
/// <summary> /// Raises the <see cref="ReceivedClientRequest"/> event. /// </summary> /// <param name="request">The <see cref="ClientRequest"/> that was received.</param> /// <param name="requestSender">The <see cref="ClientInfo"/> object of the <paramref name="request"/> sender.</param> protected virtual void OnReceivedClientRequest(ClientRequest request, ClientInfo requestSender) { if (ReceivedClientRequest != null) ReceivedClientRequest(this, new EventArgs<Guid, ClientRequest>(requestSender.ClientID, request)); }