Ejemplo n.º 1
0
        public override async Task ServiceReady(ServiceSessionOperationMessage request, IMemoryChannel channel, DataTransferContext context)
        {
            try
            {
                if (string.IsNullOrEmpty(request.ResponderFor))
                {
                    CheckAuth(context, "ActAsService");
                }
                else
                {
                    CheckAuth(context, "ConnectAnyService", request.ResponderFor);
                }

                await base.ServiceReady(request, channel, context);
            }
            catch (Exception ex)
            {
                LogEnvironment.LogEvent(ex.OutlineException(), LogSeverity.Error);
                throw;
            }
            finally
            {
                TemporaryGrants.UnRegisterService(request.ServiceName);
                if (!string.IsNullOrEmpty(request.ResponderFor))
                {
                    TemporaryGrants.RevokeTemporaryPermission(request.ResponderFor, request.ServiceName);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
 public void Dispose()
 {
     if (initialized && !string.IsNullOrEmpty(ServiceName))
     {
         localProvider.Broker.UnRegisterService(this);
         if (!string.IsNullOrEmpty(consumedService) && !string.IsNullOrEmpty(ServiceName))
         {
             TemporaryGrants.RevokeTemporaryPermission(consumedService, ServiceName);
         }
     }
 }