ASP.Net Core MVC IdentityFrameWork Not Working - authentication

I have an ASP.Net Core MVC application which uses IdentityFrameworkCore for the login which seems to work fine but I can access other web pages without login in by typing the URL in.
Also it is loading my _Layout page with my login page showing menu items.
Can someone please help on how I call my login page without _Layout and how do I prevent users from bypassing the login.
Many Thanks,

Related

.NET Core 5.0 error 400 after redirected to login page from Quickbooks OAuth, issue resolves if i revisit the Url by pressing enter

I have a .NET Core 5.0 application which authenticates & integrates Quickbooks with OAuth and then redirects to the application login page. When I click login, I get an http 400 error and cookie for ASP.NET Core Identity is not created, yet but if select the url and press enter then it just works fine, anybody has any suggestions on this?
I tried a couple of things like adding authorize in that controller form where I am redirecting and also tried several cookie settings I found but nothing worked so far

Auth0 Gmail SS0 doesn't work when I enable Customize Login Page (using auth0 asp.net mvc sample)

This is my ASP.NET MVC sample
Now I'm clicking log in button and it redirects me to the Auth0 custom login page
Now, I'm clicking login with the google button and I already signed in to my Gmail account but it doesn't bring token, and no redirection
URL : https://ishkyteck.us.auth0.com/login?state=hKFo2SBJRWVZQ1F2dk1WeW91Ry1sdVh2SklnQWhVemZjdS1YcKFupWxvZ2luo3RpZNkgb1FGXzRoYjR5a2phTmU2dUNEMGFUcmk0YXN4a1dRYjmjY2lk2SBTbjdld3VBcWk4Y3JyWFVTcjQ2bkYxSEJHZmF2VGl0cg&client=Sn7ewuAqi8crrXUSr46nF1HBGfavTitr&protocol=oauth2&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F&response_type=code%20id_token%20token&scope=openid%20profile&response_mode=form_post&nonce=637732441711041622.NjQ3MWUxZTYtMTM4Yy00OTQ1LWEyMzUtMTBmN2Y5NjQ5OWVkMzNjYjllMTItNTMwYi00NmIyLWIyMzEtNTY0MjQzNDk1ODll&audience=https%3A%2F%2Fishkyteck.us.auth0.com%2Fapi%2Fv2%2F&x-client-SKU=ID_NET461&x-client-ver=6.7.1.0
and it hits the AuthorizationCodeReceived method but does not bring the token
Please, auth0 community developer look into this bug and resolve. I'm using your provided asp.net MVC sample but it doesn't work.
Sample I downloaded from : https://github.com/auth0-samples/auth0-aspnet-owin-mvc-samples/tree/master/Quickstart/01-Login/MvcApplication
Please help me. Thank you!!
Issue reproducing sample (my auth0 Gmail SSO sample),
https://drive.google.com/file/d/1aHXDCLZjcXth2u1KzON7hhhzKOIv6B0b/view?usp=sharing
When I enable this button, Gmail login does not work in the auth0 universal custom login page
auth0 custom universal login page

How can i have customized SPA login page in Identity Server (duende identityserver)

I'm looking for a way to have a customized SPA (react/angular) login page beside of my Duende Identity Server API (developed in ASP.NET 6.0)
I googled it all day and just i found this article:
https://medium.com/#piotrkarpaa/using-spa-react-angular-ui-with-identity-server-4-dc1f57e90b2c
Which is not working...
Okay, so I ran into same situation few days ago, and it was sorted out in a tricky way. And also I landed on this same article you mentioned.
Duende IdentityServer comes with .cshtml pages. The frontend developer designed the same login page (as of reactjs frontend) in .cshtml and inserted that in IdentityServer's login page. Afterwards the workaround was. When user lands on reactjs login page. It automatically redirects to IdentityServer's login page. Though it is not the best approach but a work around that solved our problem.
Background;
Microservices project
.net 6 api (backend)
reactjs (frontend)
Duende IdentityServer 6 for authentication
I hope this helps you out. Goodluck :)

Asp.Net core Individual User Authentication Login/Register Pages

I am new to Asp.net core razor pages. I am using asp .net core version 2.2, I am trying to make an application using Social Media authentication services. But the problem I am facing is the weird structure of asp .net core razor applications. I have already done the authentication things, but the problem I am facing is to find the Login and Registration pages. Where can we find them? What if we want to change the layout or something. What should we do for that?
Depending on how you implemented authorization, and based on the documentation :
You should be able to find the scaffolded views in the Areas\Identity's folder of your project or in the ~/Pages/ folder.
If you want to change the layout or something else, you can edit those views (customize) and/or create other ones.
Don't forget to generate the scaffolded views using :
From Solution Explorer, right-click on the project > Add > New Scaffolded Item
Hope it helps.
The default scaffolded Razor pages in ASP.NET Core are made using Partial Views. The default layout of the applicaton can be found in Pages/Shared/_Layout.cshtml.
Inside of this file there is a reference to Pages/Shared/_LoginPartial.cshtml , which contains the layout for the login page. The reference should be somewhere around line 35 in the _Layout.cshtml.
If you want to edit the way the default Razor pages look, this is where you do it.

Issue with rending an MVC 4 website inside an iFrame

We have an existing live MVC 4 website that works exactly as it supposed to, running in an Azure Web Role.
A third party want to embed our site in an iFrame on their site (a small part of it anyway, one form really)
I'm no fan of iFrames but this is what they want to do and our business are happy for them to do it.
Except it doesn't seem to work at all.
So I tested it myself with an html page just running on my machine.=, with just an iFrame and a link to the site.
The default page loads fine. It is a forms login screen, when I submit a login, the site crashes into the exception handing and it doesn't provide much useful information.
I then tried pointing the iFrame at the site running in my dev environment. Submitting the login and debugging into the action, the code flows through correctly, no error and tries to return the correct view, but iframe refreshes to the login screen again.
What could be causing this? What am I missing?