Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / GetPolicyDetailsRequest.cs / 1 / GetPolicyDetailsRequest.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.IO; using System.Security; using System.Security.Cryptography.X509Certificates; using System.Collections; using System.Collections.Generic; using Microsoft.InfoCards.Diagnostics; using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // This class handles a UI request for recipient information // class GetPolicyDetailsRequest : UIAgentRequest { InfoCardPolicy m_policy; Recipient m_recipient; String m_privacyPolicyLink = String.Empty; // // Summary // Create a new request to return recipient related information // public GetPolicyDetailsRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parent ) : base( rpcHandle, inArgs, outArgs, parent ) { } protected override void OnInitializeAsSystem() { base.OnInitializeAsSystem(); m_policy = GetPolicy(); } protected override void OnMarshalInArgs() { } protected override void OnProcess() { IDT.Assert( null != m_policy, "Null policy" ); StoreConnection connection = StoreConnection.GetConnection(); try { // // Retrieve the recipient object from the store // ListparamList = new List (); QueryParameter query = new QueryParameter( SecondaryIndexDefinition.ObjectTypeIndex, ( Int32 )StorableObjectType.Recipient ); paramList.Add( query ); query = new QueryParameter( SecondaryIndexDefinition.RecipientIdIndex, m_policy.Recipient.GetIdentifier() ); paramList.Add( query ); DataRow row = connection.GetSingleRow( paramList.ToArray() ); X509RecipientIdentity recipient = m_policy.Recipient as X509RecipientIdentity; if( null != recipient ) { ParentRequest.CertCacheAdd( m_policy.Recipient.GetIdentifier(), recipient.LeafCertificate ); } if( null != row ) { m_recipient = new Recipient( new MemoryStream( row.GetDataField() ), m_policy.Recipient, true ); if ( m_recipient.Trust == Recipient.TrustDecision.IsTrusted && m_recipient.PrivacyPolicyVersion != m_policy.PrivacyPolicyVersion ) { m_recipient.Trust = Recipient.TrustDecision.PolicyVersionChange; } // // update the recipient privacy policy version // m_recipient.PrivacyPolicyVersion = m_policy.PrivacyPolicyVersion; } else { m_recipient = new Recipient( m_policy.Recipient, true, m_policy.PrivacyPolicyVersion ); m_recipient.Trust = Recipient.TrustDecision.NoTrustDecision; } m_privacyPolicyLink = m_policy.PrivacyPolicyLink; } finally { connection.Close(); } } // // Summary // Serialize the output in the following order // requiresManagedCard ( bool ) // requiresSelfIssuedCard ( bool ) // if browser scenario ( bool ) // recipient certificate - recipient id // count of required claims ( int32 ) // each claim ( string ) // count of optional claims ( int32 ) // each claim ( string ) // // protected override void OnMarshalOutArgs() { IDT.Assert( null != m_policy, "Null policy" ); BinaryWriter writer = new BinaryWriter( OutArgs, System.Text.Encoding.Unicode ); writer.Write( m_policy.RequiresManagedCard ); writer.Write( m_policy.RequiresSelfIssuedCard ); writer.Write( this.ParentRequest is GetBrowserTokenRequest ); IDT.TraceDebug( "Serialize the recipient" ); m_recipient.Serialize( writer ); IDT.TraceDebug( "Serialize the privacy information" ); Utility.SerializeString( writer, m_privacyPolicyLink ); IDT.TraceDebug( "Retrieve the requested claim uri's from the policy" ); if( null != m_policy.RequiredClaims ) { writer.Write( ( Int32 )m_policy.RequiredClaims.Length ); for( int i = 0; i < m_policy.RequiredClaims.Length; i++ ) { Utility.SerializeString( writer, m_policy.RequiredClaims[ i ] ); } } else { writer.Write( ( Int32 )0 ); } IDT.TraceDebug( "Retrieve the optional claim uri's from the policy" ); if( null != m_policy.OptionalClaims ) { writer.Write( ( Int32 )m_policy.OptionalClaims.Length ); for( int i = 0; i < m_policy.OptionalClaims.Length; i++ ) { Utility.SerializeString( writer, m_policy.OptionalClaims[ i ] ); } } else { writer.Write( ( Int32 )0 ); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MenuStrip.cs
- AxisAngleRotation3D.cs
- Atom10FormatterFactory.cs
- TextOptionsInternal.cs
- Visitor.cs
- StringFunctions.cs
- DataSourceControlBuilder.cs
- ContentAlignmentEditor.cs
- CounterCreationData.cs
- TextTabProperties.cs
- AssemblyHash.cs
- Descriptor.cs
- FloatSumAggregationOperator.cs
- TypeConverterHelper.cs
- ClickablePoint.cs
- Bits.cs
- CriticalFinalizerObject.cs
- BrushValueSerializer.cs
- FormatSelectingMessageInspector.cs
- TraceSection.cs
- SpeechSeg.cs
- EmptyReadOnlyDictionaryInternal.cs
- XmlElementCollection.cs
- EventBuilder.cs
- DesignerExtenders.cs
- BitmapSourceSafeMILHandle.cs
- InputLanguageProfileNotifySink.cs
- ServiceAppDomainAssociationProvider.cs
- CollectionViewSource.cs
- odbcmetadatafactory.cs
- LabelTarget.cs
- sortedlist.cs
- ProfessionalColorTable.cs
- DrawingBrush.cs
- Compiler.cs
- ImageDrawing.cs
- SqlServer2KCompatibilityAnnotation.cs
- TextSyndicationContentKindHelper.cs
- DiscoveryEndpoint.cs
- XXXOnTypeBuilderInstantiation.cs
- XmlWriterSettings.cs
- MediaContext.cs
- HtmlForm.cs
- CreateUserErrorEventArgs.cs
- ChildrenQuery.cs
- TextProviderWrapper.cs
- SerializationFieldInfo.cs
- SourceFileBuildProvider.cs
- ScriptControlManager.cs
- XmlRawWriter.cs
- ContentAlignmentEditor.cs
- EmbossBitmapEffect.cs
- PropertyValueChangedEvent.cs
- SingleTagSectionHandler.cs
- TextCollapsingProperties.cs
- ScalarOps.cs
- ChannelServices.cs
- ContractHandle.cs
- SetterBase.cs
- EdmItemError.cs
- MediaSystem.cs
- MenuItemBindingCollection.cs
- OdbcError.cs
- TopClause.cs
- SqlCommand.cs
- CustomError.cs
- DispatchChannelSink.cs
- BitmapEffect.cs
- XmlText.cs
- SecurityCriticalDataForSet.cs
- UdpDuplexChannel.cs
- PropertyBuilder.cs
- HtmlProps.cs
- EntityTypeEmitter.cs
- dataobject.cs
- FileSystemInfo.cs
- XmlObjectSerializerContext.cs
- ViewBase.cs
- GridViewAutoFormat.cs
- ScriptComponentDescriptor.cs
- EastAsianLunisolarCalendar.cs
- PrePostDescendentsWalker.cs
- TraceHwndHost.cs
- CodeAccessPermission.cs
- BoundingRectTracker.cs
- Point3DKeyFrameCollection.cs
- DataGridPageChangedEventArgs.cs
- HashFinalRequest.cs
- TableHeaderCell.cs
- ToolStripDropDownItem.cs
- StreamReader.cs
- SuppressIldasmAttribute.cs
- Wizard.cs
- DynamicPhysicalDiscoSearcher.cs
- DataDesignUtil.cs
- SolidColorBrush.cs
- SrgsOneOf.cs
- TreeIterators.cs
- TcpProcessProtocolHandler.cs
- DetailsViewModeEventArgs.cs