using System;using System.Threading.Tasks;using Microsoft.Owin;using Microsoft.Owin.Extensions;using Owin;using System.IdentityModel.Tokens;using Microsoft.Owin.Security.Cookies;using Microsoft.Owin.Security.OpenIdConnect;using System.Linq;using System.Security.Claims;using IdentityModel.Client;using Microsoft.IdentityModel.Protocols;using Microsoft.Owin.Security;using System.IdentityModel.Tokens.Jwt;[assembly: OwinStartup(typeof(SSO.App_Start.Startup))]namespace SSO.App_Start{public class Startup{public void ConfigureServices(IAppBuilder app){app.UseCookieAuthentication(new CookieAuthenticationOptions{AuthenticationType = "Cookies"});app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions{AuthenticationType = "oidc",SignInAsAuthenticationType = "Cookies",Authority = "http://localhost:5000", //ID Server SSO ServerClientId = "mvc.hybrid",ClientSecret = "secret",ResponseType = "code id_token",RedirectUri = "http://localhost:55471/signin-oidc", //URL of Client websitePostLogoutRedirectUri = "http://localhost:55471/signout-callback-oidc", //URL of Client websiteScope = "openid",AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Active,RequireHttpsMetadata = false,});}public void Configuration(IAppBuilder app){ConfigureServices(app);}}}
If You want user information to take your claims list modify client code like below
For MVC Application Install Following package. otherwise startup class not hit
Install-Package Microsoft.Owin.Host.SystemWeb
From Nuget following Packages have to import for startup class
Microsoft.Owin.Security -3.1.0.0
Microsoft.Owin; -3.1.0.0
Microsoft.Owin.Security.Cookies -3.0.0.0
Microsoft.Owin.Security.OpenIdConnect -3.1.0.0
Web config set following property
No comments:
Post a Comment