コード例 #1
0
 public void Delete(string id)
 {
     using (var entities = IdentityServerConfigurationContext.Get())
     {
         var rpEntity = new RelyingPartyEntity { Id = int.Parse(id) };
         entities.RelyingParties.Attach(rpEntity);
         entities.Entry(rpEntity).State = EntityState.Deleted;
         entities.SaveChanges();
     }
 }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: highwaychurch/web
        public static RelyingPartyEntity ToEntity(this RelyingPartyModel relyingParty)
        {
            var rpEntity = new RelyingPartyEntity
            {
                Name = relyingParty.Name,
                Realm = relyingParty.Realm.AbsoluteUri.StripProtocolMoniker(),
                ExtraData1 = relyingParty.ExtraData1,
                ExtraData2 = relyingParty.ExtraData2,
                ExtraData3 = relyingParty.ExtraData3,
            };

            if (!string.IsNullOrEmpty(relyingParty.Id))
            {
                rpEntity.Id = int.Parse(relyingParty.Id);
            }

            if (relyingParty.ReplyTo != null)
            {
                rpEntity.ReplyTo = relyingParty.ReplyTo.AbsoluteUri;
            }

            if (relyingParty.EncryptingCertificate != null)
            {
                rpEntity.EncryptingCertificate = Convert.ToBase64String(relyingParty.EncryptingCertificate.RawData);
            }

            if (relyingParty.SymmetricSigningKey != null && relyingParty.SymmetricSigningKey.Length != 0)
            {
                rpEntity.SymmetricSigningKey = Convert.ToBase64String(relyingParty.SymmetricSigningKey);
            }

            return rpEntity;
        }