private void _btnSignin_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new AcsSignInWindow()
            {
                AcsNamespace = "ttacssample",
                Realm = Constants.Realm,
                Owner = this
            };

            if (dialog.ShowDialog().Value)
            {
                RSTR = dialog.Response;
                _txtDebug.Text = RSTR.SecurityTokenString;
            }
        }
        private static void ParseValues(JSNotifyRequestSecurityTokenResponse rstr)
        {
            rstr.ValidFrom = long.Parse(rstr.Created).ToDateTimeFromEpoch();
            rstr.ValidTo = long.Parse(rstr.Expires).ToDateTimeFromEpoch();
            rstr.SecurityTokenString = HttpUtility.HtmlDecode(rstr.SecurityTokenString);
            var xml = XElement.Parse(rstr.SecurityTokenString);

            string idAttribute = "";

            switch (rstr.TokenType)
            {
                case SecurityTokenTypes.Saml11:
                    idAttribute = "AssertionID";
                    break;
                case SecurityTokenTypes.Saml2:
                    idAttribute = "ID";
                    break;
            }

            if (rstr.TokenType == SecurityTokenTypes.Saml11 || rstr.TokenType == SecurityTokenTypes.Saml2)
            {
                var tokenId = xml.Attribute(idAttribute);
                var xmlElement = xml.ToXmlElement();
                SecurityKeyIdentifierClause clause = null;
                
                if (tokenId != null)
                {
                    clause = new SamlAssertionKeyIdentifierClause(tokenId.Value);
                }

                rstr.SecurityToken = new GenericXmlSecurityToken(
                    xmlElement,
                    null,
                    rstr.ValidFrom,
                    rstr.ValidTo,
                    clause,
                    clause,
                    new ReadOnlyCollection<IAuthorizationPolicy>(new List<IAuthorizationPolicy>()));
            }
            else if (rstr.TokenType == SecurityTokenTypes.SWT)
            {
                rstr.SecurityTokenString = Encoding.UTF8.GetString(Convert.FromBase64String(xml.Value));
            }
        }
 private void OnScriptNotify(object sender, ScriptNotifyEventArgs e)
 {
     this.Response = JSNotifyRequestSecurityTokenResponse.FromJson(e.Data);
     this.DialogResult = true;
     this.Close();
 }