diff options
Diffstat (limited to 'samples')
42 files changed, 1583 insertions, 3 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs index 2a98ffe..29973c2 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs @@ -8,6 +8,7 @@ namespace DotNetOpenAuth.ApplicationBlock { using System; using System.Collections.Generic; using System.IO; + using System.Net; using System.Xml; using System.Xml.Linq; using DotNetOpenAuth.Messaging; @@ -38,6 +39,18 @@ namespace DotNetOpenAuth.ApplicationBlock { /// </summary> private static readonly MessageReceivingEndpoint GetFriendTimelineStatusEndpoint = new MessageReceivingEndpoint("http://twitter.com/statuses/friends_timeline.xml", HttpDeliveryMethods.GetRequest); + private static readonly MessageReceivingEndpoint UpdateProfileBackgroundImageEndpoint = new MessageReceivingEndpoint("http://twitter.com/account/update_profile_background_image.xml", HttpDeliveryMethods.PostRequest | HttpDeliveryMethods.AuthorizationHeaderRequest); + + private static readonly MessageReceivingEndpoint UpdateProfileImageEndpoint = new MessageReceivingEndpoint("http://twitter.com/account/update_profile_image.xml", HttpDeliveryMethods.PostRequest | HttpDeliveryMethods.AuthorizationHeaderRequest); + + /// <summary> + /// Initializes static members of the <see cref="TwitterConsumer"/> class. + /// </summary> + static TwitterConsumer() { + // Twitter can't handle the Expect 100 Continue HTTP header. + ServicePointManager.FindServicePoint(GetFavoritesEndpoint.Location).Expect100Continue = false; + } + public static XDocument GetUpdates(ConsumerBase twitter, string accessToken) { IncomingWebResponse response = twitter.PrepareAuthorizedRequestAndSend(GetFriendTimelineStatusEndpoint, accessToken); return XDocument.Load(XmlReader.Create(response.GetResponseReader())); @@ -47,5 +60,32 @@ namespace DotNetOpenAuth.ApplicationBlock { IncomingWebResponse response = twitter.PrepareAuthorizedRequestAndSend(GetFavoritesEndpoint, accessToken); return XDocument.Load(XmlReader.Create(response.GetResponseReader())); } + + public static XDocument UpdateProfileBackgroundImage(ConsumerBase twitter, string accessToken, string image, bool tile) { + var parts = new[] { + MultipartPostPart.CreateFormFilePart("image", image, "image/" + Path.GetExtension(image).Substring(1).ToLowerInvariant()), + MultipartPostPart.CreateFormPart("tile", tile.ToString().ToLowerInvariant()), + }; + HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateProfileBackgroundImageEndpoint, accessToken, parts); + request.ServicePoint.Expect100Continue = false; + IncomingWebResponse response = twitter.Channel.WebRequestHandler.GetResponse(request); + string responseString = response.GetResponseReader().ReadToEnd(); + return XDocument.Parse(responseString); + } + + public static XDocument UpdateProfileImage(ConsumerBase twitter, string accessToken, string pathToImage) { + string contentType = "image/" + Path.GetExtension(pathToImage).Substring(1).ToLowerInvariant(); + return UpdateProfileImage(twitter, accessToken, File.OpenRead(pathToImage), contentType); + } + + public static XDocument UpdateProfileImage(ConsumerBase twitter, string accessToken, Stream image, string contentType) { + var parts = new[] { + MultipartPostPart.CreateFormFilePart("image", "twitterPhoto", contentType, image), + }; + HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateProfileImageEndpoint, accessToken, parts); + IncomingWebResponse response = twitter.Channel.WebRequestHandler.GetResponse(request); + string responseString = response.GetResponseReader().ReadToEnd(); + return XDocument.Parse(responseString); + } } } diff --git a/samples/OAuthConsumer/Twitter.aspx b/samples/OAuthConsumer/Twitter.aspx index a659533..30ce2a0 100644 --- a/samples/OAuthConsumer/Twitter.aspx +++ b/samples/OAuthConsumer/Twitter.aspx @@ -16,9 +16,19 @@ </asp:View> <asp:View runat="server"> <h2>Updates</h2> - <p>Ok, Twitter has authorized us to download your feeds. Click 'Get updates' to download - updates to this sample. Notice how we never asked you for your Twitter username - or password. </p> + <p>Ok, Twitter has authorized us to download your feeds. Notice how we never asked + you for your Twitter username or password. </p> + <p> + Upload a new profile photo: + <asp:FileUpload ID="profilePhoto" runat="server" /> + <asp:Button ID="uploadProfilePhotoButton" runat="server" + onclick="uploadProfilePhotoButton_Click" Text="Upload photo" /> + <asp:Label ID="photoUploadedLabel" runat="server" EnableViewState="False" + Text="Done!" Visible="False"></asp:Label> + </p> + <p> + Click 'Get updates' to download updates to this sample. + </p> <asp:Button ID="downloadUpdates" runat="server" Text="Get updates" OnClick="downloadUpdates_Click" /> <asp:PlaceHolder runat="server" ID="resultsPlaceholder" /> </asp:View> diff --git a/samples/OAuthConsumer/Twitter.aspx.cs b/samples/OAuthConsumer/Twitter.aspx.cs index 9b9eced..f309396 100644 --- a/samples/OAuthConsumer/Twitter.aspx.cs +++ b/samples/OAuthConsumer/Twitter.aspx.cs @@ -75,4 +75,20 @@ public partial class Twitter : System.Web.UI.Page { tableBuilder.Append("</table>"); resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() }); } + + protected void uploadProfilePhotoButton_Click(object sender, EventArgs e) { + if (profilePhoto.PostedFile.ContentType == null) { + photoUploadedLabel.Visible = true; + photoUploadedLabel.Text = "Select a file first."; + return; + } + + var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager); + XDocument imageResult = TwitterConsumer.UpdateProfileImage( + twitter, + this.AccessToken, + profilePhoto.PostedFile.InputStream, + profilePhoto.PostedFile.ContentType); + photoUploadedLabel.Visible = true; + } } diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Code/State.vb b/samples/OpenIdRelyingPartyWebFormsVB/Code/State.vb new file mode 100644 index 0000000..e00cb4f --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Code/State.vb @@ -0,0 +1,46 @@ +Imports DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy +Imports DotNetOpenAuth.OpenId.Extensions.SimpleRegistration +Imports DotNetOpenAuth.OpenId.Extensions.AttributeExchange + +Public Class State + Public Shared Property ProfileFields() As ClaimsResponse + Get + Return HttpContext.Current.Session("ProfileFields") + End Get + Set(ByVal value As ClaimsResponse) + HttpContext.Current.Session("ProfileFields") = value + End Set + End Property + + Public Shared Property FetchResponse() As FetchResponse + Get + Return HttpContext.Current.Session("FetchResponse") + End Get + Set(ByVal value As FetchResponse) + HttpContext.Current.Session("FetchResponse") = value + End Set + End Property + + Public Shared Property FriendlyLoginName() As String + Get + Return HttpContext.Current.Session("FriendlyLoginName") + End Get + Set(ByVal value As String) + HttpContext.Current.Session("FriendlyLoginName") = value + End Set + End Property + + Public Shared Property PapePolicies() As PolicyResponse + Get + Return HttpContext.Current.Session("PapePolicies") + End Get + Set(ByVal value As PolicyResponse) + HttpContext.Current.Session("PapePolicies") = value + End Set + End Property + + Public Shared Sub Clear() + FriendlyLoginName = Nothing + End Sub + +End Class diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Code/TracePageAppender.vb b/samples/OpenIdRelyingPartyWebFormsVB/Code/TracePageAppender.vb new file mode 100644 index 0000000..dfc2db5 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Code/TracePageAppender.vb @@ -0,0 +1,10 @@ +Imports System.IO + +Public Class TracePageAppender + Inherits log4net.Appender.AppenderSkeleton + + Protected Overrides Sub Append(ByVal loggingEvent As log4net.Core.LoggingEvent) + Dim sw As StringWriter = New StringWriter(Global_asax.LogMessages) + Layout.Format(sw, loggingEvent) + End Sub +End Class
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx new file mode 100644 index 0000000..53f6dfc --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx @@ -0,0 +1,18 @@ +<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="OpenIdRelyingPartyWebFormsVB._Default" + MasterPageFile="~/Site.Master" %> + +<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth" TagPrefix="openid" %> +<asp:Content runat="server" ContentPlaceHolderID="head"> + <openid:XrdsPublisher ID="XrdsPublisher1" runat="server" XrdsUrl="~/xrds.aspx" /> +</asp:Content> +<asp:Content runat="server" ContentPlaceHolderID="main"> + <h2> + Relying Party + </h2> + <p> + Visit the + <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/MembersOnly/Default.aspx" + Text="Members Only" /> + area. (This will trigger a login demo). + </p> +</asp:Content> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.designer.vb new file mode 100644 index 0000000..ce59c43 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.designer.vb @@ -0,0 +1,26 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:2.0.50727.4927 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + + +Partial Public Class _Default + + '''<summary> + '''form1 control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm +End Class diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.vb new file mode 100644 index 0000000..3e023c0 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.vb @@ -0,0 +1,8 @@ +Partial Public Class _Default + Inherits System.Web.UI.Page + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + End Sub + +End Class
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Global.asax b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax new file mode 100644 index 0000000..92716f1 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.vb" Inherits="OpenIdRelyingPartyWebFormsVB.Global_asax" Language="vb" %> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Global.asax.vb b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax.vb new file mode 100644 index 0000000..60ab0cc --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax.vb @@ -0,0 +1,66 @@ +Imports System +Imports System.Collections.Specialized +Imports System.Configuration +Imports System.IO +Imports System.Text +Imports System.Web +Imports DotNetOpenAuth.ApplicationBlock +Imports DotNetOpenAuth.OAuth +Imports OpenIdRelyingPartyWebFormsVB + +Public Class Global_asax + Inherits HttpApplication + + Public Shared Logger As log4net.ILog = log4net.LogManager.GetLogger(GetType(Global_asax)) + + Friend Shared LogMessages As StringBuilder = New StringBuilder + + Public Shared Function CollectionToString(ByVal collection As NameValueCollection) As String + Dim sw As StringWriter = New StringWriter + For Each key As String In collection.Keys + sw.WriteLine("{0} = '{1}'", key, collection(key)) + Next + Return sw.ToString + End Function + + Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) + log4net.Config.XmlConfigurator.Configure() + Logger.Info("Sample starting...") + End Sub + + Protected Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) + Logger.Info("Sample shutting down...") + ' this would be automatic, but in partial trust scenarios it is not. + log4net.LogManager.Shutdown() + End Sub + + Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) + ' System.Diagnostics.Debugger.Launch(); + Logger.DebugFormat("Processing {0} on {1} ", Request.HttpMethod, stripQueryString(Request.Url)) + If (Request.QueryString.Count > 0) Then + Logger.DebugFormat("Querystring follows: " & vbLf & "{0}", CollectionToString(Request.QueryString)) + End If + If (Request.Form.Count > 0) Then + Logger.DebugFormat("Posted form follows: " & vbLf & "{0}", CollectionToString(Request.Form)) + End If + End Sub + + Protected Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) + Logger.DebugFormat("User {0} authenticated.", (Not (HttpContext.Current.User) Is Nothing)) + 'TODO: Warning!!!, inline IF is not supported ? + End Sub + + Protected Sub Application_EndRequest(ByVal sender As Object, ByVal e As EventArgs) + + End Sub + + Protected Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) + Logger.ErrorFormat("An unhandled exception was raised. Details follow: {0}", HttpContext.Current.Server.GetLastError) + End Sub + + Private Shared Function stripQueryString(ByVal uri As Uri) As String + Dim builder As UriBuilder = New UriBuilder(uri) + builder.Query = Nothing + Return builder.ToString + End Function +End Class
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx new file mode 100644 index 0000000..d0e978b --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx @@ -0,0 +1,28 @@ +<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Login.aspx.vb" Inherits="OpenIdRelyingPartyWebFormsVB.Login" + ValidateRequest="false" MasterPageFile="~/Site.Master" %> + +<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty" TagPrefix="rp" %> +<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main"> + <h2>Login Page </h2> + <rp:OpenIdLogin ID="OpenIdLogin1" runat="server" CssClass="openid_login" RequestCountry="Request" + RequestEmail="Require" RequestGender="Require" RequestPostalCode="Require" RequestTimeZone="Require" + RememberMeVisible="True" PolicyUrl="~/PrivacyPolicy.aspx" TabIndex="1" /> + <fieldset title="Knobs"> + <asp:CheckBox ID="requireSslCheckBox" runat="server" + Text="RequireSsl (high security) mode" + oncheckedchanged="requireSslCheckBox_CheckedChanged" /><br /> + <h4 style="margin-top: 0; margin-bottom: 0">PAPE policies</h4> + <asp:CheckBoxList runat="server" ID="papePolicies"> + <asp:ListItem Text="Request phishing resistant authentication" Value="http://schemas.openid.net/pape/policies/2007/06/phishing-resistant" /> + <asp:ListItem Text="Request multi-factor authentication" Value="http://schemas.openid.net/pape/policies/2007/06/multi-factor" /> + <asp:ListItem Text="Request physical multi-factor authentication" Value="http://schemas.openid.net/pape/policies/2007/06/multi-factor-physical" /> + <asp:ListItem Text="Request PPID identifier" Value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" /> + </asp:CheckBoxList> + <p>Try the PPID identifier functionality against the OpenIDProviderMvc sample.</p> + </fieldset> + <p><a href="loginGoogleApps.aspx">Log in using Google Apps for Domains</a>. </p> + <p> + <rp:OpenIdButton runat="server" ImageUrl="~/images/yahoo.png" Text="Login with Yahoo!" ID="yahooLoginButton" + Identifier="https://me.yahoo.com/" OnLoggingIn="OpenIdLogin1_LoggingIn" OnLoggedIn="OpenIdLogin1_LoggedIn" /> + </p> +</asp:Content> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.designer.vb new file mode 100644 index 0000000..4cf1a96 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:2.0.50727.4927 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + + +Partial Public Class Login + + '''<summary> + '''OpenIdLogin1 control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents OpenIdLogin1 As Global.DotNetOpenAuth.OpenId.RelyingParty.OpenIdLogin + + '''<summary> + '''requireSslCheckBox control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents requireSslCheckBox As Global.System.Web.UI.WebControls.CheckBox + + '''<summary> + '''papePolicies control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents papePolicies As Global.System.Web.UI.WebControls.CheckBoxList + + '''<summary> + '''yahooLoginButton control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents yahooLoginButton As Global.DotNetOpenAuth.OpenId.RelyingParty.OpenIdButton +End Class diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.vb new file mode 100644 index 0000000..339f62c --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.vb @@ -0,0 +1,52 @@ +Imports DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy +Imports DotNetOpenAuth.OpenId.RelyingParty +Imports DotNetOpenAuth.OpenId.Extensions.SimpleRegistration + +Partial Public Class Login + Inherits System.Web.UI.Page + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + OpenIdLogin1.Focus() + End Sub + + Protected Sub requireSslCheckBox_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) + OpenIdLogin1.RequireSsl = requireSslCheckBox.Checked + End Sub + + Protected Sub OpenIdLogin1_LoggingIn(ByVal sender As Object, ByVal e As DotNetOpenAuth.OpenId.RelyingParty.OpenIdEventArgs) Handles OpenIdLogin1.LoggingIn + prepareRequest(e.Request) + End Sub + + ''' <summary> + ''' Fired upon login. + ''' </summary> + ''' <param name="sender">The source of the event.</param> + ''' <param name="e">The <see cref="DotNetOpenAuth.OpenId.RelyingParty.OpenIdEventArgs"/> instance containing the event data.</param> + ''' <remarks> + ''' Note, that straight after login, forms auth will redirect the user + ''' to their original page. So this page may never be rendererd. + ''' </remarks> + Protected Sub OpenIdLogin1_LoggedIn(ByVal sender As Object, ByVal e As DotNetOpenAuth.OpenId.RelyingParty.OpenIdEventArgs) Handles OpenIdLogin1.LoggedIn + State.FriendlyLoginName = e.Response.FriendlyIdentifierForDisplay + State.ProfileFields = e.Response.GetExtension(Of ClaimsResponse)() + State.PapePolicies = e.Response.GetExtension(Of PolicyResponse)() + End Sub + + Private Sub prepareRequest(ByVal request As IAuthenticationRequest) + ' Collect the PAPE policies requested by the user. + Dim policies As New List(Of String) + For Each item As ListItem In Me.papePolicies.Items + If item.Selected Then + policies.Add(item.Value) + End If + Next + ' Add the PAPE extension if any policy was requested. + If (policies.Count > 0) Then + Dim pape As New PolicyRequest + For Each policy As String In policies + pape.PreferredPolicies.Add(policy) + Next + request.AddExtension(pape) + End If + End Sub +End Class
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx new file mode 100644 index 0000000..7f1fa0e --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx @@ -0,0 +1,15 @@ +<%@ Page Language="vb" AutoEventWireup="true" CodeBehind="loginProgrammatic.aspx.vb" + Inherits="OpenIdRelyingPartyWebFormsVB.LoginProgrammatic" MasterPageFile="~/Site.Master" %> +<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main"> + <h2>Login Page </h2> + <asp:Label ID="Label1" runat="server" Text="OpenID Login" /> + <asp:TextBox ID="openIdBox" runat="server" /> + <asp:Button ID="loginButton" runat="server" Text="Login" OnClick="loginButton_Click" /> + <asp:CustomValidator runat="server" ID="openidValidator" ErrorMessage="Invalid OpenID Identifier" + ControlToValidate="openIdBox" EnableViewState="false" OnServerValidate="openidValidator_ServerValidate" /> + <br /> + <asp:Label ID="loginFailedLabel" runat="server" EnableViewState="False" Text="Login failed" + Visible="False" /> + <asp:Label ID="loginCanceledLabel" runat="server" EnableViewState="False" Text="Login canceled" + Visible="False" /> +</asp:Content>
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.designer.vb new file mode 100644 index 0000000..907fcda --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.designer.vb @@ -0,0 +1,71 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:2.0.50727.4927 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + + +Partial Public Class LoginProgrammatic + + '''<summary> + '''Label1 control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label + + '''<summary> + '''openIdBox control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents openIdBox As Global.System.Web.UI.WebControls.TextBox + + '''<summary> + '''loginButton control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents loginButton As Global.System.Web.UI.WebControls.Button + + '''<summary> + '''openidValidator control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents openidValidator As Global.System.Web.UI.WebControls.CustomValidator + + '''<summary> + '''loginFailedLabel control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents loginFailedLabel As Global.System.Web.UI.WebControls.Label + + '''<summary> + '''loginCanceledLabel control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents loginCanceledLabel As Global.System.Web.UI.WebControls.Label +End Class diff --git a/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.vb new file mode 100644 index 0000000..6cac182 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.vb @@ -0,0 +1,76 @@ +Imports System.Net +Imports System.Web.Security +Imports DotNetOpenAuth.Messaging +Imports DotNetOpenAuth.OpenId +Imports DotNetOpenAuth.OpenId.Extensions.SimpleRegistration +Imports DotNetOpenAuth.OpenId.RelyingParty + +Public Class LoginProgrammatic + Inherits System.Web.UI.Page + + Private Shared relyingParty As New OpenIdRelyingParty + + Protected Sub openidValidator_ServerValidate(ByVal source As Object, ByVal args As ServerValidateEventArgs) + ' This catches common typos that result in an invalid OpenID Identifier. + args.IsValid = Identifier.IsValid(args.Value) + End Sub + + Protected Sub loginButton_Click(ByVal sender As Object, ByVal e As EventArgs) + If Not Me.Page.IsValid Then + Return + ' don't login if custom validation failed. + End If + Try + Dim request As IAuthenticationRequest = relyingParty.CreateRequest(Me.openIdBox.Text) + ' This is where you would add any OpenID extensions you wanted + ' to include in the authentication request. + request.AddExtension(New ClaimsRequest() With { _ + .Country = DemandLevel.Request, _ + .Email = DemandLevel.Request, _ + .Gender = DemandLevel.Require, _ + .PostalCode = DemandLevel.Require, _ + .TimeZone = DemandLevel.Require _ + }) + ' Send your visitor to their Provider for authentication. + request.RedirectToProvider() + Catch ex As ProtocolException + ' The user probably entered an Identifier that + ' was not a valid OpenID endpoint. + Me.openidValidator.Text = ex.Message + Me.openidValidator.IsValid = False + End Try + End Sub + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load + Me.openIdBox.Focus() + ' For debugging/testing, we allow remote clearing of all associations... + ' NOT a good idea on a production site. + If (Request.QueryString("clearAssociations") = "1") Then + Application.Remove("DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.ApplicationStore") + ' Force a redirect now to prevent the user from logging in while associations + ' are constantly being cleared. + Dim builder As UriBuilder = New UriBuilder(Request.Url) + builder.Query = Nothing + Me.Response.Redirect(builder.Uri.AbsoluteUri) + End If + Dim response As IAuthenticationResponse = relyingParty.GetResponse + If response IsNot Nothing Then + Select Case response.Status + Case AuthenticationStatus.Authenticated + ' This is where you would look for any OpenID extension responses included + ' in the authentication assertion. + Dim claimsResponse As ClaimsResponse = response.GetExtension(Of ClaimsResponse)() + State.ProfileFields = claimsResponse + ' Store off the "friendly" username to display -- NOT for username lookup + State.FriendlyLoginName = response.FriendlyIdentifierForDisplay + ' Use FormsAuthentication to tell ASP.NET that the user is now logged in, + ' with the OpenID Claimed Identifier as their username. + FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, False) + Case AuthenticationStatus.Canceled + Me.loginCanceledLabel.Visible = True + Case AuthenticationStatus.Failed + Me.loginFailedLabel.Visible = True + End Select + End If + End Sub +End Class
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Default.aspx b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Default.aspx new file mode 100644 index 0000000..441ef84 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Default.aspx @@ -0,0 +1,34 @@ +<%@ Page Language="VB" AutoEventWireup="true" MasterPageFile="~/Site.Master" %> +<%@ Import Namespace="OpenIdRelyingPartyWebFormsVB" %> +<%@ Register Src="~/MembersOnly/ProfileFieldsDisplay.ascx" TagPrefix="cc1" TagName="ProfileFieldsDisplay" %> +<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main"> + <h2> + Members Only Area + </h2> + <p> + Congratulations, <b><asp:LoginName ID="LoginName1" runat="server" /></b>. + You have completed the OpenID login process. + </p> + +<% If (State.PapePolicies IsNot Nothing) Then%> + <p>A PAPE extension was included in the authentication with this content: </p> + <ul> + <% If (State.PapePolicies.NistAssuranceLevel.HasValue) Then%> + <li>Nist: <%=HttpUtility.HtmlEncode(State.PapePolicies.NistAssuranceLevel.Value.ToString())%></li> + <% End If + For Each policy As String In State.PapePolicies.ActualPolicies%> + <li><%=HttpUtility.HtmlEncode(policy)%></li> + <% Next%> + </ul> +<% End If %> + +<% If State.ProfileFields IsNot Nothing Then + profileFieldsDisplay.ProfileValues = State.ProfileFields%> + <p> + In addition to authenticating you, your OpenID Provider may + have told us something about you using the + Simple Registration extension: + </p> + <cc1:ProfileFieldsDisplay runat="server" ID="profileFieldsDisplay" /> +<% End If%> +</asp:Content> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/ProfileFieldsDisplay.ascx b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/ProfileFieldsDisplay.ascx new file mode 100644 index 0000000..f6864e9 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/ProfileFieldsDisplay.ascx @@ -0,0 +1,91 @@ +<%@ Control Language="VB" AutoEventWireup="true" %> +<%@ Import Namespace="DotNetOpenAuth.OpenId.Extensions.SimpleRegistration" %> + +<script runat="server"> + + Private _profileValues As ClaimsResponse + Public Property ProfileValues() As ClaimsResponse + Get + Return _profileValues + End Get + Set(ByVal value As ClaimsResponse) + _profileValues = value + End Set + End Property + +</script> + +<table id="profileFieldsTable" runat="server"> + <tr> + <td> + Nickname + </td> + <td> + <%=ProfileValues.Nickname %> + </td> + </tr> + <tr> + <td> + Email + </td> + <td> + <%=ProfileValues.Email%> + </td> + </tr> + <tr> + <td> + FullName + </td> + <td> + <%=ProfileValues.FullName%> + </td> + </tr> + <tr> + <td> + Date of Birth + </td> + <td> + <%=ProfileValues.BirthDate.ToString()%> + </td> + </tr> + <tr> + <td> + Gender + </td> + <td> + <%=ProfileValues.Gender.ToString()%> + </td> + </tr> + <tr> + <td> + Post Code + </td> + <td> + <%=ProfileValues.PostalCode%> + </td> + </tr> + <tr> + <td> + Country + </td> + <td> + <%=ProfileValues.Country%> + </td> + </tr> + <tr> + <td> + Language + </td> + <td> + <%=ProfileValues.Language%> + </td> + </tr> + <tr> + <td> + Timezone + </td> + <td> + <%=ProfileValues.TimeZone%> + </td> + </tr> +</table> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Web.config b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Web.config new file mode 100644 index 0000000..3cfad05 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Web.config @@ -0,0 +1,18 @@ +<?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> + <appSettings/> + <connectionStrings/> + <system.web> + <authorization> + <deny users="?"/> + </authorization> + </system.web> +</configuration> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.Designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.Designer.vb new file mode 100644 index 0000000..8a621ae --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:2.0.50727.42 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.myapp b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.myapp new file mode 100644 index 0000000..758895d --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.myapp @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <MySubMain>false</MySubMain> + <SingleInstance>false</SingleInstance> + <ShutdownMode>0</ShutdownMode> + <EnableVisualStyles>true</EnableVisualStyles> + <AuthenticationMode>0</AuthenticationMode> + <ApplicationType>1</ApplicationType> + <SaveMySettingsOnExit>true</SaveMySettingsOnExit> +</MyApplicationData> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/AssemblyInfo.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..813551f --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/AssemblyInfo.vb @@ -0,0 +1,34 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes +<Assembly: AssemblyTitle("OpenIdRelyingPartyWebFormsVB")> +<Assembly: AssemblyDescription("")> +<Assembly: AssemblyCompany("")> +<Assembly: AssemblyProduct("OpenIdRelyingPartyWebFormsVB")> +<Assembly: AssemblyCopyright("Copyright © 2010")> +<Assembly: AssemblyTrademark("")> + +<Assembly: ComVisible(False)> + +'The following GUID is for the ID of the typelib if this project is exposed to COM +<Assembly: Guid("334e9cee-0d47-4d70-924b-b5098a3432cb")> + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' <Assembly: AssemblyVersion("1.0.*")> + +<Assembly: AssemblyVersion("1.0.0.0")> +<Assembly: AssemblyFileVersion("1.0.0.0")> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/MyExtensions/MyWebExtension.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/MyExtensions/MyWebExtension.vb new file mode 100644 index 0000000..78c7c19 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/MyExtensions/MyWebExtension.vb @@ -0,0 +1,73 @@ +#If _MyType <> "Empty" Then + +Namespace My + ''' <summary> + ''' Module used to define the properties that are available in the My Namespace for Web projects. + ''' </summary> + ''' <remarks></remarks> + <Global.Microsoft.VisualBasic.HideModuleName()> _ + Module MyWebExtension + Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.ServerComputer) + Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.WebUser) + Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.AspLog) + ''' <summary> + ''' Returns information about the host computer. + ''' </summary> + <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _ + Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.ServerComputer + Get + Return s_Computer.GetInstance() + End Get + End Property + ''' <summary> + ''' Returns information for the current Web user. + ''' </summary> + <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _ + Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.WebUser + Get + Return s_User.GetInstance() + End Get + End Property + ''' <summary> + ''' Returns Request object. + ''' </summary> + <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _ + <Global.System.ComponentModel.Design.HelpKeyword("My.Request")> _ + Friend ReadOnly Property Request() As Global.System.Web.HttpRequest + <Global.System.Diagnostics.DebuggerHidden()> _ + Get + Dim CurrentContext As Global.System.Web.HttpContext = Global.System.Web.HttpContext.Current + If CurrentContext IsNot Nothing Then + Return CurrentContext.Request + End If + Return Nothing + End Get + End Property + ''' <summary> + ''' Returns Response object. + ''' </summary> + <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _ + <Global.System.ComponentModel.Design.HelpKeyword("My.Response")> _ + Friend ReadOnly Property Response() As Global.System.Web.HttpResponse + <Global.System.Diagnostics.DebuggerHidden()> _ + Get + Dim CurrentContext As Global.System.Web.HttpContext = Global.System.Web.HttpContext.Current + If CurrentContext IsNot Nothing Then + Return CurrentContext.Response + End If + Return Nothing + End Get + End Property + ''' <summary> + ''' Returns the Asp log object. + ''' </summary> + <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _ + Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.AspLog + Get + Return s_Log.GetInstance() + End Get + End Property + End Module +End Namespace + +#End If
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.Designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.Designer.vb new file mode 100644 index 0000000..b38f687 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:2.0.50727.42 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + '<summary> + ' A strongly-typed resource class, for looking up localized strings, etc. + '</summary> + <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _ + Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ + Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ + Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + '<summary> + ' Returns the cached ResourceManager instance used by this class. + '</summary> + <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("OpenIdRelyingPartyWebFormsVB.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + '<summary> + ' Overrides the current thread's CurrentUICulture property for all + ' resource lookups using this strongly typed resource class. + '</summary> + <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.resx b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.Designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.Designer.vb new file mode 100644 index 0000000..82c5982 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:2.0.50727.42 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ + Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0"), _ + Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _ + Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ + Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _ + Friend Module MySettingsProperty + + <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ + Friend ReadOnly Property Settings() As Global.OpenIdRelyingPartyWebFormsVB.My.MySettings + Get + Return Global.OpenIdRelyingPartyWebFormsVB.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.settings b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/OpenIdRelyingPartyWebFormsVB.vbproj b/samples/OpenIdRelyingPartyWebFormsVB/OpenIdRelyingPartyWebFormsVB.vbproj new file mode 100644 index 0000000..a43008c --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/OpenIdRelyingPartyWebFormsVB.vbproj @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{F289B925-4307-4BEC-B411-885CE70E3379}</ProjectGuid> + <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <RootNamespace>OpenIdRelyingPartyWebFormsVB</RootNamespace> + <AssemblyName>OpenIdRelyingPartyWebFormsVB</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <MyType>Custom</MyType> + <OptionExplicit>On</OptionExplicit> + <OptionCompare>Binary</OptionCompare> + <OptionStrict>Off</OptionStrict> + <OptionInfer>On</OptionInfer> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <DefineDebug>true</DefineDebug> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\</OutputPath> + <DocumentationFile>OpenIdRelyingPartyWebFormsVB.xml</DocumentationFile> + <NoWarn>41999,42016,42020,42021,42022</NoWarn> + <WarningsAsErrors>42017,42018,42019,42032,42036</WarningsAsErrors> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <DefineDebug>false</DefineDebug> + <DefineTrace>true</DefineTrace> + <Optimize>true</Optimize> + <OutputPath>bin\</OutputPath> + <DocumentationFile>OpenIdRelyingPartyWebFormsVB.xml</DocumentationFile> + <NoWarn>41999,42016,42020,42021,42022</NoWarn> + <WarningsAsErrors>42017,42018,42019,42032,42036</WarningsAsErrors> + </PropertyGroup> + <ItemGroup> + <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\lib\log4net.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Web.Extensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Web" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Web.Services" /> + <Reference Include="System.EnterpriseServices" /> + <Reference Include="System.Web.Mobile" /> + </ItemGroup> + <ItemGroup> + <Import Include="Microsoft.VisualBasic" /> + <Import Include="System" /> + <Import Include="System.Collections" /> + <Import Include="System.Collections.Generic" /> + <Import Include="System.Data" /> + <Import Include="System.Linq" /> + <Import Include="System.Xml.Linq" /> + <Import Include="System.Diagnostics" /> + <Import Include="System.Collections.Specialized" /> + <Import Include="System.Configuration" /> + <Import Include="System.Text" /> + <Import Include="System.Text.RegularExpressions" /> + <Import Include="System.Web" /> + <Import Include="System.Web.Caching" /> + <Import Include="System.Web.SessionState" /> + <Import Include="System.Web.Security" /> + <Import Include="System.Web.Profile" /> + <Import Include="System.Web.UI" /> + <Import Include="System.Web.UI.WebControls" /> + <Import Include="System.Web.UI.WebControls.WebParts" /> + <Import Include="System.Web.UI.HtmlControls" /> + </ItemGroup> + <ItemGroup> + <Content Include="Default.aspx" /> + <Content Include="Login.aspx" /> + <Content Include="Web.config" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Code\State.vb" /> + <Compile Include="Code\TracePageAppender.vb" /> + <Compile Include="Default.aspx.vb"> + <SubType>ASPXCodeBehind</SubType> + <DependentUpon>Default.aspx</DependentUpon> + </Compile> + <Compile Include="Default.aspx.designer.vb"> + <DependentUpon>Default.aspx</DependentUpon> + </Compile> + <Compile Include="Global.asax.vb"> + <DependentUpon>Global.asax</DependentUpon> + </Compile> + <Compile Include="Login.aspx.designer.vb"> + <DependentUpon>Login.aspx</DependentUpon> + </Compile> + <Compile Include="Login.aspx.vb"> + <DependentUpon>Login.aspx</DependentUpon> + <SubType>ASPXCodebehind</SubType> + </Compile> + <Compile Include="LoginProgrammatic.aspx.designer.vb"> + <DependentUpon>LoginProgrammatic.aspx</DependentUpon> + </Compile> + <Compile Include="LoginProgrammatic.aspx.vb"> + <DependentUpon>LoginProgrammatic.aspx</DependentUpon> + <SubType>ASPXCodebehind</SubType> + </Compile> + <Compile Include="My Project\AssemblyInfo.vb" /> + <Compile Include="My Project\Application.Designer.vb"> + <AutoGen>True</AutoGen> + <DependentUpon>Application.myapp</DependentUpon> + </Compile> + <Compile Include="My Project\MyExtensions\MyWebExtension.vb"> + <VBMyExtensionTemplateID>Microsoft.VisualBasic.Web.MyExtension</VBMyExtensionTemplateID> + <VBMyExtensionTemplateVersion>1.0.0.0</VBMyExtensionTemplateVersion> + </Compile> + <Compile Include="My Project\Resources.Designer.vb"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="My Project\Settings.Designer.vb"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="TracePage.aspx.designer.vb"> + <DependentUpon>TracePage.aspx</DependentUpon> + </Compile> + <Compile Include="TracePage.aspx.vb"> + <DependentUpon>TracePage.aspx</DependentUpon> + <SubType>ASPXCodebehind</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="My Project\Resources.resx"> + <Generator>VbMyResourcesResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.vb</LastGenOutput> + <CustomToolNamespace>My.Resources</CustomToolNamespace> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Content Include="Global.asax" /> + <Content Include="LoginProgrammatic.aspx" /> + <Content Include="MembersOnly\ProfileFieldsDisplay.ascx" /> + <Content Include="MembersOnly\Web.config" /> + <None Include="My Project\Application.myapp"> + <Generator>MyApplicationCodeGenerator</Generator> + <LastGenOutput>Application.Designer.vb</LastGenOutput> + </None> + <None Include="My Project\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <CustomToolNamespace>My</CustomToolNamespace> + <LastGenOutput>Settings.Designer.vb</LastGenOutput> + </None> + <Content Include="favicon.ico" /> + <Content Include="images\attention.png" /> + <Content Include="images\DotNetOpenAuth.png" /> + <Content Include="images\openid_login.gif" /> + <Content Include="images\yahoo.png" /> + <Content Include="MembersOnly\Default.aspx" /> + <Content Include="PrivacyPolicy.aspx" /> + <Content Include="Site.Master" /> + <Content Include="styles.css" /> + <Content Include="TracePage.aspx" /> + <Content Include="xrds.aspx" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj"> + <Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project> + <Name>DotNetOpenAuth</Name> + </ProjectReference> + <ProjectReference Include="..\DotNetOpenAuth.ApplicationBlock\DotNetOpenAuth.ApplicationBlock.csproj"> + <Project>{AA78D112-D889-414B-A7D4-467B34C7B663}</Project> + <Name>DotNetOpenAuth.ApplicationBlock</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Folder Include="App_Data\" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" /> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <ProjectExtensions> + <VisualStudio> + <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> + <WebProjectProperties> + <UseIIS>False</UseIIS> + <AutoAssignPort>True</AutoAssignPort> + <DevelopmentServerPort>27433</DevelopmentServerPort> + <DevelopmentServerVPath>/</DevelopmentServerVPath> + <IISUrl> + </IISUrl> + <NTLMAuthentication>False</NTLMAuthentication> + <UseCustomServer>False</UseCustomServer> + <CustomServerUrl> + </CustomServerUrl> + <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> + </WebProjectProperties> + </FlavorProperties> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/PrivacyPolicy.aspx b/samples/OpenIdRelyingPartyWebFormsVB/PrivacyPolicy.aspx new file mode 100644 index 0000000..7b72cd4 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/PrivacyPolicy.aspx @@ -0,0 +1,7 @@ +<%@ Page Language="VB" AutoEventWireup="true" MasterPageFile="~/Site.Master" %> +<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main"> + <h2>Privacy Policy</h2> + <p> + Some privacy policy would go here. + </p> +</asp:Content>
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Site.Master b/samples/OpenIdRelyingPartyWebFormsVB/Site.Master new file mode 100644 index 0000000..48a8e50 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Site.Master @@ -0,0 +1,39 @@ +<%@ Master Language="VB" AutoEventWireup="true" %> +<%@ Import Namespace="OpenIdRelyingPartyWebFormsVB" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<script runat="server"> + Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) + friendlyUsername.Text = State.FriendlyLoginName + End Sub + + Protected Sub LoginStatus1_LoggedOut(ByVal sender As Object, ByVal e As EventArgs) + State.Clear() + End Sub +</script> + +<html xmlns="http://www.w3.org/1999/xhtml"> +<head runat="server"> + <title>OpenID Relying Party, by DotNetOpenAuth</title> + <link href="styles.css" rel="stylesheet" type="text/css" /> + <asp:ContentPlaceHolder ID="head" runat="server" /> +</head> +<body> + <form id="form1" runat="server"> + <span style="float: right"> + <asp:Image runat="server" ID="openIdUsernameImage" ImageUrl="~/images/openid_login.gif" + EnableViewState="false" /> + <asp:Label runat="server" ID="friendlyUsername" Text="" EnableViewState="false" /> + <asp:LoginStatus ID="LoginStatus1" runat="server" OnLoggedOut="LoginStatus1_LoggedOut" /> + </span> + <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> + <div> + <asp:ContentPlaceHolder ID="Main" runat="server" /> + </div> + </form> +</body> +</html> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx new file mode 100644 index 0000000..8df914b --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="TracePage.aspx.vb" Inherits="OpenIdRelyingPartyWebFormsVB.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 id="Head1" 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/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.designer.vb new file mode 100644 index 0000000..9928c68 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:2.0.50727.4927 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + + +Partial Public Class TracePage + + '''<summary> + '''Head1 control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents Head1 As Global.System.Web.UI.HtmlControls.HtmlHead + + '''<summary> + '''form1 control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm + + '''<summary> + '''clearLogButton control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents clearLogButton As Global.System.Web.UI.WebControls.Button + + '''<summary> + '''placeHolder1 control. + '''</summary> + '''<remarks> + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + '''</remarks> + Protected WithEvents placeHolder1 As Global.System.Web.UI.WebControls.PlaceHolder +End Class diff --git a/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.vb new file mode 100644 index 0000000..9a1b8c1 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.vb @@ -0,0 +1,13 @@ +Public Class TracePage + Inherits System.Web.UI.Page + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) + Me.placeHolder1.Controls.Add(New Label() With {.Text = HttpUtility.HtmlEncode(Global_asax.LogMessages.ToString())}) + End Sub + + Protected Sub clearLogButton_Click(ByVal sender As Object, ByVal e As EventArgs) + Global_asax.LogMessages.Length = 0 + ' clear the page immediately, and allow for F5 without a Postback warning. + Me.Response.Redirect(Me.Request.Url.AbsoluteUri) + End Sub +End Class
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Web.config b/samples/OpenIdRelyingPartyWebFormsVB/Web.config new file mode 100644 index 0000000..f488900 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/Web.config @@ -0,0 +1,112 @@ +<?xml version="1.0"?> +<configuration> + <configSections> + <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" /> + <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/> + </configSections> + + <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names), + which is necessary for OpenID urls with unicode characters in the domain/host name. + It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. --> + <uri> + <idn enabled="All"/> + <iriParsing enabled="true"/> + </uri> + + <system.net> + <defaultProxy enabled="true" /> + <settings> + <!-- This setting causes .NET to check certificate revocation lists (CRL) + before trusting HTTPS certificates. But this setting tends to not + be allowed in shared hosting environments. --> + <!--<servicePointManager checkCertificateRevocationList="true"/>--> + </settings> + </system.net> + + <!-- this is an optional configuration section where aspects of dotnetopenauth can be customized --> + <dotNetOpenAuth> + <openid> + <relyingParty> + <security requireSsl="false" /> + <behaviors> + <!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible + with OPs that use Attribute Exchange (in various formats). --> + <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" /> + <!--<add type="DotNetOpenAuth.OpenId.Behaviors.GsaIcamProfile, DotNetOpenAuth" />--> + </behaviors> + <!-- Uncomment the following to activate the sample custom store. --> + <!--<store type="OpenIdRelyingPartyWebFormsVB.CustomStore, OpenIdRelyingPartyWebFormsVB" />--> + </relyingParty> + </openid> + <messaging> + <untrustedWebRequest> + <whitelistHosts> + <!-- since this is a sample, and will often be used with localhost --> + <add name="localhost" /> + </whitelistHosts> + </untrustedWebRequest> + </messaging> + <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. --> + <reporting enabled="true" /> + </dotNetOpenAuth> + + <appSettings> + <!-- Fill in your various consumer keys and secrets here to make the sample work. --> + <!-- You must get these values by signing up with each individual service provider. --> + <!-- Google sign-up: https://www.google.com/accounts/ManageDomains --> + <add key="googleConsumerKey" value="demo.dotnetopenauth.net"/> + <add key="googleConsumerSecret" value="5Yv1TfKm1551QrXZ9GpqepeD"/> + </appSettings> + + <system.web> + <!--<sessionState cookieless="true" />--> + <compilation debug="true"/> + <customErrors mode="RemoteOnly"/> + <authentication mode="Forms"> + <forms name="OpenIdRelyingPartyVBSession"/> <!-- named cookie prevents conflicts with other samples --> + </authentication> + <trace enabled="false" writeToDiagnosticsTrace="true" /> + <!-- Trust level discussion: + Full: everything works (this is required for Google Apps for Domains support) + High: TRACE compilation symbol must NOT be defined + Medium: doesn't work unless originUrl=".*" or WebPermission.Connect is extended, and Google Apps doesn't work. + Low: doesn't work because WebPermission.Connect is denied. + --> + <trust level="Medium" originUrl=".*"/> + </system.web> + + <!-- log4net is a 3rd party (free) logger library that DotNetOpenAuth will use if present but does not require. --> + <log4net> + <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> + <file value="RelyingParty.log" /> + <appendToFile value="true" /> + <rollingStyle value="Size" /> + <maxSizeRollBackups value="10" /> + <maximumFileSize value="100KB" /> + <staticLogFileName value="true" /> + <layout type="log4net.Layout.PatternLayout"> + <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" /> + </layout> + </appender> + <appender name="TracePageAppender" type="OpenIdRelyingPartyWebFormsVB.TracePageAppender, OpenIdRelyingPartyWebFormsVB"> + <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="DotNetOpenAuth"> + <level value="INFO" /> + </logger> + </log4net> + + <runtime> + <legacyHMACWarning enabled="0" /> + </runtime> +</configuration> diff --git a/samples/OpenIdRelyingPartyWebFormsVB/favicon.ico b/samples/OpenIdRelyingPartyWebFormsVB/favicon.ico Binary files differnew file mode 100644 index 0000000..e227dbe --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/favicon.ico diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/DotNetOpenAuth.png b/samples/OpenIdRelyingPartyWebFormsVB/images/DotNetOpenAuth.png Binary files differnew file mode 100644 index 0000000..442b986 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/images/DotNetOpenAuth.png diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/attention.png b/samples/OpenIdRelyingPartyWebFormsVB/images/attention.png Binary files differnew file mode 100644 index 0000000..8003700 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/images/attention.png diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/openid_login.gif b/samples/OpenIdRelyingPartyWebFormsVB/images/openid_login.gif Binary files differnew file mode 100644 index 0000000..cde836c --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/images/openid_login.gif diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/yahoo.png b/samples/OpenIdRelyingPartyWebFormsVB/images/yahoo.png Binary files differnew file mode 100644 index 0000000..3129217 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/images/yahoo.png diff --git a/samples/OpenIdRelyingPartyWebFormsVB/styles.css b/samples/OpenIdRelyingPartyWebFormsVB/styles.css new file mode 100644 index 0000000..2e4d3db --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/styles.css @@ -0,0 +1,10 @@ +h2 +{ + font-style: italic; +} + +body +{ + font-family: Cambria, Arial, Times New Roman; + font-size: 12pt; +}
\ No newline at end of file diff --git a/samples/OpenIdRelyingPartyWebFormsVB/xrds.aspx b/samples/OpenIdRelyingPartyWebFormsVB/xrds.aspx new file mode 100644 index 0000000..130ca30 --- /dev/null +++ b/samples/OpenIdRelyingPartyWebFormsVB/xrds.aspx @@ -0,0 +1,29 @@ +<%@ Page Language="VB" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?> +<%-- +This page is a required for relying party discovery per OpenID 2.0. +It allows Providers to call back to the relying party site to confirm the +identity that it is claiming in the realm and return_to URLs. +This page should be pointed to by the 'realm' home page, which in this sample +is default.aspx. +--%> +<xrds:XRDS + xmlns:xrds="xri://$xrds" + xmlns:openid="http://openid.net/xmlns/1.0" + xmlns="xri://$xrd*($v*2.0)"> + <XRD> + <Service priority="1"> + <Type>http://specs.openid.net/auth/2.0/return_to</Type> + <%-- Every page with an OpenID login should be listed here. --%> + <URI priority="1"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/login.aspx"))%></URI> + <URI priority="2"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/loginProgrammatic.aspx"))%></URI> + <URI priority="3"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/ajaxlogin.aspx"))%></URI> + <URI priority="4"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/NoIdentityOpenId.aspx"))%></URI> + <URI priority="5"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/loginPlusOAuth.aspx"))%></URI> + <URI priority="6"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/loginPlusOAuthSampleOP.aspx"))%></URI> + </Service> + <Service> + <Type>http://specs.openid.net/extensions/ui/icon</Type> + <URI><%=New Uri(Request.Url, Response.ApplyAppPathModifier("~/images/DotNetOpenAuth.png"))%></URI> + </Service> + </XRD> +</xrds:XRDS> diff --git a/samples/Samples.sln b/samples/Samples.sln index 2761358..0a138cc 100644 --- a/samples/Samples.sln +++ b/samples/Samples.sln @@ -106,6 +106,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdWebRingSsoRelyingPart EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdOfflineProvider", "OpenIdOfflineProvider\OpenIdOfflineProvider.csproj", "{5C65603B-235F-47E6-B536-06385C60DE7F}" EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "OpenIdRelyingPartyWebFormsVB", "OpenIdRelyingPartyWebFormsVB\OpenIdRelyingPartyWebFormsVB.vbproj", "{F289B925-4307-4BEC-B411-885CE70E3379}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CodeAnalysis|Any CPU = CodeAnalysis|Any CPU @@ -191,6 +193,12 @@ Global {5C65603B-235F-47E6-B536-06385C60DE7F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5C65603B-235F-47E6-B536-06385C60DE7F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5C65603B-235F-47E6-B536-06385C60DE7F}.Release|Any CPU.Build.0 = Release|Any CPU + {F289B925-4307-4BEC-B411-885CE70E3379}.CodeAnalysis|Any CPU.ActiveCfg = Release|Any CPU + {F289B925-4307-4BEC-B411-885CE70E3379}.CodeAnalysis|Any CPU.Build.0 = Release|Any CPU + {F289B925-4307-4BEC-B411-885CE70E3379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F289B925-4307-4BEC-B411-885CE70E3379}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F289B925-4307-4BEC-B411-885CE70E3379}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F289B925-4307-4BEC-B411-885CE70E3379}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -204,6 +212,7 @@ Global {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82} {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82} {5C65603B-235F-47E6-B536-06385C60DE7F} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82} + {F289B925-4307-4BEC-B411-885CE70E3379} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82} {5100F73C-3082-4B81-95DD-F443F90B8EA7} = {812D828E-C91A-45AB-BAE9-3FC6D9560F9F} {DD52C0C8-F986-495A-AAA1-090CFE2F801F} = {812D828E-C91A-45AB-BAE9-3FC6D9560F9F} {6EC36418-DBC5-4AD1-A402-413604AA7A08} = {812D828E-C91A-45AB-BAE9-3FC6D9560F9F} |