Пример #1
0
        public void OnAuthorizationResponse(object?sender, AuthorizationResponseEventArg args)
        {
            if (args.Response.IsAuthorizationRequired && (args.Response.Entitlements == null || args.Response.Entitlements.Count == 0))
            {
                // Inform the subscriber that they are not entitled.
                var message = new ForwardedMulticastData(string.Empty, string.Empty, args.Response.Feed, args.Response.Topic, true, null);
                try
                {
                    args.Requester.SendMessage(message);
                }
                catch (Exception error)
                {
                    _logger.LogDebug(error, "Failed to send to {Requester} multi cast message {Message}", args.Requester, message);
                }

                return;
            }

            AddSubscription(
                args.Requester,
                args.Response.Feed,
                args.Response.Topic,
                args.Response.IsAuthorizationRequired,
                args.Response.Entitlements,
                !args.IsInitial);
        }
Пример #2
0
        internal void OnAuthorizationResponse(object sender, AuthorizationResponseEventArg args)
        {
            if (args.Response.IsAuthorizationRequired && (args.Response.Entitlements == null || args.Response.Entitlements.Length == 0))
            {
                var message = new ForwardedMulticastData(string.Empty, IPAddress.None, args.Response.Feed, args.Response.Topic, true, null);
                try
                {
                    args.Requester.SendMessage(message);
                }
                catch (Exception exception)
                {
                    Log.Debug($"Failed to send to {args.Requester} multi cast message {message}", exception);
                }

                return;
            }

            _repository.AddSubscription(args.Requester, args.Response.Feed, args.Response.Topic, new AuthorizationInfo(args.Response.IsAuthorizationRequired, new HashSet <Guid>(args.Response.Entitlements ?? new Guid[0])));
            _notificationManager.ForwardSubscription(args.Requester, new SubscriptionRequest(args.Response.Feed, args.Response.Topic, true));
        }