diff options
15 files changed, 0 insertions, 696 deletions
diff --git a/samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp b/samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp deleted file mode 100644 index 9f5917e..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp +++ /dev/null @@ -1,33 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<% -If Session("ClaimedIdentifier") = "" Then - Response.Redirect("login.asp") -End If -%> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>DotNetOpenAuth Classic ASP sample: Members Only area</title> - <link href="styles.css" rel="stylesheet" type="text/css" /> -</head> -<body> - <div> - <a href="http://dotnetopenauth.net"> - <img runat="server" src="images/DotNetOpenAuth.png" title="Jump to the project web site." - alt="DotNetOpenAuth" border='0' /></a> - </div> - <h2> - Members Only Area - </h2> - <p> - Congratulations, <b><%=Session("ClaimedIdentifier") %></b>. - You have completed the OpenID login process. - </p> - <p>Additional data we may have about you using the Simple Registration extension:</p> - <table> - <tr><td>Email </td><td><%=Session("Email") %> </td></tr> - <tr><td>Nickname </td><td><%=Session("Nickname") %> </td></tr> - <tr><td>Full name </td><td><%=Session("FullName") %> </td></tr> - </table> - <p><a href="logout.asp">Log out</a>. </p> -</body> -</html> diff --git a/samples/OpenIdRelyingPartyClassicAsp/Web.config b/samples/OpenIdRelyingPartyClassicAsp/Web.config deleted file mode 100644 index 4af6ab2..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/Web.config +++ /dev/null @@ -1,48 +0,0 @@ -<?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\vx.x\Config ---> -<configuration> - <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="false" targetFramework="4.0"/> - <!-- - 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 controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> - </system.web> - <!-- - 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> - <modules runAllManagedModulesForAllRequests="true"/> - </system.webServer> -</configuration>
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyClassicAsp/default.asp b/samples/OpenIdRelyingPartyClassicAsp/default.asp deleted file mode 100644 index 4ab2633..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/default.asp +++ /dev/null @@ -1,49 +0,0 @@ -<!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> - <title>DotNetOpenAuth Classic ASP sample</title> - <link href="styles.css" rel="stylesheet" type="text/css" /> -</head> -<body> - <div> - <a href="http://dotnetopenauth.net"> - <img runat="server" src="images/DotNetOpenAuth.png" title="Jump to the project web site." - alt="DotNetOpenAuth" border='0' /></a> - </div> - <h2>Classic ASP OpenID Relying Party</h2> - <p>Visit the <a href="MembersOnly.asp">Members Only</a> area. (This will trigger - a login demo). </p> - <h3>Required steps for this sample to work on your own machine:</h3> - <p>Although classic ASP cannot access .NET assemblies directly, it does know how to - call COM components. DotNetOpenAuth exposes a COM server to allow classic ASP - and other COM clients to utilize it for easy OpenID support. The DotNetOpenAuth.dll - assembly must be registered as a COM server on each development box and web server - in order for COM clients such as classic ASP to find it.</p> - <p>To register DotNetOpenAuth as a COM server, complete these steps.</p> - <ol> - <li>At an administrator command prompt, navigate to a directory where the DotNetOpenAuth - assembly is found.</li> - <li>Register DotNetOpenAuth as a COM server:<br /> - <span class="command">%windir%\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe - /tlb DotNetOpenAuth.dll</span><br /> - Note that you may need to copy System.Web.Mvc.dll into the same directory as dotnetopenauth.dll - if it is not already in your GAC.</li> - <li>Install DotNetOpenAuth into the GAC. The gacutil.exe tool may be in an SDK - directory, which will be in your path if you opened a Visual Studio Command Prompt.<br /> - <span class="command">gacutil.exe /i DotNetOpenAuth.dll</span><br /> - Be sure to use a gacutil.exe that comes from a .NET 2.0-3.5 directory (not .NET 1.x). - </li> - <li>If your web server is running 64-bit Windows, you'll also need ensure that the - application pool is enabled for 32bit applications. Using IIS Manager, select - the appropriate application pool (e.g. "DefaultAppPool" unless you've created - some new ones). Click "Advanced Settings", and ensure that "Enable 32bit - Applications" is set to True. This setting takes effect immediately, so there's - no need to recycle the application pool.</li> - </ol> - <p>Another thing to be aware of is that with classic ASP there is no Web.config - file in which to customize DotNetOpenAuth behavior. And the COM interfaces - that DotNetOpenAuth exposes are a very limited subset of full functionality - available to .NET clients. Please send feature requests to - <a href="mailto:DotNetOpenId@googlegroups.com">DotNetOpenId@googlegroups.com</a>.</p> -</body> -</html> diff --git a/samples/OpenIdRelyingPartyClassicAsp/favicon.ico b/samples/OpenIdRelyingPartyClassicAsp/favicon.ico Binary files differdeleted file mode 100644 index e227dbe..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/favicon.ico +++ /dev/null diff --git a/samples/OpenIdRelyingPartyClassicAsp/images/DotNetOpenAuth.png b/samples/OpenIdRelyingPartyClassicAsp/images/DotNetOpenAuth.png Binary files differdeleted file mode 100644 index 442b986..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/images/DotNetOpenAuth.png +++ /dev/null diff --git a/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.png b/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.png Binary files differdeleted file mode 100644 index caebd58..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.png +++ /dev/null diff --git a/samples/OpenIdRelyingPartyClassicAsp/login.asp b/samples/OpenIdRelyingPartyClassicAsp/login.asp deleted file mode 100644 index 90112f9..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/login.asp +++ /dev/null @@ -1,66 +0,0 @@ -<!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> - <title>DotNetOpenAuth Classic ASP sample: Login</title> - <link href="styles.css" rel="stylesheet" type="text/css" /> -</head> -<body> - <div> - <a href="http://dotnetopenauth.net"> - <img runat="server" src="images/DotNetOpenAuth.png" title="Jump to the project web site." - alt="DotNetOpenAuth" border='0' /></a> - </div> - <h2>Login Page</h2> - <% - dim realm, thisPageUrl, requestUrl, dnoi, authentication - realm = "http://" + Request.ServerVariables("HTTP_HOST") + "/classicaspdnoi/" ' change this to be the home page of your web site, without the filename. - requestUrl = "http://" + Request.ServerVariables("HTTP_HOST") + Request.ServerVariables("HTTP_URL") ' this is the full URL of the current incoming request. - Set dnoi = server.CreateObject("DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty") - On Error Resume Next - ' Since this page both starts the OpenID authentication flow and receives the response, we don't - ' yet know whether this particular request is already in the response phase. Check that now. - Set authentication = dnoi.ProcessAuthentication(requestUrl, Request.Form) - If Err.number <> 0 Then - ' Oops, report something that went wrong. - Response.Write "<p>" + Server.HTMLEncode(Err.Description) + "</p>" - End If - On Error Goto 0 - if Not authentication Is Nothing then ' if this WAS an OpenID response coming in... - If authentication.Successful Then - Session("ClaimedIdentifier") = authentication.ClaimedIdentifier - If Not authentication.ClaimsResponse Is Nothing Then - Session("Email") = authentication.ClaimsResponse.Email - Session("Nickname") = authentication.ClaimsResponse.Nickname - Session("FullName") = authentication.ClaimsResponse.FullName - End If - Response.Redirect "MembersOnly.asp" - else - Response.Write "Authentication failed: " + authentication.ExceptionMessage - end if - elseif Request.Form("openid_identifier") <> "" then ' if the user is only now starting the authentication flow... - dim redirectUrl - On Error Resume Next - thisPageUrl = "http://" + Request.ServerVariables("HTTP_HOST") + Request.ServerVariables("URL") ' this is the URL that will receive the response from the OpenID Provider. - ' redirectUrl = dnoi.CreateRequest(Request.Form("openid_identifier"), realm, thisPageUrl) - redirectUrl = dnoi.CreateRequestWithSimpleRegistration(Request.Form("openid_identifier"), realm, thisPageUrl, "nickname,email", "fullname") - If Err.number <> 0 Then - Response.Write "<p>" + Server.HTMLEncode(Err.Description) + "</p>" - Else - Response.Redirect redirectUrl - End If - On Error Goto 0 - End If - - %> - <form action="login.asp" method="post"> - OpenID Login: - <input class="openid" name="openid_identifier" value="<%=Server.HTMLEncode(Request.Form("openid_identifier"))%>" /> - <input type="submit" value="Login" /> - </form> - - <script> - document.getElementsByName('openid_identifier')[0].focus(); - </script> - -</body> -</html> diff --git a/samples/OpenIdRelyingPartyClassicAsp/logout.asp b/samples/OpenIdRelyingPartyClassicAsp/logout.asp deleted file mode 100644 index a3f0633..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/logout.asp +++ /dev/null @@ -1,12 +0,0 @@ -<!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> - <title>DotNetOpenAuth Classic ASP sample</title> -</head> -<body> - <% - Session.Abandon - Response.Redirect "default.asp" - %> -</body> -</html> diff --git a/samples/OpenIdRelyingPartyClassicAsp/styles.css b/samples/OpenIdRelyingPartyClassicAsp/styles.css deleted file mode 100644 index c9d471b..0000000 --- a/samples/OpenIdRelyingPartyClassicAsp/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -h2 -{ - font-style: italic; -} - -body -{ - font-family: Cambria, Arial, Times New Roman; - font-size: 12pt; -} - -.command -{ - font-family: "Courier New", Courier, monospace; -} - -input.openid -{ - background-image: url(images/openid_login.png); - background-repeat: no-repeat; - background-position: 0 50%; - padding-left: 15px; -} diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj index a6943b0..1fe15f1 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj @@ -21,7 +21,6 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> </PropertyGroup> <ItemGroup> - <Compile Include="OpenId\Interop\IOpenIdRelyingParty.cs" /> <Compile Include="OpenId\RelyingParty\Behaviors\AXFetchAsSregTransform.cs" /> <Compile Include="OpenId\RelyingParty\Behaviors\GsaIcamProfile.cs" /> <Compile Include="OpenId\ChannelElements\ExtensionsBindingElementRelyingParty.cs" /> @@ -32,9 +31,6 @@ <Compile Include="OpenId\ChannelElements\ReturnToNonceBindingElement.cs" /> <Compile Include="OpenId\RelyingParty\Extensions\ExtensionsInteropHelper.cs" /> <Compile Include="OpenId\HostMetaDiscoveryService.cs" /> - <Compile Include="OpenId\Interop\AuthenticationResponseShim.cs" /> - <Compile Include="OpenId\Interop\ClaimsResponseShim.cs" /> - <Compile Include="OpenId\Interop\OpenIdRelyingPartyShim.cs" /> <Compile Include="OpenId\Messages\AssociateDiffieHellmanRelyingPartyResponse.cs" /> <Compile Include="OpenId\Messages\AssociateRequestRelyingParty.cs" /> <Compile Include="OpenId\Messages\IAssociateSuccessfulResponseRelyingParty.cs" /> diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs deleted file mode 100644 index d871645..0000000 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs +++ /dev/null @@ -1,120 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="AuthenticationResponseShim.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenId.Interop { - using System; - using System.Diagnostics.CodeAnalysis; - using System.Runtime.InteropServices; - using System.Web; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; - using DotNetOpenAuth.OpenId.RelyingParty; - using Validation; - - /// <summary> - /// The COM type used to provide details of an authentication result to a relying party COM client. - /// </summary> - [SuppressMessage("Microsoft.Interoperability", "CA1409:ComVisibleTypesShouldBeCreatable", Justification = "It's only creatable on the inside. It must be ComVisible for ASP to see it.")] - [ComVisible(true), Obsolete("This class acts as a COM Server and should not be called directly from .NET code.")] - public sealed class AuthenticationResponseShim { - /// <summary> - /// The response read in by the Relying Party. - /// </summary> - private readonly IAuthenticationResponse response; - - /// <summary> - /// Initializes a new instance of the <see cref="AuthenticationResponseShim"/> class. - /// </summary> - /// <param name="response">The response.</param> - internal AuthenticationResponseShim(IAuthenticationResponse response) { - Requires.NotNull(response, "response"); - - this.response = response; - var claimsResponse = this.response.GetExtension<ClaimsResponse>(); - if (claimsResponse != null) { - this.ClaimsResponse = new ClaimsResponseShim(claimsResponse); - } - } - - /// <summary> - /// Gets an Identifier that the end user claims to own. For use with user database storage and lookup. - /// May be null for some failed authentications (i.e. failed directed identity authentications). - /// </summary> - /// <remarks> - /// <para> - /// This is the secure identifier that should be used for database storage and lookup. - /// It is not always friendly (i.e. =Arnott becomes =!9B72.7DD1.50A9.5CCD), but it protects - /// user identities against spoofing and other attacks. - /// </para> - /// <para> - /// For user-friendly identifiers to display, use the - /// <see cref="FriendlyIdentifierForDisplay"/> property. - /// </para> - /// </remarks> - public string ClaimedIdentifier { - get { return this.response.ClaimedIdentifier; } - } - - /// <summary> - /// Gets a user-friendly OpenID Identifier for display purposes ONLY. - /// </summary> - /// <remarks> - /// <para> - /// This <i>should</i> be put through <see cref="HttpUtility.HtmlEncode(string)"/> before - /// sending to a browser to secure against javascript injection attacks. - /// </para> - /// <para> - /// This property retains some aspects of the user-supplied identifier that get lost - /// in the <see cref="ClaimedIdentifier"/>. For example, XRIs used as user-supplied - /// identifiers (i.e. =Arnott) become unfriendly unique strings (i.e. =!9B72.7DD1.50A9.5CCD). - /// For display purposes, such as text on a web page that says "You're logged in as ...", - /// this property serves to provide the =Arnott string, or whatever else is the most friendly - /// string close to what the user originally typed in. - /// </para> - /// <para> - /// If the user-supplied identifier is a URI, this property will be the URI after all - /// redirects, and with the protocol and fragment trimmed off. - /// If the user-supplied identifier is an XRI, this property will be the original XRI. - /// If the user-supplied identifier is an OpenID Provider identifier (i.e. yahoo.com), - /// this property will be the Claimed Identifier, with the protocol stripped if it is a URI. - /// </para> - /// <para> - /// It is <b>very</b> important that this property <i>never</i> be used for database storage - /// or lookup to avoid identity spoofing and other security risks. For database storage - /// and lookup please use the <see cref="ClaimedIdentifier"/> property. - /// </para> - /// </remarks> - public string FriendlyIdentifierForDisplay { - get { return this.response.FriendlyIdentifierForDisplay; } - } - - /// <summary> - /// Gets the provider endpoint that sent the assertion. - /// </summary> - public string ProviderEndpoint { - get { return this.response.Provider != null ? this.response.Provider.Uri.AbsoluteUri : null; } - } - - /// <summary> - /// Gets a value indicating whether the authentication attempt succeeded. - /// </summary> - public bool Successful { - get { return this.response.Status == AuthenticationStatus.Authenticated; } - } - - /// <summary> - /// Gets the Simple Registration response. - /// </summary> - public ClaimsResponseShim ClaimsResponse { get; private set; } - - /// <summary> - /// Gets details regarding a failed authentication attempt, if available. - /// </summary> - public string ExceptionMessage { - get { return this.response.Exception != null ? this.response.Exception.Message : null; } - } - } -} diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs deleted file mode 100644 index cad4504..0000000 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs +++ /dev/null @@ -1,107 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="ClaimsResponseShim.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenId.Interop { - using System; - using System.Diagnostics.CodeAnalysis; - using System.Runtime.InteropServices; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; - using Validation; - - /// <summary> - /// A struct storing Simple Registration field values describing an - /// authenticating user. - /// </summary> - [SuppressMessage("Microsoft.Interoperability", "CA1409:ComVisibleTypesShouldBeCreatable", Justification = "It's only creatable on the inside. It must be ComVisible for ASP to see it.")] - [ComVisible(true), Obsolete("This class acts as a COM Server and should not be called directly from .NET code.")] - public sealed class ClaimsResponseShim { - /// <summary> - /// The Simple Registration claims response message that this shim wraps. - /// </summary> - private readonly ClaimsResponse response; - - /// <summary> - /// Initializes a new instance of the <see cref="ClaimsResponseShim"/> class. - /// </summary> - /// <param name="response">The Simple Registration response to wrap.</param> - internal ClaimsResponseShim(ClaimsResponse response) - { - Requires.NotNull(response, "response"); - - this.response = response; - } - - /// <summary> - /// Gets the nickname the user goes by. - /// </summary> - public string Nickname { - get { return this.response.Nickname; } - } - - /// <summary> - /// Gets the user's email address. - /// </summary> - public string Email { - get { return this.response.Email; } - } - - /// <summary> - /// Gets the full name of a user as a single string. - /// </summary> - public string FullName { - get { return this.response.FullName; } - } - - /// <summary> - /// Gets the raw birth date string given by the extension. - /// </summary> - /// <value>A string in the format yyyy-MM-dd.</value> - public string BirthDate { - get { return this.response.BirthDateRaw; } - } - - /// <summary> - /// Gets the gender of the user. - /// </summary> - public string Gender { - get { - if (this.response.Gender.HasValue) { - return this.response.Gender.Value == Extensions.SimpleRegistration.Gender.Male ? Constants.Genders.Male : Constants.Genders.Female; - } - return null; - } - } - - /// <summary> - /// Gets the zip code / postal code of the user. - /// </summary> - public string PostalCode { - get { return this.response.PostalCode; } - } - - /// <summary> - /// Gets the country of the user. - /// </summary> - public string Country { - get { return this.response.Country; } - } - - /// <summary> - /// Gets the primary/preferred language of the user. - /// </summary> - public string Language { - get { return this.response.Language; } - } - - /// <summary> - /// Gets the user's timezone. - /// </summary> - public string TimeZone { - get { return this.response.TimeZone; } - } - } -}
\ No newline at end of file diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/IOpenIdRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/IOpenIdRelyingParty.cs deleted file mode 100644 index 398c284..0000000 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/IOpenIdRelyingParty.cs +++ /dev/null @@ -1,73 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="IOpenIdRelyingParty.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenId.Interop { - using System.Diagnostics.CodeAnalysis; - using System.Runtime.InteropServices; - using DotNetOpenAuth.Messaging; - - /// <summary> - /// The COM interface describing the DotNetOpenAuth functionality available to - /// COM client OpenID relying parties. - /// </summary> - [Guid("56BD3DB0-EE0D-4191-ADFC-1F3705CD2636")] - [InterfaceType(ComInterfaceType.InterfaceIsDual)] - public interface IOpenIdRelyingParty { - /// <summary> - /// Creates an authentication request to verify that a user controls - /// some given Identifier. - /// </summary> - /// <param name="userSuppliedIdentifier"> - /// The Identifier supplied by the user. This may be a URL, an XRI or i-name. - /// </param> - /// <param name="realm"> - /// The shorest URL that describes this relying party web site's address. - /// For example, if your login page is found at https://www.example.com/login.aspx, - /// your realm would typically be https://www.example.com/. - /// </param> - /// <param name="returnToUrl"> - /// The URL of the login page, or the page prepared to receive authentication - /// responses from the OpenID Provider. - /// </param> - /// <returns> - /// An authentication request object that describes the HTTP response to - /// send to the user agent to initiate the authentication. - /// </returns> - /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> - string CreateRequest(string userSuppliedIdentifier, string realm, string returnToUrl); - - /// <summary> - /// Creates an authentication request to verify that a user controls - /// some given Identifier. - /// </summary> - /// <param name="userSuppliedIdentifier">The Identifier supplied by the user. This may be a URL, an XRI or i-name.</param> - /// <param name="realm">The shorest URL that describes this relying party web site's address. - /// For example, if your login page is found at https://www.example.com/login.aspx, - /// your realm would typically be https://www.example.com/.</param> - /// <param name="returnToUrl">The URL of the login page, or the page prepared to receive authentication - /// responses from the OpenID Provider.</param> - /// <param name="optionalSreg">A comma-delimited list of simple registration fields to request as optional.</param> - /// <param name="requiredSreg">A comma-delimited list of simple registration fields to request as required.</param> - /// <returns> - /// An authentication request object that describes the HTTP response to - /// send to the user agent to initiate the authentication. - /// </returns> - /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sreg", Justification = "Accepted acronym")] - string CreateRequestWithSimpleRegistration(string userSuppliedIdentifier, string realm, string returnToUrl, string optionalSreg, string requiredSreg); - - /// <summary> - /// Gets the result of a user agent's visit to his OpenId provider in an - /// authentication attempt. Null if no response is available. - /// </summary> - /// <param name="url">The incoming request URL .</param> - /// <param name="form">The form data that may have been included in the case of a POST request.</param> - /// <returns>The Provider's response to a previous authentication request, or null if no response is present.</returns> -#pragma warning disable 0618 // we're using the COM type properly - AuthenticationResponseShim ProcessAuthentication(string url, string form); -#pragma warning restore 0618 - } -}
\ No newline at end of file diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs deleted file mode 100644 index 9568c1d..0000000 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs +++ /dev/null @@ -1,134 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="OpenIdRelyingPartyShim.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenId.Interop { - using System; - using System.Collections.Specialized; - using System.Diagnostics.CodeAnalysis; - using System.IO; - using System.Runtime.InteropServices; - using System.Text; - using System.Threading; - using System.Web; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; - using DotNetOpenAuth.OpenId.RelyingParty; - - /// <summary> - /// Implementation of <see cref="IOpenIdRelyingParty"/>, providing a subset of the - /// functionality available to .NET clients. - /// </summary> - [Guid("8F97A798-B4C5-4da5-9727-EE7DD96A8CD9")] - [ProgId("DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty")] - [ComVisible(true), Obsolete("This class acts as a COM Server and should not be called directly from .NET code.", true)] - [ClassInterface(ClassInterfaceType.None)] - public sealed class OpenIdRelyingPartyShim : IOpenIdRelyingParty { - /// <summary> - /// The OpenIdRelyingParty instance to use for requests. - /// </summary> - private static OpenIdRelyingParty relyingParty; - - /// <summary> - /// Initializes static members of the <see cref="OpenIdRelyingPartyShim"/> class. - /// </summary> - static OpenIdRelyingPartyShim() { - relyingParty = new OpenIdRelyingParty(null); - relyingParty.Behaviors.Add(new RelyingParty.Behaviors.AXFetchAsSregTransform()); - } - - /// <summary> - /// Initializes a new instance of the <see cref="OpenIdRelyingPartyShim"/> class. - /// </summary> - public OpenIdRelyingPartyShim() { - Reporting.RecordFeatureUse(this); - } - - /// <summary> - /// Creates an authentication request to verify that a user controls - /// some given Identifier. - /// </summary> - /// <param name="userSuppliedIdentifier"> - /// The Identifier supplied by the user. This may be a URL, an XRI or i-name. - /// </param> - /// <param name="realm"> - /// The shorest URL that describes this relying party web site's address. - /// For example, if your login page is found at https://www.example.com/login.aspx, - /// your realm would typically be https://www.example.com/. - /// </param> - /// <param name="returnToUrl"> - /// The URL of the login page, or the page prepared to receive authentication - /// responses from the OpenID Provider. - /// </param> - /// <returns> - /// An authentication request object that describes the HTTP response to - /// send to the user agent to initiate the authentication. - /// </returns> - /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> - [SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "COM requires primitive types")] - public string CreateRequest(string userSuppliedIdentifier, string realm, string returnToUrl) { - var request = relyingParty.CreateRequestAsync(userSuppliedIdentifier, realm, new Uri(returnToUrl)).Result; - var response = request.GetRedirectingResponseAsync(CancellationToken.None).Result; - return response.GetDirectUriRequest().AbsoluteUri; - } - - /// <summary> - /// Creates an authentication request to verify that a user controls - /// some given Identifier. - /// </summary> - /// <param name="userSuppliedIdentifier">The Identifier supplied by the user. This may be a URL, an XRI or i-name.</param> - /// <param name="realm">The shorest URL that describes this relying party web site's address. - /// For example, if your login page is found at https://www.example.com/login.aspx, - /// your realm would typically be https://www.example.com/.</param> - /// <param name="returnToUrl">The URL of the login page, or the page prepared to receive authentication - /// responses from the OpenID Provider.</param> - /// <param name="optionalSreg">A comma-delimited list of simple registration fields to request as optional.</param> - /// <param name="requiredSreg">A comma-delimited list of simple registration fields to request as required.</param> - /// <returns> - /// An authentication request object that describes the HTTP response to - /// send to the user agent to initiate the authentication. - /// </returns> - /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> - [SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "COM requires primitive types")] - public string CreateRequestWithSimpleRegistration(string userSuppliedIdentifier, string realm, string returnToUrl, string optionalSreg, string requiredSreg) { - var request = relyingParty.CreateRequestAsync(userSuppliedIdentifier, realm, new Uri(returnToUrl)).Result; - - ClaimsRequest sreg = new ClaimsRequest(); - if (!string.IsNullOrEmpty(optionalSreg)) { - sreg.SetProfileRequestFromList(optionalSreg.Split(','), DemandLevel.Request); - } - if (!string.IsNullOrEmpty(requiredSreg)) { - sreg.SetProfileRequestFromList(requiredSreg.Split(','), DemandLevel.Require); - } - request.AddExtension(sreg); - var response = request.GetRedirectingResponseAsync(CancellationToken.None).Result; - return response.GetDirectUriRequest().AbsoluteUri; - } - - /// <summary> - /// Gets the result of a user agent's visit to his OpenId provider in an - /// authentication attempt. Null if no response is available. - /// </summary> - /// <param name="url">The incoming request URL.</param> - /// <param name="form">The form data that may have been included in the case of a POST request.</param> - /// <returns>The Provider's response to a previous authentication request, or null if no response is present.</returns> - public AuthenticationResponseShim ProcessAuthentication(string url, string form) { - string method = "GET"; - NameValueCollection formMap = null; - if (!string.IsNullOrEmpty(form)) { - method = "POST"; - formMap = HttpUtility.ParseQueryString(form); - } - - HttpRequestBase requestInfo = new HttpRequestInfo(method, new Uri(url), form: formMap); - var response = relyingParty.GetResponseAsync(requestInfo, CancellationToken.None).Result; - if (response != null) { - return new AuthenticationResponseShim(response); - } - - return null; - } - } -} diff --git a/src/DotNetOpenAuth.sln b/src/DotNetOpenAuth.sln index 3219bb9..1387e28 100644 --- a/src/DotNetOpenAuth.sln +++ b/src/DotNetOpenAuth.sln @@ -64,27 +64,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdRelyingPartyMvc", ".. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdRelyingPartyWebForms", "..\samples\OpenIdRelyingPartyWebForms\OpenIdRelyingPartyWebForms.csproj", "{1E8AEA89-BF69-47A1-B290-E8B0FE588700}" EndProject -Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OpenIdRelyingPartyClassicAsp", "..\samples\OpenIdRelyingPartyClassicAsp\", "{BBACD972-014D-478F-9B07-56B9E1D4CC73}" - ProjectSection(WebsiteProperties) = preProject - TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" - Debug.AspNetCompiler.VirtualPath = "/OpenIdRelyingPartyClassicAsp" - Debug.AspNetCompiler.PhysicalPath = "..\samples\OpenIdRelyingPartyClassicAsp\" - Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\OpenIdRelyingPartyClassicAsp\" - Debug.AspNetCompiler.Updateable = "true" - Debug.AspNetCompiler.ForceOverwrite = "true" - Debug.AspNetCompiler.FixedNames = "false" - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.VirtualPath = "/OpenIdRelyingPartyClassicAsp" - Release.AspNetCompiler.PhysicalPath = "..\samples\OpenIdRelyingPartyClassicAsp\" - Release.AspNetCompiler.TargetPath = "PrecompiledWeb\OpenIdRelyingPartyClassicAsp\" - Release.AspNetCompiler.Updateable = "true" - Release.AspNetCompiler.ForceOverwrite = "true" - Release.AspNetCompiler.FixedNames = "false" - Release.AspNetCompiler.Debug = "False" - VWDPort = "10318" - StartServerOnDebug = "false" - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OAuthConsumerWpf", "..\samples\OAuthConsumerWpf\OAuthConsumerWpf.csproj", "{6EC36418-DBC5-4AD1-A402-413604AA7A08}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdOfflineProvider", "..\samples\OpenIdOfflineProvider\OpenIdOfflineProvider.csproj", "{5C65603B-235F-47E6-B536-06385C60DE7F}" @@ -214,11 +193,6 @@ Global {1E8AEA89-BF69-47A1-B290-E8B0FE588700}.Debug|Any CPU.Build.0 = Debug|Any CPU {1E8AEA89-BF69-47A1-B290-E8B0FE588700}.Release|Any CPU.ActiveCfg = Release|Any CPU {1E8AEA89-BF69-47A1-B290-E8B0FE588700}.Release|Any CPU.Build.0 = Release|Any CPU - {BBACD972-014D-478F-9B07-56B9E1D4CC73}.CodeAnalysis|Any CPU.ActiveCfg = Debug|Any CPU - {BBACD972-014D-478F-9B07-56B9E1D4CC73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BBACD972-014D-478F-9B07-56B9E1D4CC73}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BBACD972-014D-478F-9B07-56B9E1D4CC73}.Release|Any CPU.ActiveCfg = Debug|Any CPU - {BBACD972-014D-478F-9B07-56B9E1D4CC73}.Release|Any CPU.Build.0 = Debug|Any CPU {6EC36418-DBC5-4AD1-A402-413604AA7A08}.CodeAnalysis|Any CPU.ActiveCfg = CodeAnalysis|Any CPU {6EC36418-DBC5-4AD1-A402-413604AA7A08}.CodeAnalysis|Any CPU.Build.0 = CodeAnalysis|Any CPU {6EC36418-DBC5-4AD1-A402-413604AA7A08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -467,7 +441,6 @@ Global {AEA29D4D-396F-47F6-BC81-B58D4B855245} = {034D5B5B-7D00-4A9D-8AFE-4A476E0575B1} {07B193F1-68AD-4E9C-98AF-BEFB5E9403CB} = {034D5B5B-7D00-4A9D-8AFE-4A476E0575B1} {1E8AEA89-BF69-47A1-B290-E8B0FE588700} = {034D5B5B-7D00-4A9D-8AFE-4A476E0575B1} - {BBACD972-014D-478F-9B07-56B9E1D4CC73} = {034D5B5B-7D00-4A9D-8AFE-4A476E0575B1} {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942} = {034D5B5B-7D00-4A9D-8AFE-4A476E0575B1} {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4} = {034D5B5B-7D00-4A9D-8AFE-4A476E0575B1} {F289B925-4307-4BEC-B411-885CE70E3379} = {034D5B5B-7D00-4A9D-8AFE-4A476E0575B1} |