Skip to content
This repository was archived by the owner on Mar 20, 2019. It is now read-only.

Commit 5fde84c

Browse files
Straight forward OpenID Connect RP example
1 parent f840b59 commit 5fde84c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+27393
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.Web;
2+
using System.Web.Optimization;
3+
4+
namespace DotNetOpenAuth.Samples.OpenIDConnectRP {
5+
public class BundleConfig {
6+
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
7+
public static void RegisterBundles(BundleCollection bundles) {
8+
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
9+
"~/Scripts/jquery-{version}.js"));
10+
11+
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
12+
"~/Scripts/jquery.validate*"));
13+
14+
// Use the development version of Modernizr to develop with and learn from. Then, when you're
15+
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
16+
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
17+
"~/Scripts/modernizr-*"));
18+
19+
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
20+
"~/Scripts/bootstrap.js",
21+
"~/Scripts/respond.js"));
22+
23+
bundles.Add(new StyleBundle("~/Content/css").Include(
24+
"~/Content/bootstrap.css",
25+
"~/Content/site.css"));
26+
}
27+
}
28+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Web;
2+
using System.Web.Mvc;
3+
4+
namespace DotNetOpenAuth.Samples.OpenIDConnectRP {
5+
public class FilterConfig {
6+
public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
7+
filters.Add(new HandleErrorAttribute());
8+
}
9+
}
10+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Routing;
7+
8+
namespace DotNetOpenAuth.Samples.OpenIDConnectRP {
9+
public class RouteConfig {
10+
public static void RegisterRoutes(RouteCollection routes) {
11+
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
12+
13+
routes.MapRoute(
14+
name: "Default",
15+
url: "{controller}/{action}/{id}",
16+
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
17+
);
18+
}
19+
}
20+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using Microsoft.AspNet.Identity;
3+
using Microsoft.AspNet.Identity.Owin;
4+
using Microsoft.Owin;
5+
using Microsoft.Owin.Security.Cookies;
6+
using Microsoft.Owin.Security.OpenIdConnect;
7+
using Owin;
8+
using DotNetOpenAuth.Samples.OpenIDConnectRP.Models;
9+
10+
namespace DotNetOpenAuth.Samples.OpenIDConnectRP
11+
{
12+
using System.Collections.Generic;
13+
using System.IdentityModel.Claims;
14+
using System.IdentityModel.Tokens;
15+
using System.Web.Helpers;
16+
17+
public partial class Startup
18+
{
19+
public void ConfigureAuth(IAppBuilder app)
20+
{
21+
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
22+
app.UseCookieAuthentication(new CookieAuthenticationOptions
23+
{
24+
AuthenticationType = "Cookies"
25+
});
26+
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions {
27+
ClientId = "DNOA",
28+
Authority = "https://localhost:44333/core",
29+
RedirectUri = "http://localhost:39743/",
30+
ResponseType = "id_token",
31+
Scope = "openid email",
32+
33+
SignInAsAuthenticationType = "Cookies",
34+
35+
});
36+
AntiForgeryConfig.UniqueClaimTypeIdentifier = "sub";
37+
}
38+
}
39+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
body {
2+
padding-top: 50px;
3+
padding-bottom: 20px;
4+
}
5+
6+
/* Set padding to keep content from hitting the edges */
7+
.body-content {
8+
padding-left: 15px;
9+
padding-right: 15px;
10+
}
11+
12+
/* Override the default bootstrap behavior where horizontal description lists
13+
will truncate terms that are too long to fit in the left column
14+
*/
15+
.dl-horizontal dt {
16+
white-space: normal;
17+
}
18+
19+
/* Set width on the form input elements since they're 100% wide by default */
20+
input,
21+
select,
22+
textarea {
23+
max-width: 280px;
24+
}

0 commit comments

Comments
 (0)