diff options
Diffstat (limited to 'samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start')
4 files changed, 97 insertions, 0 deletions
diff --git a/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/BundleConfig.cs b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/BundleConfig.cs new file mode 100644 index 0000000..1428630 --- /dev/null +++ b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/BundleConfig.cs @@ -0,0 +1,28 @@ +using System.Web; +using System.Web.Optimization; + +namespace DotNetOpenAuth.Samples.OpenIDConnectRP { + public class BundleConfig { + // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 + public static void RegisterBundles(BundleCollection bundles) { + bundles.Add(new ScriptBundle("~/bundles/jquery").Include( + "~/Scripts/jquery-{version}.js")); + + bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( + "~/Scripts/jquery.validate*")); + + // Use the development version of Modernizr to develop with and learn from. Then, when you're + // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. + bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( + "~/Scripts/modernizr-*")); + + bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( + "~/Scripts/bootstrap.js", + "~/Scripts/respond.js")); + + bundles.Add(new StyleBundle("~/Content/css").Include( + "~/Content/bootstrap.css", + "~/Content/site.css")); + } + } +} diff --git a/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/FilterConfig.cs b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/FilterConfig.cs new file mode 100644 index 0000000..07eafd0 --- /dev/null +++ b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/FilterConfig.cs @@ -0,0 +1,10 @@ +using System.Web; +using System.Web.Mvc; + +namespace DotNetOpenAuth.Samples.OpenIDConnectRP { + public class FilterConfig { + public static void RegisterGlobalFilters(GlobalFilterCollection filters) { + filters.Add(new HandleErrorAttribute()); + } + } +} diff --git a/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/RouteConfig.cs b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/RouteConfig.cs new file mode 100644 index 0000000..bd320f5 --- /dev/null +++ b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/RouteConfig.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; + +namespace DotNetOpenAuth.Samples.OpenIDConnectRP { + public class RouteConfig { + public static void RegisterRoutes(RouteCollection routes) { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } + ); + } + } +} diff --git a/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/Startup.Auth.cs b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/Startup.Auth.cs new file mode 100644 index 0000000..59d7fc6 --- /dev/null +++ b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/Startup.Auth.cs @@ -0,0 +1,39 @@ +using System; +using Microsoft.AspNet.Identity; +using Microsoft.AspNet.Identity.Owin; +using Microsoft.Owin; +using Microsoft.Owin.Security.Cookies; +using Microsoft.Owin.Security.OpenIdConnect; +using Owin; +using DotNetOpenAuth.Samples.OpenIDConnectRP.Models; + +namespace DotNetOpenAuth.Samples.OpenIDConnectRP +{ + using System.Collections.Generic; + using System.IdentityModel.Claims; + using System.IdentityModel.Tokens; + using System.Web.Helpers; + + public partial class Startup + { + public void ConfigureAuth(IAppBuilder app) + { + JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>(); + app.UseCookieAuthentication(new CookieAuthenticationOptions + { + AuthenticationType = "Cookies" + }); + app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions { + ClientId = "DNOA", + Authority = "https://localhost:44333/core", + RedirectUri = "http://localhost:39743/", + ResponseType = "id_token", + Scope = "openid email", + + SignInAsAuthenticationType = "Cookies", + + }); + AntiForgeryConfig.UniqueClaimTypeIdentifier = "sub"; + } + } +}
\ No newline at end of file |