public static RelyingParty ToDomainModel(this RelyingPartyEntity entity)
        {
            var model = new RelyingParty
            {
                Id         = entity.RowKey,
                Realm      = new Uri("http://" + entity.RealmHost + entity.RealmPath),
                Name       = entity.Description,
                ExtraData1 = entity.ExtraData1,
                ExtraData2 = entity.ExtraData2,
                ExtraData3 = entity.ExtraData3
            };

            if (entity.EncryptingCertificate != null)
            {
                model.EncryptingCertificate = new X509Certificate2(Convert.FromBase64String(entity.EncryptingCertificate));
            }

            if (!string.IsNullOrWhiteSpace(entity.ReplyToAddress))
            {
                model.ReplyTo = new Uri(entity.ReplyToAddress);
            }

            if (!string.IsNullOrWhiteSpace(entity.SymmetricSigningKey))
            {
                model.SymmetricSigningKey = Convert.FromBase64String(entity.SymmetricSigningKey);
            }

            return(model);
        }
Ejemplo n.º 2
0
        public void DeleteRelyingParty(string partitionKey, string id)
        {
            var entity = new RelyingPartyEntity
            {
                PartitionKey = partitionKey,
                RowKey       = id
            };

            AttachTo(RelyingPartiesTable, entity, "*");
            DeleteObject(entity);
            SaveChangesWithRetries();
        }
        public static RelyingPartyEntity ToEntity(this RelyingParty model, string id, string partitionKey)
        {
            var entity = new RelyingPartyEntity
            {
                PartitionKey = partitionKey,
                RowKey       = id,
                RealmHost    = model.Realm.DnsSafeHost.ToLowerInvariant(),
                RealmPath    = model.Realm.PathAndQuery.ToLowerInvariant(),
                Description  = model.Name,
                ExtraData1   = model.ExtraData1 ?? "",
                ExtraData2   = model.ExtraData2 ?? "",
                ExtraData3   = model.ExtraData3 ?? "",
            };

            if (model.ReplyTo != null)
            {
                entity.ReplyToAddress = model.ReplyTo.AbsoluteUri;
            }
            else
            {
                entity.ReplyToAddress = "";
            }

            if (model.EncryptingCertificate != null)
            {
                entity.EncryptingCertificate = Convert.ToBase64String(model.EncryptingCertificate.RawData);
            }

            if (model.SymmetricSigningKey != null && model.SymmetricSigningKey.Length != 0)
            {
                entity.SymmetricSigningKey = Convert.ToBase64String(model.SymmetricSigningKey);
            }
            else
            {
                entity.SymmetricSigningKey = "";
            }

            return(entity);
        }
        public static RelyingPartyEntity ToEntity(this RelyingParty model, string id, string partitionKey)
        {
            var entity = new RelyingPartyEntity
            {
                PartitionKey = partitionKey,
                RowKey = id,
                RealmHost = model.Realm.DnsSafeHost.ToLowerInvariant(),
                RealmPath = model.Realm.PathAndQuery.ToLowerInvariant(),
                Description = model.Name,
                ExtraData1 = model.ExtraData1 ?? "",
                ExtraData2 = model.ExtraData2 ?? "",
                ExtraData3 = model.ExtraData3 ?? "",
            };

            if (model.ReplyTo != null)
            {
                entity.ReplyToAddress = model.ReplyTo.AbsoluteUri;
            }
            else
            {
                entity.ReplyToAddress = "";
            }

            if (model.EncryptingCertificate != null)
            {
                entity.EncryptingCertificate = Convert.ToBase64String(model.EncryptingCertificate.RawData);
            }

            if (model.SymmetricSigningKey != null && model.SymmetricSigningKey.Length != 0)
            {
                entity.SymmetricSigningKey = Convert.ToBase64String(model.SymmetricSigningKey);
            }
            else
            {
                entity.SymmetricSigningKey = "";
            }

            return entity;
        }
Ejemplo n.º 5
0
 public void UpdateRelyingParty(RelyingPartyEntity entity)
 {
     AttachTo(RelyingPartiesTable, entity, "*");
     UpdateObject(entity);
     SaveChangesWithRetries();
 }
Ejemplo n.º 6
0
 public void AddRelyingParty(RelyingPartyEntity entity)
 {
     AddEntity(entity, RelyingPartiesTable);
 }
 public void UpdateRelyingParty(RelyingPartyEntity entity)
 {
     AttachTo(RelyingPartiesTable, entity, "*");
     UpdateObject(entity);
     SaveChangesWithRetries();
 }
        public void DeleteRelyingParty(string partitionKey, string id)
        {
            var entity = new RelyingPartyEntity
            {
                PartitionKey = partitionKey,
                RowKey = id
            };

            AttachTo(RelyingPartiesTable, entity, "*");
            DeleteObject(entity);
            SaveChangesWithRetries();
        }
 public void AddRelyingParty(RelyingPartyEntity entity)
 {
     AddEntity(entity, RelyingPartiesTable);
 }