public override SecurityToken ReadToken(string tokenString) { // unbase64 header if necessary if (HeaderEncoding.IsBase64Encoded(tokenString)) { tokenString = HeaderEncoding.DecodeBase64(tokenString); } return(ContainingCollection.ReadToken(new XmlTextReader(new StringReader(tokenString)))); }
public override SecurityToken ReadToken(string tokenString) { // unbase64 header if necessary if (HeaderEncoding.IsBase64Encoded(tokenString)) { tokenString = HeaderEncoding.DecodeBase64(tokenString); } // check containing collection (mainly useful for chained EncryptedSecurityTokenHandler) if (ContainingCollection != null) { return(ContainingCollection.ReadToken(new XmlTextReader(new StringReader(tokenString)))); } else { return(ReadToken(new XmlTextReader(new StringReader(tokenString)))); } }
protected void FieldDataChange(string fieldName, object newValue) { if (IsKeyField(fieldName)) { var gu = GeneralUtility.GetInstance(); if (Parent != null) { if (Parent.KeyFieldNameCollection.Cast <string>().Any( parentKeyFieldName => fieldName == parentKeyFieldName && String.CompareOrdinal( gu.GetMemberValue(Parent.ObjectKey, parentKeyFieldName).ToString(), newValue.ToString()) != 0)) { throw new ApplicationException("Invalid key values: parent - child keys mismatched."); } } // have to do the check before the assignment below var allKeyFieldHasValue = ObjectKey.ToDictionary().Cast <DictionaryEntry>().All(item => item.Value != null && item.Value.ToString() != "Null"); if (allKeyFieldHasValue && !(_state is NewState)) { _isExistingKeyDirty = true; } // if ObjectKey field == null copy newValue to it // so it's only initialize and no update var keyFieldValue = gu.GetMemberValue(ObjectKey, fieldName); if (keyFieldValue == null || keyFieldValue.ToString() == "Null") { gu.SetMemberValue(ObjectKey, fieldName, newValue); } if (_isExistingKeyDirty) { ContainingCollection.GetType().GetMethod("Replace", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(ContainingCollection, new object[] { _objectKey, this }); } } _state.FieldDataChange(this); }
public SecurityToken ReadToken(string tokenString) { return(ContainingCollection.ReadToken(new XmlTextReader(new StringReader(tokenString)))); }