This repository has been archived by the owner on Mar 20, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an ASP.NET MVC template to the .vsi
Merge branch 'mvcProjTemplate'
- Loading branch information
Showing
58 changed files
with
26,380 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="ProjectGroup"> | ||
<TemplateData> | ||
<Name>ASP.NET MVC OpenID-InfoCard RP</Name> | ||
<RequiredFrameworkVersion>3.5</RequiredFrameworkVersion> | ||
<Description>An ASP.NET MVC web site that accepts OpenID and InfoCard logins</Description> | ||
<ProjectType>CSharp</ProjectType> | ||
<ProjectSubType>Web</ProjectSubType> | ||
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp> | ||
<SortOrder>1000</SortOrder> | ||
<CreateNewFolder>true</CreateNewFolder> | ||
<DefaultName>WebRPApplication</DefaultName> | ||
<ProvideDefaultName>true</ProvideDefaultName> | ||
<LocationField>Enabled</LocationField> | ||
<EnableLocationBrowseButton>true</EnableLocationBrowseButton> | ||
<Icon>__TemplateIcon.ico</Icon> | ||
</TemplateData> | ||
<TemplateContent> | ||
<ProjectCollection> | ||
<ProjectTemplateLink ProjectName="$projectname$">MvcRelyingParty\MvcRelyingParty.vstemplate</ProjectTemplateLink> | ||
<ProjectTemplateLink ProjectName="RelyingPartyLogic">RelyingPartyLogic\RelyingPartyLogic.vstemplate</ProjectTemplateLink> | ||
</ProjectCollection> | ||
</TemplateContent> | ||
</VSTemplate> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace MvcRelyingParty { | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Web.Mvc; | ||
|
||
internal static class Extensions { | ||
internal static Uri ActionFull(this UrlHelper urlHelper, string actionName) { | ||
return new Uri(HttpContext.Current.Request.Url, urlHelper.Action(actionName)); | ||
} | ||
|
||
internal static Uri ActionFull(this UrlHelper urlHelper, string actionName, string controllerName) { | ||
return new Uri(HttpContext.Current.Request.Url, urlHelper.Action(actionName, controllerName)); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
projecttemplates/MvcRelyingParty/Code/FormsAuthenticationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace MvcRelyingParty { | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Web.Security; | ||
using DotNetOpenAuth.OpenId; | ||
|
||
/// <summary> | ||
/// Forms authentication interface to facilitate login/logout functionality. | ||
/// </summary> | ||
/// <remarks> | ||
/// The FormsAuthentication type is sealed and contains static members, so it is difficult to | ||
/// unit test code that calls its members. The interface and helper class below demonstrate | ||
/// how to create an abstract wrapper around such a type in order to make the AccountController | ||
/// code unit testable. | ||
/// </remarks> | ||
public interface IFormsAuthentication { | ||
void SignIn(Identifier claimedIdentifier, bool createPersistentCookie); | ||
|
||
void SignOut(); | ||
} | ||
|
||
/// <summary> | ||
/// The standard FormsAuthentication behavior to use for the live site. | ||
/// </summary> | ||
public class FormsAuthenticationService : IFormsAuthentication { | ||
public void SignIn(Identifier claimedIdentifier, bool createPersistentCookie) { | ||
FormsAuthentication.SetAuthCookie(claimedIdentifier, createPersistentCookie); | ||
} | ||
|
||
public void SignOut() { | ||
FormsAuthentication.SignOut(); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace MvcRelyingParty { | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using DotNetOpenAuth.OpenId; | ||
using DotNetOpenAuth.OpenId.RelyingParty; | ||
|
||
public interface IOpenIdRelyingParty { | ||
IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo); | ||
|
||
IAuthenticationResponse GetResponse(); | ||
} | ||
|
||
/// <summary> | ||
/// A wrapper around the standard <see cref="OpenIdRelyingParty"/> class. | ||
/// </summary> | ||
public class OpenIdRelyingPartyService : IOpenIdRelyingParty { | ||
/// <summary> | ||
/// The OpenID relying party to use for logging users in. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is static because it is thread-safe and is more expensive | ||
/// to create than we want to run through for every single page request. | ||
/// </remarks> | ||
private static OpenIdRelyingParty relyingParty = new OpenIdRelyingParty(); | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OpenIdRelyingPartyService"/> class. | ||
/// </summary> | ||
public OpenIdRelyingPartyService() { | ||
} | ||
|
||
#region IOpenIdRelyingParty Members | ||
|
||
public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo) { | ||
return relyingParty.CreateRequest(userSuppliedIdentifier, realm, returnTo); | ||
} | ||
|
||
public IAuthenticationResponse GetResponse() { | ||
return relyingParty.GetResponse(); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
Oops, something went wrong.