public string GetPayload(GrantTokenViaClientCredentialsReceived parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            if (parameter.Parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter.Parameter));
            }

            var param    = parameter.Parameter;
            var clientId = GetClientId(parameter.AuthHeader);

            if (string.IsNullOrWhiteSpace(clientId))
            {
                clientId = param.ClientId;
            }

            var result = new Payload
            {
                ClientId      = clientId,
                Authorization = BuildAuthHeader(parameter.AuthHeader),
                Content       = param
            };

            return(JsonConvert.SerializeObject(result));
        }
Exemplo n.º 2
0
        public async Task Handle(GrantTokenViaClientCredentialsReceived message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            await Add(message.Id, message.ProcessId, message.Payload, "Start grant token via client credentials", message.Order, "client_credentials_grantype_started");
        }
        public async Task Handle(GrantTokenViaClientCredentialsReceived message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var payload = _serializer.GetPayload(message);

            await Add(message.Id, message.ProcessId, payload, "Start grant token via client credentials", message.Order);
        }
Exemplo n.º 4
0
 public void Handle(GrantTokenViaClientCredentialsReceived evt)
 {
     _repository.Add(new Core.Models.EventAggregate
     {
         Id          = evt.Id,
         AggregateId = evt.ProcessId,
         Description = "Start grant token via client credentials",
         CreatedOn   = DateTime.UtcNow,
         Payload     = evt.Payload,
         Order       = evt.Order,
         Type        = evt.ServerName,
         Verbosity   = Core.Models.EventVerbosities.Information,
         Key         = "client_credentials_grantype_started"
     }).Wait();
 }