Пример #1
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");
 }
Пример #2
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;
        }