Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
744635b
Stop tracking compile artifacts
smithkl42 Jun 10, 2013
b610c31
Remove additional compile artifacts
smithkl42 Jun 10, 2013
a675b76
Update nuget package versions
smithkl42 Jun 10, 2013
a8f9163
Stop tracking *.suo
smithkl42 Jun 10, 2013
c188169
Update build target dir for MVC4 project
smithkl42 Jun 10, 2013
61e4cef
Create .nupkg file for MVC4 project
smithkl42 Jun 10, 2013
4dca65f
Fix namespace issues in MVC4 project
smithkl42 Jun 10, 2013
0bf5680
Fix more namespace issues
smithkl42 Jun 10, 2013
c226718
Update SimpleAuthController
smithkl42 Jun 10, 2013
4339700
Change build target location
smithkl42 Jun 10, 2013
84d6d47
Change SimpleSocialAuth version name
smithkl42 Jun 10, 2013
4eaabe6
Remove BCL build tasks
smithkl42 Jun 10, 2013
8842729
Change largeBtn class name to simpleAuthButton
smithkl42 Jun 10, 2013
bbcb68f
Submit name rather than code of oauth provider
smithkl42 Jun 10, 2013
6418eb1
Rework script/stylesheet references
smithkl42 Jun 11, 2013
6bf1352
Add SimpleAuthController.cs.pp to nuget
smithkl42 Jun 11, 2013
a7af83c
Fix bundle references
smithkl42 Jun 11, 2013
0d330e9
Change file name of auth_logos
smithkl42 Jun 11, 2013
7fdae56
Tweak authhandlerfactory
smithkl42 Jun 11, 2013
eecc8e6
Update Login.cshtml to use links rather than rendering
smithkl42 Jun 11, 2013
1e8eb19
Move nuget files identical for both mvc3 and mvc4 into common location
smithkl42 Jun 11, 2013
569135c
Add error handling to SimpleAuthController.cs.pp
smithkl42 Jun 11, 2013
e7a28ed
Fix stupid razor syntax error
smithkl42 Jun 11, 2013
3ff74d9
Work around DNOA/Google interop bug
smithkl42 Jun 11, 2013
4858e20
Work around DNOA/Facebook interop bug
smithkl42 Jun 11, 2013
bbd3f87
Reformatting some code
smithkl42 Jun 11, 2013
c9de112
Switch Twitter URL's to SSL
smithkl42 Jun 11, 2013
3716475
Added missing files
smithkl42 Jun 15, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
lib/*
bin/Debug/*
src/_ReSharper*
src/packages/*
*.DotSettings.user
[Oo]bj/
[Bb]in/
*.user
TestResults/
*.vspscc
*.vssscc
deploy
deploy/*
*.suo
*.cache
*.docstates
_ReSharper.*
*.csproj.user
*[Rr]e[Ss]harper.user
_ReSharper.*

packages/
artifacts/
msbuild.log
PublishProfiles/
*.psess
*.vsp
*.pidb
*.userprefs
*DS_Store
*.ncrunchsolution
*.log
*.vspx
*.dbmdl
*.nupkg
30 changes: 0 additions & 30 deletions nuget/SimpleSocialAuth.MVC3.1.0.0-refresh4.nuspec

This file was deleted.

34 changes: 34 additions & 0 deletions nuget/SimpleSocialAuth.MVC3.1.0.1.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<version>1.0.1</version>
<authors>rafek, smithkl42</authors>
<owners>rafek</owners>
<licenseUrl>http://www.opensource.org/licenses/ms-pl.html</licenseUrl>
<projectUrl>https://github.com/rafek/SimpleSocialAuth</projectUrl>
<iconUrl>http://i.imgur.com/n1Q5A.png</iconUrl>
<dependencies>
<dependency id="HtmlTags" version="1.0" />
<dependency id="DotNetOpenAuth" version="4.3" />
<dependency id="Newtonsoft.Json" version="4.0" />
</dependencies>
<id>SimpleSocialAuth.MVC3</id>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Super simple and easy to install package that allows web sites creators to seamlessly add OAuth support to their ASP.NET MVC 3 sites. Supporting Twitter, Google and Facebook.</description>
<summary />
<releaseNotes>Profile picture for Facebook fix.</releaseNotes>
<copyright>Copyright 2012</copyright>
<tags>social auth oauth asp.net-mvc</tags>
</metadata>
<files>
<file src="content.common\SimpleAuthController.cs.pp" target="content\Controllers\SimpleAuthController.cs.pp" />
<file src="content.mvc3\LogIn.cshtml" target="content\Views\SimpleAuth\LogIn.cshtml" />
<!--<file src="content\web.config.transform" target="content\web.config.transform" />-->
<file src="..\src\SimpleSocialAuth.MVC3\bin\Release\SimpleSocialAuth.Core.dll" target="lib\net40-full\SimpleSocialAuth.Core.dll" />
<file src="..\src\SimpleSocialAuth.MVC3\bin\Release\SimpleSocialAuth.MVC3.dll" target="lib\net40-full\SimpleSocialAuth.MVC3.dll" />
<file src="..\src\SimpleSocialAuth.MVC3\Scripts\simplesocialauth.js" target="content\Scripts\simplesocialauth.js" />
<file src="..\src\SimpleSocialAuth.MVC3\Stylesheets\simplesocialauth.css" target="content\Content\simplesocialauth.css" />
<file src="..\src\SimpleSocialAuth.Mvc3\Images\simplesocialauthlogos.png" target="content\Images\simplesocialauthlogos.png" />
<file src="tools\install.ps1" target="tools\install.ps1" />
</files>
</package>
38 changes: 38 additions & 0 deletions nuget/SimpleSocialAuth.MVC4.1.0.1.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<version>1.0.10</version>
<authors>rafek, smithkl42</authors>
<owners>rafek</owners>
<licenseUrl>http://www.opensource.org/licenses/ms-pl.html</licenseUrl>
<projectUrl>https://github.com/rafek/SimpleSocialAuth</projectUrl>
<iconUrl>http://i.imgur.com/n1Q5A.png</iconUrl>
<dependencies>
<dependency id="HtmlTags" version="1.0.0.54" />
<dependency id="DotNetOpenAuth" version="4.3.0" />
<dependency id="Newtonsoft.Json" version="4.0.8" />
</dependencies>
<id>SimpleSocialAuth.MVC4</id>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Super simple and easy to install package that allows web sites creators to seamlessly add OAuth support to their ASP.NET MVC 4 sites. Supporting Twitter, Google and Facebook.</description>
<summary />
<releaseNotes>Adds support for ASP.NET MVC4.</releaseNotes>
<copyright>Copyright 2012-2013</copyright>
<tags>social auth oauth asp.net-mvc</tags>
</metadata>
<files>

<!-- ks 6/10/13 - This was missing from the source, not sure what it's needed for -->
<!--<file src="content\web.config.transform" target="content\web.config.transform" />-->

<file src="content.common\SimpleAuthController.cs.pp" target="content\Controllers\SimpleAuthController.cs.pp" />
<file src="content.mvc4\SimpleSocialAuthBundleConfig.cs.pp" target="content\App_Start\SimpleSocialAuthBundleConfig.cs.pp" />
<file src="content.mvc4\LogIn.cshtml" target="content\Views\SimpleAuth\LogIn.cshtml" />
<file src="..\src\SimpleSocialAuth.Mvc4\bin\Release\SimpleSocialAuth.Core.dll" target="lib\net40-full\SimpleSocialAuth.Core.dll" />
<file src="..\src\SimpleSocialAuth.Mvc4\bin\Release\SimpleSocialAuth.Mvc4.dll" target="lib\net40-full\SimpleSocialAuth.Mvc4.dll" />
<file src="..\src\SimpleSocialAuth.Mvc4\Scripts\simplesocialauth.js" target="content\Scripts\simplesocialauth.js" />
<file src="..\src\SimpleSocialAuth.Mvc4\Stylesheets\simplesocialauth.css" target="content\Content\simplesocialauth.css" />
<file src="..\src\SimpleSocialAuth.Mvc4\Images\simplesocialauthlogos.png" target="content\Images\simplesocialauthlogos.png" />
<file src="tools\install.ps1" target="tools\install.ps1" />
</files>
</package>
79 changes: 79 additions & 0 deletions nuget/content.common/SimpleAuthController.cs.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using System.Diagnostics;
using System.Web.Mvc;
using System.Web.Security;
using SimpleSocialAuth.Core;
using SimpleSocialAuth.Core.Handlers;

namespace $rootnamespace$.Controllers
{
/// <summary>
/// Simple scaffolding class for handling OAuth-based authentication.
/// Many scenarios will require that this controller be extended or logic from this
/// controller moved into other classes.
/// </summary>
public class SimpleAuthController : Controller
{
public ActionResult LogIn()
{
if (Request.IsAuthenticated)
{
return RedirectToAction("Index", "Home");
}
Session["ReturnUrl"] = Request.QueryString["returnUrl"];
return View();
}

[HttpPost]
public ActionResult Authenticate(string authType)
{
try
{
var authHandler = AuthHandlerFactory.Create(authType);
var authContext = new PrepareAuthenticationContext(
CurrentContextSession.Instance,
Request.Url,
Url.Action("DoAuth", new { authType }));
string redirectUrl = authHandler.PrepareAuthRequest(authContext);
return Redirect(redirectUrl);
}
catch (Exception ex)
{
Debug.WriteLine("Error calling OAuth provider: " + ex);
TempData["authError"] = ex.Message;
return RedirectToAction("LogIn");
}
}

public ActionResult DoAuth(string authType)
{
try
{
var authHandler = AuthHandlerFactory.Create(authType);
var authContext = new ProcessAuthenticationContext(CurrentContextSession.Instance, Request.Url);
var userData = authHandler.ProcessAuthRequest(authContext);

if (userData == null)
{
TempData["authError"] = "Authentication has failed.";

return RedirectToAction("LogIn");
}

// NOTE: this is just simple usage of setting AuthCookie
// TODO: You may also want to check to see if this user exists in your database, create an entry if they don't, etc.
FormsAuthentication.SetAuthCookie(userData.UserName, true);

return Session["ReturnUrl"] != null
? (ActionResult) Redirect((string) Session["ReturnUrl"])
: RedirectToAction("Index", "Home");
}
catch (Exception ex)
{
Debug.WriteLine("Error responding to OAuth request: " + ex);
TempData["authError"] = ex.Message;
return RedirectToAction("LogIn");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@using SimpleSocialAuth.MVC3
<link href-="~/Content/simplesocialauth.css" rel="stylesheet"/>
<script src="~/Scripts/simplesocialauth.js"></script>

@{
ViewBag.Title = "LogIn";
}

<h2>LogIn</h2>

@Html.RenderAuthStylesheet()
@Html.RenderAuthScript()
@Html.RenderAuthWarnings()

@if (TempData["authError"] != null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using SimpleSocialAuth.Core;
using SimpleSocialAuth.MVC3;

namespace $rootnamespace$.Controllers
Expand Down
24 changes: 24 additions & 0 deletions nuget/content.mvc4/LogIn.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@using SimpleSocialAuth.Mvc4

@{
ViewBag.Title = "LogIn";
}

<h2>LogIn</h2>

@Styles.Render("~/Content/SimpleSocialAuth")
@Html.RenderAuthWarnings()

@if (TempData["authError"] != null)
{
<p class="error-messasge">
@TempData["authError"]
</p>
}

@using (Html.BeginForm("Authenticate", "SimpleAuth", FormMethod.Post, new { id = "authForm" }))
{
@Html.AuthButtons()
}

@Scripts.Render("~/Scripts/SimpleSocialAuth")
16 changes: 16 additions & 0 deletions nuget/content.mvc4/SimpleSocialAuthBundleConfig.cs.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Web.Optimization;

namespace $rootnamespace$.App_Start
{
public class SimpleSocialAuthBundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/scripts/simplesocialauth")
.Include("~/Scripts/simplesocialauth.js"));

bundles.Add(new StyleBundle("~/content/simplesocialauth")
.Include("~/Content/simplesocialauth.css"));
}
}
}
Loading