Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am working with umbraco 8 and working with auth0 integration . The code that is working fine with simple asp.net MVC application with openid connect(downloaded code for MVC from here :https://auth0.com/docs/quickstart/webapp/aspnet-owin) but same code when i am trying to implement in umbraco8 solution is not working .
Can you please help me how i can acheive auth0 intergation in umbraco 8 . I want to open in-built login window of auth0.
below is code snippet :
public class CustomOwinStartup : UmbracoDefaultOwinStartup { public override void Configuration(IAppBuilder app) {
// Call the authentication configration process (located in App_Start/Startup.Auth.cs) ConfigureAuth(app); // Hook up Auth0 controller RouteTable.Routes.MapRoute( "Account", "Account/{action}", new { controller = "Account" } ); // Let Umbraco do its thing base.Configuration(app); } private void ConfigureAuth(IAppBuilder app) { // Configure Auth0 parameters string auth0Domain = ConfigurationManager.AppSettings["auth0:Domain"]; string auth0ClientId = ConfigurationManager.AppSettings["auth0:ClientId"]; string auth0ClientSecret = ConfigurationManager.AppSettings["auth0:ClientSecret"]; string auth0RedirectUri = ConfigurationManager.AppSettings["auth0:RedirectUri"]; string auth0PostLogoutRedirectUri = ConfigurationManager.AppSettings["auth0:PostLogoutRedirectUri"]; // Enable Kentor Cookie Saver middleware app.UseKentorOwinCookieSaver(); // Set Cookies as default authentication type app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = CookieAuthenticationDefaults.AuthenticationType, LoginPath = new PathString("/Account/Login") }); // Configure Auth0 authentication app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions { AuthenticationType = "Auth0", Authority = $"https://{auth0Domain}", ClientId = auth0ClientId, ClientSecret = auth0ClientSecret, RedirectUri = auth0RedirectUri, PostLogoutRedirectUri = auth0PostLogoutRedirectUri, ResponseType = OpenIdConnectResponseType.CodeIdToken, Scope = "openid profile", TokenValidationParameters = new TokenValidationParameters { NameClaimType = "name" }, Notifications = new OpenIdConnectAuthenticationNotifications { RedirectToIdentityProvider = notification => { if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Logout) { var logoutUri = $"https://{auth0Domain}/v2/logout?client_id={auth0ClientId}"; var postLogoutUri = notification.ProtocolMessage.PostLogoutRedirectUri; if (!string.IsNullOrEmpty(postLogoutUri)) { if (postLogoutUri.StartsWith("/")) { // transform to absolute var request = notification.Request; postLogoutUri = request.Scheme + "://" + request.Host + request.PathBase + postLogoutUri; } logoutUri += $"&returnTo={ Uri.EscapeDataString(postLogoutUri)}"; } notification.Response.Redirect(logoutUri); notification.HandleResponse(); } return Task.FromResult(0); } } }); }
}
What is the error/issue you are getting/facing ?
If we download code of auth0 from below link : https://auth0.com/docs/quickstart/webapp/aspnet-owin
And implement same auth0 code in umbraco 8 then it is not working .
I have tried to find lot about how we can integrate auth0 in umbraco 8 but no help .
So i have downloaded the code from auth0 site and implemented in umbraco 8.
But when i am calling login method inside account controller then it is not redirecting to auth0 .
public class AccountController : RenderMvcController { public ActionResult Login(string returnUrl) { HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = returnUrl ?? Url.Action("Login", "Account") }, "Auth0"); return new HttpUnauthorizedResult(); }
[Authorize] public void Logout() { HttpContext.GetOwinContext().Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType); HttpContext.GetOwinContext().Authentication.SignOut("Auth0"); } [Authorize] public ActionResult Claims() { return View(); } }
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Auth0 in umbraco8
I am working with umbraco 8 and working with auth0 integration . The code that is working fine with simple asp.net MVC application with openid connect(downloaded code for MVC from here :https://auth0.com/docs/quickstart/webapp/aspnet-owin) but same code when i am trying to implement in umbraco8 solution is not working .
Can you please help me how i can acheive auth0 intergation in umbraco 8 . I want to open in-built login window of auth0.
below is code snippet :
public class CustomOwinStartup : UmbracoDefaultOwinStartup { public override void Configuration(IAppBuilder app) {
}
What is the error/issue you are getting/facing ?
If we download code of auth0 from below link : https://auth0.com/docs/quickstart/webapp/aspnet-owin
And implement same auth0 code in umbraco 8 then it is not working .
I have tried to find lot about how we can integrate auth0 in umbraco 8 but no help .
So i have downloaded the code from auth0 site and implemented in umbraco 8.
But when i am calling login method inside account controller then it is not redirecting to auth0 .
public class AccountController : RenderMvcController { public ActionResult Login(string returnUrl) { HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = returnUrl ?? Url.Action("Login", "Account") }, "Auth0"); return new HttpUnauthorizedResult(); }
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.