public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } object obj = null; if (PolicyManager.CheckMembershipCondition(base.MembershipCondition, evidence, out obj)) { PolicyStatement policyStatement = base.PolicyStatement; IDelayEvaluatedEvidence delayEvaluatedEvidence = obj as IDelayEvaluatedEvidence; bool flag = delayEvaluatedEvidence != null && !delayEvaluatedEvidence.IsVerified; if (flag) { policyStatement.AddDependentEvidence(delayEvaluatedEvidence); } bool flag2 = false; IEnumerator enumerator = base.Children.GetEnumerator(); while (enumerator.MoveNext() && !flag2) { PolicyStatement policyStatement2 = PolicyManager.ResolveCodeGroup(enumerator.Current as CodeGroup, evidence); if (policyStatement2 != null) { policyStatement.InplaceUnion(policyStatement2); if ((policyStatement2.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive) { flag2 = true; } } } return(policyStatement); } return(null); }
internal void AddDependentEvidence(IDelayEvaluatedEvidence dependentEvidence) { if (this.m_dependentEvidence == null) { this.m_dependentEvidence = new List <IDelayEvaluatedEvidence>(); } this.m_dependentEvidence.Add(dependentEvidence); }
internal void AddDependentEvidence(IDelayEvaluatedEvidence dependentEvidence) { if (this.m_dependentEvidence == null) { this.m_dependentEvidence = new List<IDelayEvaluatedEvidence>(); } this.m_dependentEvidence.Add(dependentEvidence); }
/// <summary> /// Add evidence which this policy statement is depending upon being verified to be valid. /// </summary> internal void AddDependentEvidence(IDelayEvaluatedEvidence dependentEvidence) { BCLDebug.Assert(dependentEvidence != null, "dependentEvidence != null"); if (m_dependentEvidence == null) { m_dependentEvidence = new List <IDelayEvaluatedEvidence>(); } m_dependentEvidence.Add(dependentEvidence); }
public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } object usedEvidence = null; if (!PolicyManager.CheckMembershipCondition(base.MembershipCondition, evidence, out usedEvidence)) { return(null); } PolicyStatement childPolicy = null; IEnumerator enumerator = base.Children.GetEnumerator(); while (enumerator.MoveNext()) { childPolicy = PolicyManager.ResolveCodeGroup(enumerator.Current as CodeGroup, evidence); if (childPolicy != null) { break; } } IDelayEvaluatedEvidence dependentEvidence = usedEvidence as IDelayEvaluatedEvidence; bool flag = (dependentEvidence != null) && !dependentEvidence.IsVerified; PolicyStatement policyStatement = base.PolicyStatement; if (policyStatement == null) { if (flag) { childPolicy = childPolicy.Copy(); childPolicy.AddDependentEvidence(dependentEvidence); } return(childPolicy); } if (childPolicy != null) { PolicyStatement statement3 = policyStatement.Copy(); if (flag) { statement3.AddDependentEvidence(dependentEvidence); } statement3.InplaceUnion(childPolicy); return(statement3); } if (flag) { policyStatement.AddDependentEvidence(dependentEvidence); } return(policyStatement); }
private bool WasStrongNameEvidenceUsed() { using (new EvidenceLockHolder(this, EvidenceLockHolder.LockType.Reader)) { EvidenceTypeDescriptor evidenceTypeDescriptor = this.GetEvidenceTypeDescriptor(typeof(StrongName)); if (evidenceTypeDescriptor != null) { IDelayEvaluatedEvidence hostEvidence = evidenceTypeDescriptor.HostEvidence as IDelayEvaluatedEvidence; return((hostEvidence != null) && hostEvidence.WasUsed); } return(false); } }
public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } object usedEvidence = (object)null; if (!PolicyManager.CheckMembershipCondition(this.MembershipCondition, evidence, out usedEvidence)) { return((PolicyStatement)null); } PolicyStatement childPolicy = (PolicyStatement)null; foreach (object child in (IEnumerable)this.Children) { childPolicy = PolicyManager.ResolveCodeGroup(child as CodeGroup, evidence); if (childPolicy != null) { break; } } IDelayEvaluatedEvidence dependentEvidence = usedEvidence as IDelayEvaluatedEvidence; bool flag = dependentEvidence != null && !dependentEvidence.IsVerified; PolicyStatement policyStatement1 = this.PolicyStatement; if (policyStatement1 == null) { if (flag) { childPolicy = childPolicy.Copy(); childPolicy.AddDependentEvidence(dependentEvidence); } return(childPolicy); } if (childPolicy != null) { PolicyStatement policyStatement2 = policyStatement1.Copy(); if (flag) { policyStatement2.AddDependentEvidence(dependentEvidence); } policyStatement2.InplaceUnion(childPolicy); return(policyStatement2); } if (flag) { policyStatement1.AddDependentEvidence(dependentEvidence); } return(policyStatement1); }
public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } object obj = null; if (!PolicyManager.CheckMembershipCondition(base.MembershipCondition, evidence, out obj)) { return(null); } PolicyStatement policyStatement = null; foreach (object obj2 in base.Children) { policyStatement = PolicyManager.ResolveCodeGroup(obj2 as CodeGroup, evidence); if (policyStatement != null) { break; } } IDelayEvaluatedEvidence delayEvaluatedEvidence = obj as IDelayEvaluatedEvidence; bool flag = delayEvaluatedEvidence != null && !delayEvaluatedEvidence.IsVerified; PolicyStatement policyStatement2 = base.PolicyStatement; if (policyStatement2 == null) { if (flag) { policyStatement = policyStatement.Copy(); policyStatement.AddDependentEvidence(delayEvaluatedEvidence); } return(policyStatement); } if (policyStatement != null) { PolicyStatement policyStatement3 = policyStatement2.Copy(); if (flag) { policyStatement3.AddDependentEvidence(delayEvaluatedEvidence); } policyStatement3.InplaceUnion(policyStatement); return(policyStatement3); } if (flag) { policyStatement2.AddDependentEvidence(delayEvaluatedEvidence); } return(policyStatement2); }
[System.Security.SecuritySafeCritical] // auto-generated public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } Contract.EndContractBlock(); object usedEvidence = null; if (PolicyManager.CheckMembershipCondition(MembershipCondition, evidence, out usedEvidence)) { PolicyStatement thisPolicy = CalculateAssemblyPolicy(evidence); // If any delay-evidence was used to generate this grant set, then we need to keep track of // that for potentially later forcing it to be verified. IDelayEvaluatedEvidence delayEvidence = usedEvidence as IDelayEvaluatedEvidence; bool delayEvidenceNeedsVerification = delayEvidence != null && !delayEvidence.IsVerified; if (delayEvidenceNeedsVerification) { thisPolicy.AddDependentEvidence(delayEvidence); } bool foundExclusiveChild = false; IEnumerator enumerator = this.Children.GetEnumerator(); while (enumerator.MoveNext() && !foundExclusiveChild) { PolicyStatement childPolicy = PolicyManager.ResolveCodeGroup(enumerator.Current as CodeGroup, evidence); if (childPolicy != null) { thisPolicy.InplaceUnion(childPolicy); if ((childPolicy.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive) { foundExclusiveChild = true; } } } return(thisPolicy); } else { return(null); } }
private EvidenceBase GetHostEvidence(Type type, bool markDelayEvaluatedEvidenceUsed) { using (new EvidenceLockHolder(this, EvidenceLockHolder.LockType.Reader)) { EvidenceBase hostEvidenceNoLock = this.GetHostEvidenceNoLock(type); if (markDelayEvaluatedEvidenceUsed) { IDelayEvaluatedEvidence evidence = hostEvidenceNoLock as IDelayEvaluatedEvidence; if (evidence != null) { evidence.MarkUsed(); } } return(hostEvidenceNoLock); } }
internal void MarkAllEvidenceAsUsed() { using (new EvidenceLockHolder(this, EvidenceLockHolder.LockType.Reader)) { foreach (KeyValuePair <Type, EvidenceTypeDescriptor> pair in this.m_evidence) { if (pair.Value != null) { IDelayEvaluatedEvidence hostEvidence = pair.Value.HostEvidence as IDelayEvaluatedEvidence; if (hostEvidence != null) { hostEvidence.MarkUsed(); } IDelayEvaluatedEvidence assemblyEvidence = pair.Value.AssemblyEvidence as IDelayEvaluatedEvidence; if (assemblyEvidence != null) { assemblyEvidence.MarkUsed(); } } } } }
public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } object usedEvidence = null; if (!PolicyManager.CheckMembershipCondition(base.MembershipCondition, evidence, out usedEvidence)) { return(null); } PolicyStatement statement = this.CalculateAssemblyPolicy(evidence); IDelayEvaluatedEvidence dependentEvidence = usedEvidence as IDelayEvaluatedEvidence; if ((dependentEvidence != null) && !dependentEvidence.IsVerified) { statement.AddDependentEvidence(dependentEvidence); } bool flag2 = false; IEnumerator enumerator = base.Children.GetEnumerator(); while (enumerator.MoveNext() && !flag2) { PolicyStatement childPolicy = PolicyManager.ResolveCodeGroup(enumerator.Current as CodeGroup, evidence); if (childPolicy != null) { statement.InplaceUnion(childPolicy); if ((childPolicy.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive) { flag2 = true; } } } return(statement); }
public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } object usedEvidence = (object)null; if (!PolicyManager.CheckMembershipCondition(this.MembershipCondition, evidence, out usedEvidence)) { return((PolicyStatement)null); } PolicyStatement policyStatement = this.PolicyStatement; IDelayEvaluatedEvidence dependentEvidence = usedEvidence as IDelayEvaluatedEvidence; if ((dependentEvidence == null ? 0 : (!dependentEvidence.IsVerified ? 1 : 0)) != 0) { policyStatement.AddDependentEvidence(dependentEvidence); } bool flag = false; IEnumerator enumerator = this.Children.GetEnumerator(); while (enumerator.MoveNext() && !flag) { PolicyStatement childPolicy = PolicyManager.ResolveCodeGroup(enumerator.Current as CodeGroup, evidence); if (childPolicy != null) { policyStatement.InplaceUnion(childPolicy); if ((childPolicy.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive) { flag = true; } } } return(policyStatement); }
[System.Security.SecuritySafeCritical] // auto-generated public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } Contract.EndContractBlock(); object usedEvidence = null; if (PolicyManager.CheckMembershipCondition(MembershipCondition, evidence, out usedEvidence)) { PolicyStatement childPolicy = null; IEnumerator enumerator = this.Children.GetEnumerator(); while (enumerator.MoveNext()) { childPolicy = PolicyManager.ResolveCodeGroup(enumerator.Current as CodeGroup, evidence); // If the child has a policy, we are done. if (childPolicy != null) { break; } } // If any delay-evidence was used to generate this grant set, then we need to keep track of // that for potentially later forcing it to be verified. IDelayEvaluatedEvidence delayEvidence = usedEvidence as IDelayEvaluatedEvidence; bool delayEvidenceNeedsVerification = delayEvidence != null && !delayEvidence.IsVerified; PolicyStatement thisPolicy = this.PolicyStatement; // PolicyStatement getter makes a copy for us if (thisPolicy == null) { // We didn't add any permissions, but we enabled our children to be evaluated, and // therefore its grant set is dependent on any of our delay evidence. if (delayEvidenceNeedsVerification) { childPolicy = childPolicy.Copy(); childPolicy.AddDependentEvidence(delayEvidence); } return(childPolicy); } else if (childPolicy != null) { // Combine the child and this policy and return it. PolicyStatement combined = thisPolicy.Copy(); if (delayEvidenceNeedsVerification) { combined.AddDependentEvidence(delayEvidence); } combined.InplaceUnion(childPolicy); return(combined); } else { // Otherwise we just copy the this policy. if (delayEvidenceNeedsVerification) { thisPolicy.AddDependentEvidence(delayEvidence); } return(thisPolicy); } } else { return(null); } }
/// <summary> /// Add evidence which this policy statement is depending upon being verified to be valid. /// </summary> internal void AddDependentEvidence(IDelayEvaluatedEvidence dependentEvidence) { BCLDebug.Assert(dependentEvidence != null, "dependentEvidence != null"); if (m_dependentEvidence == null) { m_dependentEvidence = new List<IDelayEvaluatedEvidence>(); } m_dependentEvidence.Add(dependentEvidence); }