public string GetPayload(GrantTokenViaAuthorizationCodeReceived 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));
        }
Beispiel #2
0
 public void Handle(GrantTokenViaAuthorizationCodeReceived evt)
 {
     _repository.Add(new Core.Models.EventAggregate
     {
         Id          = evt.Id,
         AggregateId = evt.ProcessId,
         Description = "Start grant token via authorization code",
         CreatedOn   = DateTime.UtcNow,
         Payload     = evt.Payload,
         Order       = evt.Order,
         Type        = evt.ServerName,
         Verbosity   = Core.Models.EventVerbosities.Information,
         Key         = "auth_code_grantype_started"
     }).Wait();
 }