Ejemplo n.º 1
0
        public AddClaim()
        {
            InitializeComponent();
            cboStandardClaims.DisplayMember = "DisplayTag";
            List <CardClaim> standardClaims = ManagedCardHelper.GetStandardClaims();

            foreach (CardClaim claim in standardClaims)
            {
                cboStandardClaims.Items.Add(claim);
            }
        }
Ejemplo n.º 2
0
        private void CreateICToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InformationCardTemplate ict = PopulateCardTemplateFromUI();

            saveFileDialog1.Filter = "Managed Card (*.crd)|*.crd";
            DialogResult dr = saveFileDialog1.ShowDialog();

            string filename = saveFileDialog1.FileName;

            ManagedCardHelper.SaveCardTemplate(ict, filename);
        }
Ejemplo n.º 3
0
        private void btnCreatCard_Click(object sender, EventArgs e)
        {
            InformationCard ic = PopulateCard();

            saveFileDialog1.Filter = "Managed Card|*.crd";
            DialogResult dr = saveFileDialog1.ShowDialog();

            string    filename  = saveFileDialog1.FileName;
            StoreName storeName = StoreName.My;

            X509Certificate2 certificate = ManagedCardHelper.RetrieveCertificate(tbCertificatePath.Text);



            ManagedCardHelper.SaveCard(ic, certificate, filename);
        }
Ejemplo n.º 4
0
        private void btnCreatCard_Click(object sender, EventArgs e)
        {
            InformationCardTemplate ict = PopulateCardTemplateFromUI();

            saveFileDialog1.Filter = "Managed Card (*.crd)|*.crd";
            DialogResult dr = saveFileDialog1.ShowDialog();

            string filename = saveFileDialog1.FileName;

            CertificateInfo certInfo = new CertificateInfo();

            certInfo.CommonName = tbCertificateCommonName.Text;
            certInfo.Location   = tbCertificateLocation.Text;
            certInfo.Store      = tbCertificateStore.Text;
            X509Certificate2 certificate = ManagedCardHelper.RetrieveCertificate(certInfo);

            ManagedCardHelper helper = new ManagedCardHelper();

            helper.SaveCard(ict.InformationCardDefinition, certificate, filename);
        }
Ejemplo n.º 5
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     //InformationCard ic = PopulateCard();
     //ManagedCardHelper.SaveCardTemplate(ic, "C:\\MyCard.crdtemplate");
     InformationCardTemplate ic = ManagedCardHelper.LoadCardTemplate("C:\\MyCard.crdtemplate");
 }
Ejemplo n.º 6
0
        private void PopulateUIFromCardTemplate(string filename)
        {
            InformationCardTemplate ict = ManagedCardHelper.LoadCardTemplate(filename);

            InformationCard ic = ict.InformationCardDefinition;

            tbCardImage.Text           = ic.CardImage.ImageName;
            tbCardName.Text            = ic.CardName;
            tbCardID.Text              = ic.CardReference.CardID;
            tbCardVersion.Text         = ic.CardReference.CardVersion.ToString();
            tbIssuer.Text              = ic.Issuer;
            tbIssuerName.Text          = ic.IssuerName;
            tbPrivacyPolicy.Text       = ic.PrivacyNotice;
            cbRequireAppliesTo.Checked = ic.RequireRPIdentification;
            dtpTimeExpires.Value       = ic.TimeExpires;
            dtpTimeIssued.Value        = ic.TimeIssued;

            foreach (CardClaim cardClaim in ic.SupportedClaimTypeList)
            {
                DataGridViewRow row = new DataGridViewRow();

                DataGridViewTextBoxCell uri         = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell displayTag  = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell description = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell claimValue  = new DataGridViewTextBoxCell();

                uri.Value         = cardClaim.Uri;
                displayTag.Value  = cardClaim.DisplayTag;
                description.Value = cardClaim.Description;
                claimValue.Value  = cardClaim.Value;

                row.Cells.Add(uri);
                row.Cells.Add(displayTag);
                row.Cells.Add(description);
                row.Cells.Add(claimValue);

                dgvClaims.Rows.Add(row);
            }

            cbSAML10.Checked = false;
            cbSAML11.Checked = false;

            foreach (TokenType tokenType in ic.AcceptedTokenTypes)
            {
                if (tokenType.Name == "SAML10")
                {
                    cbSAML10.Checked = true;
                }

                if (tokenType.Name == "SAML11")
                {
                    cbSAML11.Checked = true;
                }
            }

            foreach (TokenService ts in ic.TokenServiceList)
            {
                //Add the token service
                DataGridViewTextBoxCell address               = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell mex                   = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell identity              = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell credentialType        = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell value                 = new DataGridViewTextBoxCell();
                DataGridViewTextBoxCell displayCredentialHint = new DataGridViewTextBoxCell();

                DataGridViewRow row = new DataGridViewRow();

                address.Value  = ts.EndpointReference.Address;
                mex.Value      = ts.EndpointReference.Mex;
                identity.Value = ts.EndpointReference.Identity;


                credentialType.Value        = ts.UserCredential.UserCredentialType.ToString();
                credentialType.Tag          = ts.UserCredential.UserCredentialType;
                value.Value                 = ts.UserCredential.Value;
                displayCredentialHint.Value = ts.UserCredential.DisplayCredentialHint;


                row.Cells.Add(address);
                row.Cells.Add(mex);
                row.Cells.Add(identity);
                row.Cells.Add(credentialType);
                row.Cells.Add(value);
                row.Cells.Add(displayCredentialHint);

                dgvTokenServiceList.Rows.Add(row);
            }

            cbRequireAppliesTo.Checked = ic.RequireRPIdentification;
        }