summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-02-26 20:07:49 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2010-02-26 20:07:49 -0800
commitd82cefc93664d44ac2f98047d271aa281aeb265f (patch)
treee0f2433afc2b625854fcad054c2fc6d9694a7069
parentba0570925584c3c0431e65f698c73f061f200a6f (diff)
downloadDotNetOpenAuth-d82cefc93664d44ac2f98047d271aa281aeb265f.zip
DotNetOpenAuth-d82cefc93664d44ac2f98047d271aa281aeb265f.tar.gz
DotNetOpenAuth-d82cefc93664d44ac2f98047d271aa281aeb265f.tar.bz2
Some discovery work on OpenIdSelector for MVC web apps.
-rw-r--r--projecttemplates/MvcRelyingParty/Content/images/google.gifbin0 -> 1596 bytes
-rw-r--r--projecttemplates/MvcRelyingParty/Content/images/myopenid.pngbin0 -> 1796 bytes
-rw-r--r--projecttemplates/MvcRelyingParty/Content/images/openid.gifbin0 -> 740 bytes
-rw-r--r--projecttemplates/MvcRelyingParty/Content/images/verisign.gifbin0 -> 2550 bytes
-rw-r--r--projecttemplates/MvcRelyingParty/Content/images/yahoo.gifbin0 -> 1682 bytes
-rw-r--r--projecttemplates/MvcRelyingParty/Content/images/yahoo_login.pngbin0 -> 6310 bytes
-rw-r--r--projecttemplates/MvcRelyingParty/Scripts/jquery.cookie.js96
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx43
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Shared/Site.Master1
9 files changed, 133 insertions, 7 deletions
diff --git a/projecttemplates/MvcRelyingParty/Content/images/google.gif b/projecttemplates/MvcRelyingParty/Content/images/google.gif
new file mode 100644
index 0000000..1b6cd07
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Content/images/google.gif
Binary files differ
diff --git a/projecttemplates/MvcRelyingParty/Content/images/myopenid.png b/projecttemplates/MvcRelyingParty/Content/images/myopenid.png
new file mode 100644
index 0000000..204caae
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Content/images/myopenid.png
Binary files differ
diff --git a/projecttemplates/MvcRelyingParty/Content/images/openid.gif b/projecttemplates/MvcRelyingParty/Content/images/openid.gif
new file mode 100644
index 0000000..c718b0e
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Content/images/openid.gif
Binary files differ
diff --git a/projecttemplates/MvcRelyingParty/Content/images/verisign.gif b/projecttemplates/MvcRelyingParty/Content/images/verisign.gif
new file mode 100644
index 0000000..faa6aaa
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Content/images/verisign.gif
Binary files differ
diff --git a/projecttemplates/MvcRelyingParty/Content/images/yahoo.gif b/projecttemplates/MvcRelyingParty/Content/images/yahoo.gif
new file mode 100644
index 0000000..42adbfa
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Content/images/yahoo.gif
Binary files differ
diff --git a/projecttemplates/MvcRelyingParty/Content/images/yahoo_login.png b/projecttemplates/MvcRelyingParty/Content/images/yahoo_login.png
new file mode 100644
index 0000000..476fa64
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Content/images/yahoo_login.png
Binary files differ
diff --git a/projecttemplates/MvcRelyingParty/Scripts/jquery.cookie.js b/projecttemplates/MvcRelyingParty/Scripts/jquery.cookie.js
new file mode 100644
index 0000000..121f723
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Scripts/jquery.cookie.js
@@ -0,0 +1,96 @@
+/**
+* Cookie plugin
+*
+* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
+* Dual licensed under the MIT and GPL licenses:
+* http://www.opensource.org/licenses/mit-license.php
+* http://www.gnu.org/licenses/gpl.html
+*
+*/
+
+/**
+* Create a cookie with the given name and value and other optional parameters.
+*
+* @example $.cookie('the_cookie', 'the_value');
+* @desc Set the value of a cookie.
+* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
+* @desc Create a cookie with all available options.
+* @example $.cookie('the_cookie', 'the_value');
+* @desc Create a session cookie.
+* @example $.cookie('the_cookie', null);
+* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
+* used when the cookie was set.
+*
+* @param String name The name of the cookie.
+* @param String value The value of the cookie.
+* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
+* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
+* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
+* If set to null or omitted, the cookie will be a session cookie and will not be retained
+* when the the browser exits.
+* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
+* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
+* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
+* require a secure protocol (like HTTPS).
+* @type undefined
+*
+* @name $.cookie
+* @cat Plugins/Cookie
+* @author Klaus Hartl/klaus.hartl@stilbuero.de
+*/
+
+/**
+* Get the value of a cookie with the given name.
+*
+* @example $.cookie('the_cookie');
+* @desc Get the value of a cookie.
+*
+* @param String name The name of the cookie.
+* @return The value of the cookie.
+* @type String
+*
+* @name $.cookie
+* @cat Plugins/Cookie
+* @author Klaus Hartl/klaus.hartl@stilbuero.de
+*/
+jQuery.cookie = function(name, value, options) {
+ if (typeof value != 'undefined') { // name and value given, set cookie
+ options = options || {};
+ if (value === null) {
+ value = '';
+ options.expires = -1;
+ }
+ var expires = '';
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
+ var date;
+ if (typeof options.expires == 'number') {
+ date = new Date();
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
+ } else {
+ date = options.expires;
+ }
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
+ }
+ // CAUTION: Needed to parenthesize options.path and options.domain
+ // in the following expressions, otherwise they evaluate to undefined
+ // in the packed version for some reason...
+ var path = options.path ? '; path=' + (options.path) : '';
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
+ var secure = options.secure ? '; secure' : '';
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
+ } else { // only name given, get cookie
+ var cookieValue = null;
+ if (document.cookie && document.cookie != '') {
+ var cookies = document.cookie.split(';');
+ for (var i = 0; i < cookies.length; i++) {
+ var cookie = jQuery.trim(cookies[i]);
+ // Does this cookie string begin with the name we want?
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+ break;
+ }
+ }
+ }
+ return cookieValue;
+ }
+}; \ No newline at end of file
diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx
index f0cd6ac..4a2c58a 100644
--- a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx
+++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx
@@ -12,14 +12,22 @@
<% using (Html.BeginForm("LogOn", "Account")) { %>
<%= Html.AntiForgeryToken() %>
<%= Html.Hidden("ReturnUrl", Request.QueryString["ReturnUrl"]) %>
+ <%= Html.Hidden("openid_openidAuthData") %>
<div>
<fieldset>
<legend>Account Information</legend>
- <p>
- <label for="openid_identifier">OpenID:</label>
- <%= Html.TextBox("openid_identifier")%>
- <%= Html.ValidationMessage("openid_identifier")%>
- </p>
+ <ul class="OpenIdProviders">
+ <li id="https://www.google.com/accounts/o8/id" class="OPButton"><a href="#"><div><div>
+ <img src="../../Content/images/google.gif" />
+ <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
+ </div><div class="ui-widget-overlay"></div></div></a>
+ </li>
+ <li id="https://me.yahoo.com/" class="OPButton"><a href="#"><div><div>
+ <img src="../../Content/images/yahoo.gif" />
+ <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
+ </div><div class="ui-widget-overlay"></div></div></a>
+ </li>
+ </ul>
<p>
<%= Html.CheckBox("rememberMe") %> <label class="inline" for="rememberMe">Remember me?</label>
</p>
@@ -33,7 +41,28 @@
<asp:Content ID="Content1" ContentPlaceHolderID="ScriptsArea" runat="server">
<script type="text/javascript" src="../../Scripts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="../../Scripts/MicrosoftMvcAjax.js"></script>
- <script type="text/javascript" language="javascript"><!--//<![CDATA[
- $addHandler(window, 'load', function() { document.getElementsByName("openid_identifier")[0].focus(); });
+ <script type="text/javascript" src="../../Scripts/jquery-1.3.2.min.js"></script>
+ <script type="text/javascript" src="../../Scripts/jquery.cookie.js"></script>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/yuiloader/yuiloader-min.js"></script>
+ <script type="text/javascript" src="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingPartyControlBase.js")%>"></script>
+ <script type="text/javascript" src="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingPartyAjaxControlBase.js")%>"></script>
+ <script type="text/javascript" src="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector.js")%>"></script>
+ <script type="text/javascript" language="javascript"><!--
+ //<![CDATA[
+ //$addHandler(window, 'load', function () { document.getElementsByName("openid_identifier")[0].focus(); });
+ try {
+ if (YAHOO) {
+ var loader = new YAHOO.util.YUILoader({
+ require: ['button', 'menu'],
+ loadOptional: false,
+ combine: true
+ });
+
+ loader.insert();
+ }
+ } catch (e) { }
//]]>--></script>
</asp:Content>
+<asp:Content ContentPlaceHolderID="Head" runat="server">
+ <link rel="Stylesheet" type="text/css" href="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector.css")%>" />
+</asp:Content>
diff --git a/projecttemplates/MvcRelyingParty/Views/Shared/Site.Master b/projecttemplates/MvcRelyingParty/Views/Shared/Site.Master
index f49b072..59ae182 100644
--- a/projecttemplates/MvcRelyingParty/Views/Shared/Site.Master
+++ b/projecttemplates/MvcRelyingParty/Views/Shared/Site.Master
@@ -7,6 +7,7 @@
<asp:ContentPlaceHolder ID="TitleContent" runat="server" />
</title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
+ <asp:ContentPlaceHolder ID="Head" runat="server" />
</head>
<body>
<div class="page">