summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-10-04 16:45:52 -0700
committerAndrew <andrewarnott@gmail.com>2008-10-04 16:45:52 -0700
commit9ffccf622b5c669027c8cbb9ee2f8735ea25d636 (patch)
tree5d25daff51635cd05e419d7fe42d25d6e1a3e262
parent2e681a4b643fec2cdac42c729cb08ea3faa7a099 (diff)
downloadDotNetOpenAuth-9ffccf622b5c669027c8cbb9ee2f8735ea25d636.zip
DotNetOpenAuth-9ffccf622b5c669027c8cbb9ee2f8735ea25d636.tar.gz
DotNetOpenAuth-9ffccf622b5c669027c8cbb9ee2f8735ea25d636.tar.bz2
Added WCF sample consumer and service provider.
It's pretty delicate and a poor sample, but hey, it worked.
-rw-r--r--samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.disco4
-rw-r--r--samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.wsdl250
-rw-r--r--samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.xsd42
-rw-r--r--samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi1.xsd27
-rw-r--r--samples/Consumer/App_WebReferences/SampleServiceProvider/Reference.svcmap32
-rw-r--r--samples/Consumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo10
-rw-r--r--samples/Consumer/App_WebReferences/SampleServiceProvider/configuration91.svcinfo198
-rw-r--r--samples/Consumer/Default.aspx1
-rw-r--r--samples/Consumer/GoogleAddressBook.aspx.cs4
-rw-r--r--samples/Consumer/SampleWcf.aspx15
-rw-r--r--samples/Consumer/SampleWcf.aspx.cs76
-rw-r--r--samples/Consumer/Web.config39
-rw-r--r--samples/ServiceProvider/App_Code/Constants.cs32
-rw-r--r--samples/ServiceProvider/App_Code/DataApi.cs16
-rw-r--r--samples/ServiceProvider/App_Code/IDataApi.cs15
-rw-r--r--samples/ServiceProvider/App_Code/InMemoryTokenManager.cs91
-rw-r--r--samples/ServiceProvider/App_Code/Logging.cs20
-rw-r--r--samples/ServiceProvider/App_Code/OAuthAuthorizationManager.cs32
-rw-r--r--samples/ServiceProvider/App_Code/TracePageAppender.cs11
-rw-r--r--samples/ServiceProvider/Authorize.aspx20
-rw-r--r--samples/ServiceProvider/Authorize.aspx.cs17
-rw-r--r--samples/ServiceProvider/AuthorizedConsumers.aspx5
-rw-r--r--samples/ServiceProvider/AuthorizedConsumers.aspx.cs15
-rw-r--r--samples/ServiceProvider/DataApi.svc1
-rw-r--r--samples/ServiceProvider/Default.aspx9
-rw-r--r--samples/ServiceProvider/Global.asax36
-rw-r--r--samples/ServiceProvider/MasterPage.master23
-rw-r--r--samples/ServiceProvider/OAuth.ashx40
-rw-r--r--samples/ServiceProvider/Settings.StyleCop1
-rw-r--r--samples/ServiceProvider/TracePage.aspx18
-rw-r--r--samples/ServiceProvider/TracePage.aspx.cs21
-rw-r--r--samples/ServiceProvider/Web.config151
-rw-r--r--src/DotNetOAuth.sln30
33 files changed, 1293 insertions, 9 deletions
diff --git a/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.disco b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.disco
new file mode 100644
index 0000000..94f4086
--- /dev/null
+++ b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.disco
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
+ <contractRef ref="http://localhost:65169/ServiceProvider/DataApi.svc?wsdl" docRef="http://localhost:65169/ServiceProvider/DataApi.svc" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
+</discovery> \ No newline at end of file
diff --git a/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.wsdl b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.wsdl
new file mode 100644
index 0000000..940cb1f
--- /dev/null
+++ b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.wsdl
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://tempuri.org/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="DataApi" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="WSHttpBinding_IDataApi_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys />
+ <sp:BootstrapPolicy>
+ <wsp:Policy>
+ <sp:SignedParts>
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:SymmetricBinding>
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys />
+ </wsp:Policy>
+ </sp:SpnegoContextToken>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ <sp:EncryptSignature />
+ <sp:OnlySignEntireHeadersAndBody />
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:Wss11>
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier />
+ <sp:MustSupportRefIssuerSerial />
+ <sp:MustSupportRefThumbprint />
+ <sp:MustSupportRefEncryptedKey />
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10>
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens />
+ <sp:RequireClientEntropy />
+ <sp:RequireServerEntropy />
+ </wsp:Policy>
+ </sp:Trust10>
+ </wsp:Policy>
+ </sp:BootstrapPolicy>
+ </wsp:Policy>
+ </sp:SecureConversationToken>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ <sp:EncryptSignature />
+ <sp:OnlySignEntireHeadersAndBody />
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier />
+ <sp:MustSupportRefIssuerSerial />
+ <sp:MustSupportRefThumbprint />
+ <sp:MustSupportRefEncryptedKey />
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens />
+ <sp:RequireClientEntropy />
+ <sp:RequireServerEntropy />
+ </wsp:Policy>
+ </sp:Trust10>
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="WSHttpBinding_IDataApi_GetAge_Input_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ </sp:EncryptedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="WSHttpBinding_IDataApi_GetAge_output_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ </sp:EncryptedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="WSHttpBinding_IDataApi_GetName_Input_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ </sp:EncryptedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="WSHttpBinding_IDataApi_GetName_output_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body />
+ </sp:EncryptedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://tempuri.org/Imports">
+ <xsd:import schemaLocation="http://localhost:65169/ServiceProvider/DataApi.svc?xsd=xsd0" namespace="http://tempuri.org/" />
+ <xsd:import schemaLocation="http://localhost:65169/ServiceProvider/DataApi.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="IDataApi_GetAge_InputMessage">
+ <wsdl:part name="parameters" element="tns:GetAge" />
+ </wsdl:message>
+ <wsdl:message name="IDataApi_GetAge_OutputMessage">
+ <wsdl:part name="parameters" element="tns:GetAgeResponse" />
+ </wsdl:message>
+ <wsdl:message name="IDataApi_GetName_InputMessage">
+ <wsdl:part name="parameters" element="tns:GetName" />
+ </wsdl:message>
+ <wsdl:message name="IDataApi_GetName_OutputMessage">
+ <wsdl:part name="parameters" element="tns:GetNameResponse" />
+ </wsdl:message>
+ <wsdl:portType name="IDataApi">
+ <wsdl:operation name="GetAge">
+ <wsdl:input wsaw:Action="http://tempuri.org/IDataApi/GetAge" message="tns:IDataApi_GetAge_InputMessage" />
+ <wsdl:output wsaw:Action="http://tempuri.org/IDataApi/GetAgeResponse" message="tns:IDataApi_GetAge_OutputMessage" />
+ </wsdl:operation>
+ <wsdl:operation name="GetName">
+ <wsdl:input wsaw:Action="http://tempuri.org/IDataApi/GetName" message="tns:IDataApi_GetName_InputMessage" />
+ <wsdl:output wsaw:Action="http://tempuri.org/IDataApi/GetNameResponse" message="tns:IDataApi_GetName_OutputMessage" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="WSHttpBinding_IDataApi" type="tns:IDataApi">
+ <wsp:PolicyReference URI="#WSHttpBinding_IDataApi_policy" />
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="GetAge">
+ <soap12:operation soapAction="http://tempuri.org/IDataApi/GetAge" style="document" />
+ <wsdl:input>
+ <wsp:PolicyReference URI="#WSHttpBinding_IDataApi_GetAge_Input_policy" />
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <wsp:PolicyReference URI="#WSHttpBinding_IDataApi_GetAge_output_policy" />
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetName">
+ <soap12:operation soapAction="http://tempuri.org/IDataApi/GetName" style="document" />
+ <wsdl:input>
+ <wsp:PolicyReference URI="#WSHttpBinding_IDataApi_GetName_Input_policy" />
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <wsp:PolicyReference URI="#WSHttpBinding_IDataApi_GetName_output_policy" />
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="DataApi">
+ <wsdl:port name="WSHttpBinding_IDataApi" binding="tns:WSHttpBinding_IDataApi">
+ <soap12:address location="http://localhost:65169/ServiceProvider/DataApi.svc" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>http://localhost:65169/ServiceProvider/DataApi.svc</wsa10:Address>
+ <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
+ <Dns>localhost</Dns>
+ </Identity>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions> \ No newline at end of file
diff --git a/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.xsd b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.xsd
new file mode 100644
index 0000000..32e1c19
--- /dev/null
+++ b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="anyType" nillable="true" type="xs:anyType" />
+ <xs:element name="anyURI" nillable="true" type="xs:anyURI" />
+ <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
+ <xs:element name="boolean" nillable="true" type="xs:boolean" />
+ <xs:element name="byte" nillable="true" type="xs:byte" />
+ <xs:element name="dateTime" nillable="true" type="xs:dateTime" />
+ <xs:element name="decimal" nillable="true" type="xs:decimal" />
+ <xs:element name="double" nillable="true" type="xs:double" />
+ <xs:element name="float" nillable="true" type="xs:float" />
+ <xs:element name="int" nillable="true" type="xs:int" />
+ <xs:element name="long" nillable="true" type="xs:long" />
+ <xs:element name="QName" nillable="true" type="xs:QName" />
+ <xs:element name="short" nillable="true" type="xs:short" />
+ <xs:element name="string" nillable="true" type="xs:string" />
+ <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
+ <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
+ <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
+ <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
+ <xs:element name="char" nillable="true" type="tns:char" />
+ <xs:simpleType name="char">
+ <xs:restriction base="xs:int" />
+ </xs:simpleType>
+ <xs:element name="duration" nillable="true" type="tns:duration" />
+ <xs:simpleType name="duration">
+ <xs:restriction base="xs:duration">
+ <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
+ <xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
+ <xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="guid" nillable="true" type="tns:guid" />
+ <xs:simpleType name="guid">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:attribute name="FactoryType" type="xs:QName" />
+ <xs:attribute name="Id" type="xs:ID" />
+ <xs:attribute name="Ref" type="xs:IDREF" />
+</xs:schema> \ No newline at end of file
diff --git a/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi1.xsd b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi1.xsd
new file mode 100644
index 0000000..43c8d9b
--- /dev/null
+++ b/samples/Consumer/App_WebReferences/SampleServiceProvider/DataApi1.xsd
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="GetAge">
+ <xs:complexType>
+ <xs:sequence />
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetAgeResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="GetAgeResult" type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetName">
+ <xs:complexType>
+ <xs:sequence />
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetNameResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="GetNameResult" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema> \ No newline at end of file
diff --git a/samples/Consumer/App_WebReferences/SampleServiceProvider/Reference.svcmap b/samples/Consumer/App_WebReferences/SampleServiceProvider/Reference.svcmap
new file mode 100644
index 0000000..98b17ca
--- /dev/null
+++ b/samples/Consumer/App_WebReferences/SampleServiceProvider/Reference.svcmap
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="a9540115-d434-4d5b-b398-ed16a994aba2" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
+ <ClientOptions>
+ <GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
+ <EnableDataBinding>true</EnableDataBinding>
+ <ExcludedTypes />
+ <ImportXmlTypes>false</ImportXmlTypes>
+ <GenerateInternalTypes>false</GenerateInternalTypes>
+ <GenerateMessageContracts>false</GenerateMessageContracts>
+ <NamespaceMappings />
+ <CollectionMappings />
+ <GenerateSerializableTypes>true</GenerateSerializableTypes>
+ <Serializer>Auto</Serializer>
+ <ReferenceAllAssemblies>true</ReferenceAllAssemblies>
+ <ReferencedAssemblies />
+ <ReferencedDataContractTypes />
+ <ServiceContractMappings />
+ </ClientOptions>
+ <MetadataSources>
+ <MetadataSource Address="http://localhost:65169/ServiceProvider/DataApi.svc" Protocol="http" SourceId="1" />
+ </MetadataSources>
+ <Metadata>
+ <MetadataFile FileName="DataApi.xsd" MetadataType="Schema" ID="fdc9f289-8c10-4fc6-abeb-052bc1116679" SourceId="1" SourceUrl="http://localhost:65169/ServiceProvider/DataApi.svc?xsd=xsd1" />
+ <MetadataFile FileName="DataApi.wsdl" MetadataType="Wsdl" ID="182a10fe-d606-4fc0-b64c-3e682dcae89d" SourceId="1" SourceUrl="http://localhost:65169/ServiceProvider/DataApi.svc?wsdl" />
+ <MetadataFile FileName="DataApi1.xsd" MetadataType="Schema" ID="80d06927-f2e7-4d1d-8c7a-f3dc74f4d3d6" SourceId="1" SourceUrl="http://localhost:65169/ServiceProvider/DataApi.svc?xsd=xsd0" />
+ <MetadataFile FileName="DataApi.disco" MetadataType="Disco" ID="25047770-8993-4bf3-acee-64b5f3598f2c" SourceId="1" SourceUrl="http://localhost:65169/ServiceProvider/DataApi.svc?disco" />
+ </Metadata>
+ <Extensions>
+ <ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />
+ <ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" />
+ </Extensions>
+</ReferenceGroup> \ No newline at end of file
diff --git a/samples/Consumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo b/samples/Consumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo
new file mode 100644
index 0000000..f7ff613
--- /dev/null
+++ b/samples/Consumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
+ <behaviors />
+ <bindings>
+ <binding digest="System.ServiceModel.Configuration.WSHttpBindingElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data hostNameComparisonMode=&quot;StrongWildcard&quot; messageEncoding=&quot;Text&quot; name=&quot;WSHttpBinding_IDataApi&quot; textEncoding=&quot;utf-8&quot; transactionFlow=&quot;false&quot;&gt;&lt;readerQuotas maxArrayLength=&quot;16384&quot; maxBytesPerRead=&quot;4096&quot; maxDepth=&quot;32&quot; maxNameTableCharCount=&quot;16384&quot; maxStringContentLength=&quot;8192&quot; /&gt;&lt;reliableSession enabled=&quot;false&quot; inactivityTimeout=&quot;00:10:00&quot; ordered=&quot;true&quot; /&gt;&lt;security mode=&quot;Message&quot;&gt;&lt;message algorithmSuite=&quot;Default&quot; clientCredentialType=&quot;Windows&quot; establishSecurityContext=&quot;true&quot; negotiateServiceCredential=&quot;true&quot; /&gt;&lt;transport clientCredentialType=&quot;Windows&quot; proxyCredentialType=&quot;None&quot; realm=&quot;&quot; /&gt;&lt;/security&gt;&lt;/Data&gt;" bindingType="wsHttpBinding" name="WSHttpBinding_IDataApi" />
+ </bindings>
+ <endpoints>
+ <endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://localhost:65169/ServiceProvider/DataApi.svc&quot; binding=&quot;wsHttpBinding&quot; bindingConfiguration=&quot;WSHttpBinding_IDataApi&quot; contract=&quot;SampleServiceProvider.IDataApi&quot; name=&quot;WSHttpBinding_IDataApi&quot;&gt;&lt;identity&gt;&lt;dns value=&quot;localhost&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://localhost:65169/ServiceProvider/DataApi.svc&quot; binding=&quot;wsHttpBinding&quot; bindingConfiguration=&quot;WSHttpBinding_IDataApi&quot; contract=&quot;SampleServiceProvider.IDataApi&quot; name=&quot;WSHttpBinding_IDataApi&quot;&gt;&lt;identity&gt;&lt;dns value=&quot;localhost&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" contractName="SampleServiceProvider.IDataApi" name="WSHttpBinding_IDataApi" />
+ </endpoints>
+</configurationSnapshot> \ No newline at end of file
diff --git a/samples/Consumer/App_WebReferences/SampleServiceProvider/configuration91.svcinfo b/samples/Consumer/App_WebReferences/SampleServiceProvider/configuration91.svcinfo
new file mode 100644
index 0000000..753944d
--- /dev/null
+++ b/samples/Consumer/App_WebReferences/SampleServiceProvider/configuration91.svcinfo
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="Gtb7NAD474X6NPnHmitA0NiFc2w=">
+ <bindingConfigurations>
+ <bindingConfiguration bindingType="wsHttpBinding" name="WSHttpBinding_IDataApi">
+ <properties>
+ <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>WSHttpBinding_IDataApi</serializedValue>
+ </property>
+ <property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>00:01:00</serializedValue>
+ </property>
+ <property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>00:01:00</serializedValue>
+ </property>
+ <property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>00:10:00</serializedValue>
+ </property>
+ <property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>00:01:00</serializedValue>
+ </property>
+ <property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>False</serializedValue>
+ </property>
+ <property path="/transactionFlow" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>False</serializedValue>
+ </property>
+ <property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>StrongWildcard</serializedValue>
+ </property>
+ <property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>524288</serializedValue>
+ </property>
+ <property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>65536</serializedValue>
+ </property>
+ <property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>Text</serializedValue>
+ </property>
+ <property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue>
+ </property>
+ <property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>32</serializedValue>
+ </property>
+ <property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>8192</serializedValue>
+ </property>
+ <property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>16384</serializedValue>
+ </property>
+ <property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>4096</serializedValue>
+ </property>
+ <property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>16384</serializedValue>
+ </property>
+ <property path="/reliableSession" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.StandardBindingOptionalReliableSessionElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.StandardBindingOptionalReliableSessionElement</serializedValue>
+ </property>
+ <property path="/reliableSession/ordered" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>True</serializedValue>
+ </property>
+ <property path="/reliableSession/inactivityTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>00:10:00</serializedValue>
+ </property>
+ <property path="/reliableSession/enabled" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>False</serializedValue>
+ </property>
+ <property path="/textEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.Text.Encoding, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.Text.UTF8Encoding</serializedValue>
+ </property>
+ <property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>True</serializedValue>
+ </property>
+ <property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>False</serializedValue>
+ </property>
+ <property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpSecurityElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.WSHttpSecurityElement</serializedValue>
+ </property>
+ <property path="/security/mode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.SecurityMode, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>Message</serializedValue>
+ </property>
+ <property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpTransportSecurityElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.WSHttpTransportSecurityElement</serializedValue>
+ </property>
+ <property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>Windows</serializedValue>
+ </property>
+ <property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>None</serializedValue>
+ </property>
+ <property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.NonDualMessageSecurityOverHttpElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.NonDualMessageSecurityOverHttpElement</serializedValue>
+ </property>
+ <property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.MessageCredentialType, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>Windows</serializedValue>
+ </property>
+ <property path="/security/message/negotiateServiceCredential" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>True</serializedValue>
+ </property>
+ <property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>Basic256</serializedValue>
+ </property>
+ <property path="/security/message/establishSecurityContext" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>True</serializedValue>
+ </property>
+ </properties>
+ </bindingConfiguration>
+ </bindingConfigurations>
+ <endpoints>
+ <endpoint name="WSHttpBinding_IDataApi" contract="SampleServiceProvider.IDataApi" bindingType="wsHttpBinding" address="http://localhost:65169/ServiceProvider/DataApi.svc" bindingConfiguration="WSHttpBinding_IDataApi">
+ <properties>
+ <property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>http://localhost:65169/ServiceProvider/DataApi.svc</serializedValue>
+ </property>
+ <property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>wsHttpBinding</serializedValue>
+ </property>
+ <property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>WSHttpBinding_IDataApi</serializedValue>
+ </property>
+ <property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>SampleServiceProvider.IDataApi</serializedValue>
+ </property>
+ <property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue>
+ </property>
+ <property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>&lt;Header /&gt;</serializedValue>
+ </property>
+ <property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue>
+ </property>
+ <property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue>
+ </property>
+ <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue>
+ </property>
+ <property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue>
+ </property>
+ <property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>localhost</serializedValue>
+ </property>
+ <property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue>
+ </property>
+ <property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue>
+ </property>
+ <property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue>
+ </property>
+ <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>My</serializedValue>
+ </property>
+ <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>LocalMachine</serializedValue>
+ </property>
+ <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>FindBySubjectDistinguishedName</serializedValue>
+ </property>
+ <property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>False</serializedValue>
+ </property>
+ <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>WSHttpBinding_IDataApi</serializedValue>
+ </property>
+ </properties>
+ </endpoint>
+ </endpoints>
+</SavedWcfConfigurationInformation> \ No newline at end of file
diff --git a/samples/Consumer/Default.aspx b/samples/Consumer/Default.aspx
index ac9ebec..c150202 100644
--- a/samples/Consumer/Default.aspx
+++ b/samples/Consumer/Default.aspx
@@ -6,5 +6,6 @@
<p>Select a demo:</p>
<ul>
<li><a href="GoogleAddressBook.aspx">Download your Gmail address book</a></li>
+ <li><a href="SampleWcf.aspx">Interop with Service Provider sample using WCF w/ OAuth</a></li>
</ul>
</asp:Content>
diff --git a/samples/Consumer/GoogleAddressBook.aspx.cs b/samples/Consumer/GoogleAddressBook.aspx.cs
index 5197b66..681f026 100644
--- a/samples/Consumer/GoogleAddressBook.aspx.cs
+++ b/samples/Consumer/GoogleAddressBook.aspx.cs
@@ -65,6 +65,8 @@ public partial class GoogleAddressBook : System.Web.UI.Page {
var extraParameters = new Dictionary<string, string> {
{ "scope", Constants.GoogleScopes.Contacts },
};
- google.RequestUserAuthorization(new Uri(Request.Url, Request.RawUrl), extraParameters, null).Send();
+ UriBuilder callback = new UriBuilder(new Uri(Request.Url, Request.RawUrl));
+ callback.Query = null;
+ google.RequestUserAuthorization(callback.Uri, extraParameters, null).Send();
}
}
diff --git a/samples/Consumer/SampleWcf.aspx b/samples/Consumer/SampleWcf.aspx
new file mode 100644
index 0000000..604be81
--- /dev/null
+++ b/samples/Consumer/SampleWcf.aspx
@@ -0,0 +1,15 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
+ CodeFile="SampleWcf.aspx.cs" Inherits="SampleWcf" %>
+
+<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
+
+ <asp:Button ID="getAuthorizationButton" runat="server" Text="Get Authorization"
+ onclick="getAuthorizationButton_Click" />
+ <br />
+ <asp:Button ID="getNameButton" runat="server" Text="Get Name"
+ onclick="getNameButton_Click" />
+ <br />
+ <asp:Button ID="getAgeButton" runat="server" Text="Get Age"
+ onclick="getAgeButton_Click" />
+
+</asp:Content>
diff --git a/samples/Consumer/SampleWcf.aspx.cs b/samples/Consumer/SampleWcf.aspx.cs
new file mode 100644
index 0000000..af89f61
--- /dev/null
+++ b/samples/Consumer/SampleWcf.aspx.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Net;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using DotNetOAuth;
+using DotNetOAuth.ChannelElements;
+using DotNetOAuth.Messaging;
+using SampleServiceProvider;
+
+/// <summary>
+/// Sample consumer of our Service Provider sample's WCF service.
+/// </summary>
+public partial class SampleWcf : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ if (!IsPostBack) {
+ if (Session["WcfTokenManager"] != null) {
+ Consumer consumer = CreateConsumer();
+ var accessTokenMessage = consumer.ProcessUserAuthorization();
+ if (accessTokenMessage != null) {
+ Session["WcfAccessToken"] = accessTokenMessage.AccessToken;
+ }
+ }
+ }
+ }
+
+ protected void getAuthorizationButton_Click(object sender, EventArgs e) {
+ Consumer consumer = CreateConsumer();
+ consumer.RequestUserAuthorization().Send();
+ }
+
+ protected void getNameButton_Click(object sender, EventArgs e) {
+ DataApiClient client = new DataApiClient();
+ var serviceEndpoint = new MessageReceivingEndpoint(client.Endpoint.Address.Uri, HttpDeliveryMethod.AuthorizationHeaderRequest | HttpDeliveryMethod.PostRequest);
+ var accessToken = Session["WcfAccessToken"] as string;
+ Consumer consumer = CreateConsumer();
+ WebRequest httpRequest = consumer.CreateAuthorizedRequest(serviceEndpoint, accessToken);
+
+ HttpRequestMessageProperty httpDetails = new HttpRequestMessageProperty();
+ httpDetails.Headers[HttpRequestHeader.Authorization] = httpRequest.Headers[HttpRequestHeader.Authorization];
+ string name;
+ using (OperationContextScope scope = new OperationContextScope(client.InnerChannel)) {
+ OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpDetails;
+ name = client.GetName();
+ }
+ Response.Write(name);
+ }
+
+ protected void getAgeButton_Click(object sender, EventArgs e) {
+ }
+
+ private Consumer CreateConsumer() {
+ string consumerKey = "sampleconsumer";
+ string consumerSecret = "samplesecret";
+ var tokenManager = Session["WcfTokenManager"] as InMemoryTokenManager;
+ if (tokenManager == null) {
+ tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
+ Session["WcfTokenManager"] = tokenManager;
+ }
+ MessageReceivingEndpoint oauthEndpoint = new MessageReceivingEndpoint(
+ new Uri("http://localhost:65169/ServiceProvider/OAuth.ashx"),
+ HttpDeliveryMethod.PostRequest);
+ Consumer consumer = new Consumer(new ServiceProviderDescription {
+ RequestTokenEndpoint = oauthEndpoint,
+ UserAuthorizationEndpoint = oauthEndpoint,
+ AccessTokenEndpoint = oauthEndpoint,
+ TamperProtectionElements = new DotNetOAuth.Messaging.ITamperProtectionChannelBindingElement[] {
+ new HmacSha1SigningBindingElement(),
+ },
+ }, tokenManager) {
+ ConsumerKey = consumerKey,
+ ConsumerSecret = consumerSecret,
+ };
+
+ return consumer;
+ }
+}
diff --git a/samples/Consumer/Web.config b/samples/Consumer/Web.config
index 763a4bd..be02eaf 100644
--- a/samples/Consumer/Web.config
+++ b/samples/Consumer/Web.config
@@ -1,12 +1,4 @@
<?xml version="1.0"?>
-<!--
- Note: As an alternative to hand editing this file you can use the
- web admin tool to configure settings for your application. Use
- the Website->Asp.Net Configuration option in Visual Studio.
- A full list of settings and comments can be found in
- machine.config.comments usually located in
- \Windows\Microsoft.Net\Framework\v2.x\Config
--->
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
@@ -135,4 +127,35 @@
<level value="ALL" />
</logger>
</log4net>
+ <system.serviceModel>
+ <bindings>
+ <wsHttpBinding>
+ <binding name="WSHttpBinding_IDataApi" closeTimeout="00:01:00"
+ openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
+ bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
+ maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
+ textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
+ <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
+ maxBytesPerRead="4096" maxNameTableCharCount="16384" />
+ <reliableSession ordered="true" inactivityTimeout="00:10:00"
+ enabled="false" />
+ <security mode="Message">
+ <transport clientCredentialType="Windows" proxyCredentialType="None"
+ realm="" />
+ <message clientCredentialType="Windows" negotiateServiceCredential="true"
+ algorithmSuite="Default" establishSecurityContext="true" />
+ </security>
+ </binding>
+ </wsHttpBinding>
+ </bindings>
+ <client>
+ <endpoint address="http://localhost:65169/ServiceProvider/DataApi.svc"
+ binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDataApi"
+ contract="SampleServiceProvider.IDataApi" name="WSHttpBinding_IDataApi">
+ <identity>
+ <dns value="localhost" />
+ </identity>
+ </endpoint>
+ </client>
+ </system.serviceModel>
</configuration>
diff --git a/samples/ServiceProvider/App_Code/Constants.cs b/samples/ServiceProvider/App_Code/Constants.cs
new file mode 100644
index 0000000..7965dc0
--- /dev/null
+++ b/samples/ServiceProvider/App_Code/Constants.cs
@@ -0,0 +1,32 @@
+using System;
+using DotNetOAuth;
+using DotNetOAuth.ChannelElements;
+using DotNetOAuth.Messaging;
+
+/// <summary>
+/// Service Provider definitions.
+/// </summary>
+public static class Constants {
+ public static InMemoryTokenManager TokenManager { get; set; }
+
+ public static Uri WebRootUrl { get; set; }
+
+ public static ServiceProviderDescription SelfDescription {
+ get {
+ ServiceProviderDescription description = new ServiceProviderDescription {
+ AccessTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethod.PostRequest),
+ RequestTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethod.PostRequest),
+ UserAuthorizationEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethod.PostRequest),
+ TamperProtectionElements = new ITamperProtectionChannelBindingElement[] {
+ new HmacSha1SigningBindingElement(),
+ },
+ };
+
+ return description;
+ }
+ }
+
+ public static ServiceProvider CreateServiceProvider() {
+ return new ServiceProvider(SelfDescription, TokenManager);
+ }
+}
diff --git a/samples/ServiceProvider/App_Code/DataApi.cs b/samples/ServiceProvider/App_Code/DataApi.cs
new file mode 100644
index 0000000..9e679cd
--- /dev/null
+++ b/samples/ServiceProvider/App_Code/DataApi.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.Text;
+
+public class DataApi : IDataApi {
+ public int GetAge() {
+ return 5;
+ }
+
+ public string GetName() {
+ return "Andrew";
+ }
+}
diff --git a/samples/ServiceProvider/App_Code/IDataApi.cs b/samples/ServiceProvider/App_Code/IDataApi.cs
new file mode 100644
index 0000000..895dda1
--- /dev/null
+++ b/samples/ServiceProvider/App_Code/IDataApi.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.Text;
+
+[ServiceContract]
+public interface IDataApi {
+ [OperationContract]
+ int GetAge();
+
+ [OperationContract]
+ string GetName();
+}
diff --git a/samples/ServiceProvider/App_Code/InMemoryTokenManager.cs b/samples/ServiceProvider/App_Code/InMemoryTokenManager.cs
new file mode 100644
index 0000000..540fd81
--- /dev/null
+++ b/samples/ServiceProvider/App_Code/InMemoryTokenManager.cs
@@ -0,0 +1,91 @@
+//-----------------------------------------------------------------------
+// <copyright file="InMemoryTokenManager.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using DotNetOAuth.ChannelElements;
+
+public class InMemoryTokenManager : ITokenManager {
+ private Dictionary<string, string> consumersAndSecrets = new Dictionary<string, string>();
+ private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
+
+ /// <summary>
+ /// Request tokens that have been issued, and whether they have been authorized yet.
+ /// </summary>
+ private Dictionary<string, bool> requestTokens = new Dictionary<string, bool>();
+
+ /// <summary>
+ /// Access tokens that have been issued and have not yet expired.
+ /// </summary>
+ private List<string> accessTokens = new List<string>();
+
+ #region ITokenManager Members
+
+ public string GetConsumerSecret(string consumerKey) {
+ return this.consumersAndSecrets[consumerKey];
+ }
+
+ public string GetTokenSecret(string token) {
+ return this.tokensAndSecrets[token];
+ }
+
+ public void StoreNewRequestToken(string consumerKey, string requestToken, string requestTokenSecret, IDictionary<string, string> parameters) {
+ this.tokensAndSecrets[requestToken] = requestTokenSecret;
+ this.requestTokens.Add(requestToken, false);
+ }
+
+ /// <summary>
+ /// Checks whether a given request token has already been authorized
+ /// by some user for use by the Consumer that requested it.
+ /// </summary>
+ /// <param name="requestToken">The Consumer's request token.</param>
+ /// <returns>
+ /// True if the request token has already been fully authorized by the user
+ /// who owns the relevant protected resources. False if the token has not yet
+ /// been authorized, has expired or does not exist.
+ /// </returns>
+ public bool IsRequestTokenAuthorized(string requestToken) {
+ return this.requestTokens[requestToken];
+ }
+
+ public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
+ Debug.Assert(this.requestTokens[requestToken], "Unauthorized token should not be exchanged for access token.");
+ this.requestTokens.Remove(requestToken);
+ this.accessTokens.Add(accessToken);
+ this.tokensAndSecrets.Remove(requestToken);
+ this.tokensAndSecrets[accessToken] = accessTokenSecret;
+ }
+
+ /// <summary>
+ /// Classifies a token as a request token or an access token.
+ /// </summary>
+ /// <param name="token">The token to classify.</param>
+ /// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
+ public TokenType GetTokenType(string token) {
+ if (this.requestTokens.ContainsKey(token)) {
+ return TokenType.RequestToken;
+ } else if (this.accessTokens.Contains(token)) {
+ return TokenType.AccessToken;
+ } else {
+ return TokenType.InvalidToken;
+ }
+ }
+
+ #endregion
+
+ public void AddConsumer(string key, string secret) {
+ this.consumersAndSecrets.Add(key, secret);
+ }
+
+ public void AuthorizeRequestToken(string requestToken) {
+ if (requestToken == null) {
+ throw new ArgumentNullException("requestToken");
+ }
+
+ this.requestTokens[requestToken] = true;
+ }
+}
diff --git a/samples/ServiceProvider/App_Code/Logging.cs b/samples/ServiceProvider/App_Code/Logging.cs
new file mode 100644
index 0000000..cba9b4e
--- /dev/null
+++ b/samples/ServiceProvider/App_Code/Logging.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+
+/// <summary>
+/// Logging tools for this sample.
+/// </summary>
+public static class Logging {
+ /// <summary>
+ /// An application memory cache of recent log messages.
+ /// </summary>
+ public static StringBuilder LogMessages = new StringBuilder();
+
+ /// <summary>
+ /// The logger for this sample to use.
+ /// </summary>
+ public static log4net.ILog Logger = log4net.LogManager.GetLogger("DotNetOAuth.ConsumerSample");
+}
diff --git a/samples/ServiceProvider/App_Code/OAuthAuthorizationManager.cs b/samples/ServiceProvider/App_Code/OAuthAuthorizationManager.cs
new file mode 100644
index 0000000..20536d8
--- /dev/null
+++ b/samples/ServiceProvider/App_Code/OAuthAuthorizationManager.cs
@@ -0,0 +1,32 @@
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using DotNetOAuth;
+
+/// <summary>
+/// A WCF extension to authenticate incoming messages using OAuth.
+/// </summary>
+public class OAuthAuthorizationManager : ServiceAuthorizationManager {
+ public OAuthAuthorizationManager() {
+ }
+
+ protected override bool CheckAccessCore(OperationContext operationContext) {
+ if (!base.CheckAccessCore(operationContext)) {
+ return false;
+ }
+
+ HttpRequestMessageProperty httpDetails = operationContext.RequestContext.RequestMessage.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
+ Uri requestUri = operationContext.RequestContext.RequestMessage.Properties["OriginalHttpRequestUri"] as Uri;
+ ServiceProvider sp = Constants.CreateServiceProvider();
+ var auth = sp.GetProtectedResourceAuthorization(httpDetails, requestUri);
+ if (auth != null) {
+ string consumer = auth.ConsumerKey;
+
+ //// TODO: pass the consumer along to the operation somehow
+
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/samples/ServiceProvider/App_Code/TracePageAppender.cs b/samples/ServiceProvider/App_Code/TracePageAppender.cs
new file mode 100644
index 0000000..b3b539a
--- /dev/null
+++ b/samples/ServiceProvider/App_Code/TracePageAppender.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Web;
+
+public class TracePageAppender : log4net.Appender.AppenderSkeleton {
+ protected override void Append(log4net.Core.LoggingEvent loggingEvent) {
+ StringWriter sw = new StringWriter(Logging.LogMessages);
+ Layout.Format(sw, loggingEvent);
+ }
+}
diff --git a/samples/ServiceProvider/Authorize.aspx b/samples/ServiceProvider/Authorize.aspx
new file mode 100644
index 0000000..63774e9
--- /dev/null
+++ b/samples/ServiceProvider/Authorize.aspx
@@ -0,0 +1,20 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
+ CodeFile="Authorize.aspx.cs" Inherits="Authorize" %>
+
+<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
+ <div style="background-color: Yellow">
+ <b>Warning</b>: Never give your login credentials to another web site or application.
+ </div>
+ <p>The client web site or application
+ <asp:Label ID="consumerLabel" Font-Bold="true" runat="server" Text="[consumer]" />
+ wants access to your
+ <asp:Label ID="desiredAccessLabel" Font-Bold="true" runat="server" Text="[protected resource]" />.
+ </p>
+ <p>Do you want to allow this? </p>
+ <div>
+ <asp:Button ID="allowAccessButton" runat="server" Text="Yes" />
+ <asp:Button ID="denyAccessButton" runat="server" Text="No" />
+ </div>
+ <p>If you grant access now, you can revoke it at any time by returning to this page.
+ </p>
+</asp:Content>
diff --git a/samples/ServiceProvider/Authorize.aspx.cs b/samples/ServiceProvider/Authorize.aspx.cs
new file mode 100644
index 0000000..aecd831
--- /dev/null
+++ b/samples/ServiceProvider/Authorize.aspx.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+/// <summary>
+/// Conducts the user through a Consumer authorization process.
+/// </summary>
+public partial class Authorize : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ if (!IsPostBack && false) {
+ Response.Redirect("~/AuthorizedConsumers.aspx");
+ }
+ }
+}
diff --git a/samples/ServiceProvider/AuthorizedConsumers.aspx b/samples/ServiceProvider/AuthorizedConsumers.aspx
new file mode 100644
index 0000000..13d0f68
--- /dev/null
+++ b/samples/ServiceProvider/AuthorizedConsumers.aspx
@@ -0,0 +1,5 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AuthorizedConsumers.aspx.cs" Inherits="AuthorizedConsumers" %>
+
+<asp:Content ID="Content2" ContentPlaceHolderID="Body" Runat="Server">
+</asp:Content>
+
diff --git a/samples/ServiceProvider/AuthorizedConsumers.aspx.cs b/samples/ServiceProvider/AuthorizedConsumers.aspx.cs
new file mode 100644
index 0000000..1fb4e95
--- /dev/null
+++ b/samples/ServiceProvider/AuthorizedConsumers.aspx.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+/// <summary>
+/// Lists the consumers that have active request or access tokens
+/// and provides a mechanism for the user to revoke permissions.
+/// </summary>
+public partial class AuthorizedConsumers : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ }
+}
diff --git a/samples/ServiceProvider/DataApi.svc b/samples/ServiceProvider/DataApi.svc
new file mode 100644
index 0000000..8dcf863
--- /dev/null
+++ b/samples/ServiceProvider/DataApi.svc
@@ -0,0 +1 @@
+<%@ ServiceHost Language="C#" Debug="true" Service="DataApi" CodeBehind="~/App_Code/DataApi.cs" %>
diff --git a/samples/ServiceProvider/Default.aspx b/samples/ServiceProvider/Default.aspx
new file mode 100644
index 0000000..6c8816d
--- /dev/null
+++ b/samples/ServiceProvider/Default.aspx
@@ -0,0 +1,9 @@
+<%@ Page Title="DotNetOAuth Service Provider Sample" Language="C#" MasterPageFile="~/MasterPage.master" %>
+
+<script runat="server">
+
+</script>
+
+<asp:Content ID="Content2" ContentPlaceHolderID="Body" Runat="Server">
+</asp:Content>
+
diff --git a/samples/ServiceProvider/Global.asax b/samples/ServiceProvider/Global.asax
new file mode 100644
index 0000000..ab1280b
--- /dev/null
+++ b/samples/ServiceProvider/Global.asax
@@ -0,0 +1,36 @@
+<%@ Application Language="C#" %>
+
+<script RunAt="server">
+ void Application_Start(object sender, EventArgs e) {
+ log4net.Config.XmlConfigurator.Configure();
+ Logging.Logger.Info("Sample starting...");
+ Constants.WebRootUrl = new Uri(HttpContext.Current.Request.Url, "/");
+ var tokenManager = new InMemoryTokenManager();
+ tokenManager.AddConsumer("sampleconsumer", "samplesecret");
+ Constants.TokenManager = tokenManager;
+ }
+
+ void Application_End(object sender, EventArgs e) {
+ Logging.Logger.Info("Sample shutting down...");
+ // this would be automatic, but in partial trust scenarios it is not.
+ log4net.LogManager.Shutdown();
+ }
+
+ void Application_Error(object sender, EventArgs e) {
+ // Code that runs when an unhandled error occurs
+
+ }
+
+ void Session_Start(object sender, EventArgs e) {
+ // Code that runs when a new session is started
+
+ }
+
+ void Session_End(object sender, EventArgs e) {
+ // Code that runs when a session ends.
+ // Note: The Session_End event is raised only when the sessionstate mode
+ // is set to InProc in the Web.config file. If session mode is set to StateServer
+ // or SQLServer, the event is not raised.
+
+ }
+</script>
diff --git a/samples/ServiceProvider/MasterPage.master b/samples/ServiceProvider/MasterPage.master
new file mode 100644
index 0000000..4bc6059
--- /dev/null
+++ b/samples/ServiceProvider/MasterPage.master
@@ -0,0 +1,23 @@
+<%@ Master Language="C#" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<script runat="server">
+
+</script>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title>DotNetOAuth Service Provider sample</title>
+ <asp:ContentPlaceHolder ID="head" runat="server"/>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <h1>DotNetOAuth Service Provider sample</h1>
+ <div>
+ <asp:ContentPlaceHolder ID="Body" runat="server">
+ </asp:ContentPlaceHolder>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/samples/ServiceProvider/OAuth.ashx b/samples/ServiceProvider/OAuth.ashx
new file mode 100644
index 0000000..f6694bc
--- /dev/null
+++ b/samples/ServiceProvider/OAuth.ashx
@@ -0,0 +1,40 @@
+<%@ WebHandler Language="C#" Class="OAuth" %>
+
+using System;
+using System.Web;
+using System.Web.SessionState;
+using DotNetOAuth;
+using DotNetOAuth.ChannelElements;
+using DotNetOAuth.Messages;
+using DotNetOAuth.Messaging;
+
+public class OAuth : IHttpHandler, IRequiresSessionState {
+ ServiceProvider sp;
+
+ public OAuth() {
+ sp = new ServiceProvider(Constants.SelfDescription, Constants.TokenManager);
+ }
+
+ public void ProcessRequest(HttpContext context) {
+ IProtocolMessage request = sp.ReadRequest();
+ RequestTokenMessage requestToken;
+ DirectUserToServiceProviderMessage requestAuth;
+ RequestAccessTokenMessage requestAccessToken;
+ if ((requestToken = request as RequestTokenMessage) != null) {
+ sp.SendUnauthorizedTokenResponse(requestToken, null).Send();
+ } else if ((requestAuth = request as DirectUserToServiceProviderMessage) != null) {
+ HttpContext.Current.Session["authrequest"] = requestAuth;
+ //HttpContext.Current.Response.Redirect("~/authorize.aspx");
+ Constants.TokenManager.AuthorizeRequestToken(requestAuth.RequestToken);
+ sp.SendAuthorizationResponse(requestAuth).Send();
+ } else if ((requestAccessToken = request as RequestAccessTokenMessage) != null) {
+ sp.SendAccessToken(requestAccessToken, null).Send();
+ } else {
+ throw new InvalidOperationException();
+ }
+ }
+
+ public bool IsReusable {
+ get { return true; }
+ }
+} \ No newline at end of file
diff --git a/samples/ServiceProvider/Settings.StyleCop b/samples/ServiceProvider/Settings.StyleCop
new file mode 100644
index 0000000..7f55ce6
--- /dev/null
+++ b/samples/ServiceProvider/Settings.StyleCop
@@ -0,0 +1 @@
+<StyleCopSettings Version="4.3" /> \ No newline at end of file
diff --git a/samples/ServiceProvider/TracePage.aspx b/samples/ServiceProvider/TracePage.aspx
new file mode 100644
index 0000000..960e6ed
--- /dev/null
+++ b/samples/ServiceProvider/TracePage.aspx
@@ -0,0 +1,18 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TracePage.aspx.cs" Inherits="TracePage" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <p align="right">
+ <asp:Button runat="server" Text="Clear log" ID="clearLogButton" OnClick="clearLogButton_Click" />
+ </p>
+ <pre>
+ <asp:PlaceHolder runat="server" ID="placeHolder1" />
+ </pre>
+ </form>
+</body>
+</html>
diff --git a/samples/ServiceProvider/TracePage.aspx.cs b/samples/ServiceProvider/TracePage.aspx.cs
new file mode 100644
index 0000000..47e217b
--- /dev/null
+++ b/samples/ServiceProvider/TracePage.aspx.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+/// <summary>
+/// A page to display recent log messages.
+/// </summary>
+public partial class TracePage : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ placeHolder1.Controls.Add(new Label { Text = Logging.LogMessages.ToString() });
+ }
+
+ protected void clearLogButton_Click(object sender, EventArgs e) {
+ Logging.LogMessages.Length = 0;
+
+ // clear the page immediately, and allow for F5 without a Postback warning.
+ Response.Redirect(Request.Url.AbsoluteUri);
+ }
+}
diff --git a/samples/ServiceProvider/Web.config b/samples/ServiceProvider/Web.config
new file mode 100644
index 0000000..01abfbd
--- /dev/null
+++ b/samples/ServiceProvider/Web.config
@@ -0,0 +1,151 @@
+<?xml version="1.0"?>
+<configuration>
+ <configSections>
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false"/>
+ <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
+ <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ </sectionGroup>
+ </sectionGroup>
+ </sectionGroup>
+ </configSections>
+ <appSettings/>
+ <connectionStrings/>
+ <system.web>
+ <!--
+ Set compilation debug="true" to insert debugging
+ symbols into the compiled page. Because this
+ affects performance, set this value to true only
+ during development.
+ -->
+ <compilation debug="true">
+ <assemblies>
+ <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ </assemblies>
+ </compilation>
+ <!--
+ The <authentication> section enables configuration
+ of the security authentication mode used by
+ ASP.NET to identify an incoming user.
+ -->
+ <authentication mode="Windows"/>
+ <!--
+ The <customErrors> section enables configuration
+ of what to do if/when an unhandled error occurs
+ during the execution of a request. Specifically,
+ it enables developers to configure html error pages
+ to be displayed in place of a error stack trace.
+
+ <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+ <error statusCode="403" redirect="NoAccess.htm" />
+ <error statusCode="404" redirect="FileNotFound.htm" />
+ </customErrors>
+ -->
+ <pages>
+ <controls>
+ <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </controls>
+ </pages>
+ <httpHandlers>
+ <remove verb="*" path="*.asmx"/>
+ <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
+ </httpHandlers>
+ <httpModules>
+ <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </httpModules>
+ </system.web>
+ <system.codedom>
+ <compilers>
+ <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <providerOption name="CompilerVersion" value="v3.5"/>
+ <providerOption name="WarnAsError" value="false"/>
+ </compiler>
+ <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <providerOption name="CompilerVersion" value="v3.5"/>
+ <providerOption name="OptionInfer" value="true"/>
+ <providerOption name="WarnAsError" value="false"/>
+ </compiler>
+ </compilers>
+ </system.codedom>
+ <!--
+ The system.webServer section is required for running ASP.NET AJAX under Internet
+ Information Services 7.0. It is not necessary for previous version of IIS.
+ -->
+ <system.webServer>
+ <validation validateIntegratedModeConfiguration="false"/>
+ <modules>
+ <remove name="ScriptModule"/>
+ <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </modules>
+ <handlers>
+ <remove name="WebServiceHandlerFactory-Integrated"/>
+ <remove name="ScriptHandlerFactory"/>
+ <remove name="ScriptHandlerFactoryAppServices"/>
+ <remove name="ScriptResource"/>
+ <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </handlers>
+ </system.webServer>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
+ <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
+ <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+ <log4net>
+ <appender name="TracePageAppender" type="TracePageAppender, __code">
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline"/>
+ </layout>
+ </appender>
+ <!-- Setup the root category, add the appenders and set the default level -->
+ <root>
+ <level value="INFO"/>
+ <!--<appender-ref ref="RollingFileAppender" />-->
+ <appender-ref ref="TracePageAppender"/>
+ </root>
+ <!-- Specify the level for some specific categories -->
+ <logger name="DotNetOAuth">
+ <level value="ALL"/>
+ </logger>
+ </log4net>
+ <system.serviceModel>
+ <behaviors>
+ <serviceBehaviors>
+ <behavior name="DataApiBehavior">
+ <serviceMetadata httpGetEnabled="true"/>
+ <serviceDebug includeExceptionDetailInFaults="true"/>
+ <serviceAuthorization serviceAuthorizationManagerType="OAuthAuthorizationManager, __code"/>
+ </behavior>
+ </serviceBehaviors>
+ </behaviors>
+ <services>
+ <service behaviorConfiguration="DataApiBehavior" name="DataApi">
+ <endpoint address="" binding="wsHttpBinding" contract="IDataApi">
+ <identity>
+ <dns value="localhost"/>
+ </identity>
+ </endpoint>
+ <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
+ </service>
+ </services>
+ </system.serviceModel>
+</configuration>
diff --git a/src/DotNetOAuth.sln b/src/DotNetOAuth.sln
index f3961cf..52959e8 100644
--- a/src/DotNetOAuth.sln
+++ b/src/DotNetOAuth.sln
@@ -37,11 +37,36 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Consumer", "..\samples\Cons
VWDPort = "16323"
DefaultWebSiteLanguage = "Visual C#"
EndProjectSection
+ ProjectSection(ProjectDependencies) = postProject
+ {EC910270-AAB6-4AC6-9B57-99118CFBE557} = {EC910270-AAB6-4AC6-9B57-99118CFBE557}
+ EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B4C6F647-C046-4B54-BE12-7701C4119EE7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsumerWpf", "..\samples\ConsumerWpf\ConsumerWpf.csproj", "{6EC36418-DBC5-4AD1-A402-413604AA7A08}"
EndProject
+Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "ServiceProvider", "..\samples\ServiceProvider", "{EC910270-AAB6-4AC6-9B57-99118CFBE557}"
+ ProjectSection(WebsiteProperties) = preProject
+ TargetFramework = "3.5"
+ ProjectReferences = "{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}|DotNetOAuth.dll;"
+ Debug.AspNetCompiler.VirtualPath = "/ServiceProvider"
+ Debug.AspNetCompiler.PhysicalPath = "..\samples\ServiceProvider\"
+ Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\ServiceProvider\"
+ Debug.AspNetCompiler.Updateable = "true"
+ Debug.AspNetCompiler.ForceOverwrite = "true"
+ Debug.AspNetCompiler.FixedNames = "false"
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.VirtualPath = "/ServiceProvider"
+ Release.AspNetCompiler.PhysicalPath = "..\samples\ServiceProvider\"
+ Release.AspNetCompiler.TargetPath = "PrecompiledWeb\ServiceProvider\"
+ Release.AspNetCompiler.Updateable = "true"
+ Release.AspNetCompiler.ForceOverwrite = "true"
+ Release.AspNetCompiler.FixedNames = "false"
+ Release.AspNetCompiler.Debug = "False"
+ VWDPort = "65169"
+ DefaultWebSiteLanguage = "Visual C#"
+ EndProjectSection
+EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = DotNetOAuth.vsmdi
@@ -67,6 +92,10 @@ Global
{6EC36418-DBC5-4AD1-A402-413604AA7A08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EC36418-DBC5-4AD1-A402-413604AA7A08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EC36418-DBC5-4AD1-A402-413604AA7A08}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EC910270-AAB6-4AC6-9B57-99118CFBE557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EC910270-AAB6-4AC6-9B57-99118CFBE557}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EC910270-AAB6-4AC6-9B57-99118CFBE557}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+ {EC910270-AAB6-4AC6-9B57-99118CFBE557}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -75,5 +104,6 @@ Global
{CD57219F-24F4-4136-8741-6063D0D7A031} = {20B5E173-C3C4-49F8-BD25-E69044075B4D}
{F9076F04-17AF-4205-93A2-1D3BEBFCDAEB} = {B4C6F647-C046-4B54-BE12-7701C4119EE7}
{6EC36418-DBC5-4AD1-A402-413604AA7A08} = {B4C6F647-C046-4B54-BE12-7701C4119EE7}
+ {EC910270-AAB6-4AC6-9B57-99118CFBE557} = {B4C6F647-C046-4B54-BE12-7701C4119EE7}
EndGlobalSection
EndGlobal