Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / RequestSecurityTokenForGetBrowserToken.cs / 1 / RequestSecurityTokenForGetBrowserToken.cs
namespace Microsoft.InfoCards
{
using System;
using System.Xml;
using System.Collections;
using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace;
//
// This class is used to write an RST to the STS for the get browser token case.
//
internal class RequestSecurityTokenForGetBrowserToken : RequestSecurityToken
{
public RequestSecurityTokenForGetBrowserToken( RequestSecurityTokenParameters rstParams )
: base( rstParams )
{
}
protected override void WriteKeyTypeElement()
{
//
// Write the KeyType element. In the browser case, this value must be No Proof Key.
//
IDT.Assert( ProtocolVersionProfile.WSTrust.KeyTypeBearer.ToString() == Policy.GetKeyTypeString(), "Only no proof key allowed in browser case" );
IDT.TraceDebug( "IPSTSCLIENT: Writing key type {0} to RST", Policy.GetKeyTypeString() );
Serializer.WriteKeyTypeElement( Policy.GetKeyTypeString() );
}
protected override void WriteRequestTypeElement()
{
//
// For browser case, we only support the Issue action.
//
IDT.TraceDebug( "IPSTSCLIENT: Writing RequestType {0} to RST", ProtocolVersionProfile.WSTrust.IssueRequestType );
Serializer.WriteRequestTypeElement( ProtocolVersionProfile.WSTrust.IssueRequestType );
}
protected override void WriteAppliesToElement()
{
//
// Always send AppliesTo in browser case - same behavior as Indigo federated token provider
//
GetBrowserTokenRequest.WriteSourceUrlAppliesTo( Writer, m_rstParams.BrowserTokenParams, ProtocolVersionProfile );
}
protected override void WriteSecondaryParametersElement()
{
//
// No need to check appliesTo in the browser case, since it will always be sent.
//
//
// Write out a copy of the policy XML to the SecondaryParameters element if we are using the
// oasis 2007 version of WS-Trust.
//
if( XmlNames.WSSpecificationVersion.WSTrustOasis2007 == ProtocolVersionProfile.WSTrust.Version )
{
//
// If the policy contains optional claims but the user has elected to not sent optional claims, then we
// cannot sent secondaryParameters (as we do not want accidental disclosure of information to a
// non-auditing STS).
//
bool writeSecondaryParameters = true;
if( Policy.OptionalClaims.Length > 0 )
{
//
// If the policy contains one or more optional claims, check to see if the user
// is willing to send optional claims.
//
writeSecondaryParameters = m_rstParams.DiscloseOptionalClaims;
}
if( writeSecondaryParameters )
{
if( null != Policy.RelyingPartyPolicy )
{
Serializer.WriteSecondaryParametersElement( Policy.RelyingPartyPolicy.PolicyXml );
}
else
{
//
// If the incoming RST Template did not contain SecondaryParameters, we simply write the
// original request.
//
Serializer.WriteSecondaryParametersElement( Policy.ClientPolicy.PolicyXml );
}
}
}
}
protected override void CustomWriteBodyContents( XmlDictionaryWriter writer )
{
InitializeWriters( writer );
WriteRSTOpeningElement();
WriteKeyTypeElement();
WriteRequestTypeElement();
WriteAppliesToElement();
WriteClaimsElement();
WriteTokenTypeElement();
WriteSecondaryParametersElement();
WriteEndElement();
//
// The following elements are explicitly excluded from the browser case:
//
// InfoCardReferenceElement
// KeySupportingElements
// PPIDElement
// EncryptionAlgorithmElement
// DisplayTokenElement
// PassOnElements
// UnprocessedPolicyElements
//
}
}
}
// 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
- ZipPackagePart.cs
- Lasso.cs
- PackUriHelper.cs
- StrongNameUtility.cs
- MultidimensionalArrayItemReference.cs
- _ListenerRequestStream.cs
- PeerNameRecord.cs
- DataGridViewCellStyle.cs
- WebPermission.cs
- RawStylusInputCustomData.cs
- InheritanceService.cs
- StringComparer.cs
- EntityDesignerUtils.cs
- FixedDocument.cs
- ProcessModuleCollection.cs
- FaultBookmark.cs
- DriveInfo.cs
- RSACryptoServiceProvider.cs
- ComPlusServiceHost.cs
- ProfileBuildProvider.cs
- LiteralControl.cs
- CodeArrayIndexerExpression.cs
- PointAnimationBase.cs
- SessionPageStateSection.cs
- OpCodes.cs
- NavigationPropertyEmitter.cs
- _UriSyntax.cs
- Int32CollectionConverter.cs
- BuildProvider.cs
- Menu.cs
- WebWorkflowRole.cs
- WhitespaceRuleLookup.cs
- ValidationHelper.cs
- MgmtConfigurationRecord.cs
- Pens.cs
- RequiredAttributeAttribute.cs
- RegionData.cs
- RightsManagementEncryptionTransform.cs
- Matrix.cs
- ReferencedType.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- XmlNamespaceMapping.cs
- SpellCheck.cs
- SendingRequestEventArgs.cs
- BidirectionalDictionary.cs
- GridViewColumnHeaderAutomationPeer.cs
- InheritanceAttribute.cs
- FilterEventArgs.cs
- HeaderUtility.cs
- ColorIndependentAnimationStorage.cs
- TaskExceptionHolder.cs
- UnknownBitmapDecoder.cs
- WindowsFont.cs
- _ConnectionGroup.cs
- WindowsSecurityToken.cs
- CompilerInfo.cs
- SemanticAnalyzer.cs
- XmlSchemaInfo.cs
- ContextMarshalException.cs
- ScriptManagerProxy.cs
- XmlNamespaceMappingCollection.cs
- StringConcat.cs
- FreezableCollection.cs
- COM2FontConverter.cs
- ControlBindingsCollection.cs
- CheckableControlBaseAdapter.cs
- ExtendedPropertyInfo.cs
- XmlReaderSettings.cs
- DateTimeConverter2.cs
- HttpConfigurationContext.cs
- ColumnProvider.cs
- PerformanceCounterCategory.cs
- COSERVERINFO.cs
- HwndSubclass.cs
- NumberAction.cs
- X509ChainElement.cs
- AcceleratedTokenAuthenticator.cs
- SQLChars.cs
- EntityDataSourceViewSchema.cs
- GraphicsContainer.cs
- _NegoState.cs
- ButtonBaseAutomationPeer.cs
- XComponentModel.cs
- ViewPort3D.cs
- TableItemStyle.cs
- TextOnlyOutput.cs
- ServiceContractGenerator.cs
- PointCollection.cs
- PackageFilter.cs
- SizeFConverter.cs
- PeerApplication.cs
- ServerValidateEventArgs.cs
- DBParameter.cs
- SkipStoryboardToFill.cs
- NonBatchDirectoryCompiler.cs
- ScriptHandlerFactory.cs
- EmissiveMaterial.cs
- TextServicesLoader.cs
- AssemblyAttributes.cs
- PeerInvitationResponse.cs