public ActionResult Login(bool connect = false) { if (connect) { HandyOidc.Login(System.Web.HttpContext.Current); } return(View()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); GlobalFilters.Filters.Add(new HandyOidcAuthorizeAttribute()); HandyOidc.Init(new HandyOidcSettings() { ClientAuthenticationParameters = new HandyOidcClientAuthenticationParameters() { CallbackUrl = "http://localhost:63835/Oidc/callback", AuthFailUrl = "http://localhost:63835/Oidc/Fail", LoginUrl = "http://localhost:63835/Oidc/Login", //Login page is an option, if not defined, automatically redirect user if needed. LogoutUrl = "http://localhost:63835/Oidc/Logout" }, ProviderConfiguration = new HandyOidcProviderConfiguration() { AuthorizationEndpointUrl = "https://dev-oh98gwym.eu.auth0.com/authorize", TokenEndpointUrl = "https://dev-oh98gwym.eu.auth0.com/oauth/token", ClientId = "kki6oRVaHMI1YByFVPmPqg6Qr3NskT8o", ClientSecret = "kiqAajoebizqoTRGwt8Mmkvgcjs9Wkj8sp959pz9ja9M0dJ3XO7ldegnLvH_RoUk", TokenEndPointAuthicationMethod = TokenEndPointAuthicationMethod.Post, Scope = new string[] { "profile", "mail" }, TokenValidationParameters = new HandyOidcTokenValidationParameters() { //IssuerSigningKeys = HandyOidc.GetSigningKeysFromJson("{\"keys\":[{\"alg\":\"RS256\",\"kty\":\"RSA\",\"use\":\"sig\",\"x5c\":[\"MIIDDTCCAfWgAwIBAgIJXct2PZ3H1hUhMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNVBAMTGWRldi1vaDk4Z3d5bS5ldS5hdXRoMC5jb20wHhcNMTkwNDAyMTMxMzUxWhcNMzIxMjA5MTMxMzUxWjAkMSIwIAYDVQQDExlkZXYtb2g5OGd3eW0uZXUuYXV0aDAuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8goeTQwmRIOhOCwEa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fI3WFIhODsFEHeBzJKjPkgnjCO1XRIuATQBTEFxC3FXFMmCCbw\",\"e\":\"AQAB\",\"kid\":\"Q0Q1M0E2N0JFN0ZEQ0FBRjA2MDEzMzlEOTk4NjU5OEMxREIwQzYwOQ\",\"x5t\":\"Q0Q1M0E2N0JFN0ZEQ0FBRjA2MDEzMzlEOTk4NjU5OEMxREIwQzYwOQ\"}]}"), IssuerSigningKeys = HandyOidc.GetSigningKeysFromUrl("https://dev-oh98gwym.eu.auth0.com/.well-known/jwks.json"), ValidIssuer = "https://dev-oh98gwym.eu.auth0.com/", ValidAudiences = new[] { "kki6oRVaHMI1YByFVPmPqg6Qr3NskT8o" } } } }); }