summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/App_Start/Startup.Auth.cs
blob: 59d7fc6ff51fb8bc5d2d64fd2d6a7189facc36a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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";
        }
    }
}