asp.net-core-3.1

Identity with ASP.Net Core 3.1 - on not authenticated, the app is not redirecting to Login in production like it does in dev

夙愿已清 提交于 2021-02-11 06:16:43
问题 I have an ASP.Net Core (3.1) web app that takes advantage of Identity. It works as desired on my dev box, but does not redirect to login in production. Let me explain. I have a home/landing page with links to actions all over it. If a user clicks on an action that requires Authentication (I am using the [Authorize] tag to specify that in my controller), then the app should redirect to the Login page to allow the user to login first and then redirect to the desired action that they click. This

Identity with ASP.Net Core 3.1 - on not authenticated, the app is not redirecting to Login in production like it does in dev

 ̄綄美尐妖づ 提交于 2021-02-11 06:16:24
问题 I have an ASP.Net Core (3.1) web app that takes advantage of Identity. It works as desired on my dev box, but does not redirect to login in production. Let me explain. I have a home/landing page with links to actions all over it. If a user clicks on an action that requires Authentication (I am using the [Authorize] tag to specify that in my controller), then the app should redirect to the Login page to allow the user to login first and then redirect to the desired action that they click. This

Identity with ASP.Net Core 3.1 - on not authenticated, the app is not redirecting to Login in production like it does in dev

假如想象 提交于 2021-02-11 06:16:03
问题 I have an ASP.Net Core (3.1) web app that takes advantage of Identity. It works as desired on my dev box, but does not redirect to login in production. Let me explain. I have a home/landing page with links to actions all over it. If a user clicks on an action that requires Authentication (I am using the [Authorize] tag to specify that in my controller), then the app should redirect to the Login page to allow the user to login first and then redirect to the desired action that they click. This

asp.net core 3.1 getting current identity user within stripe HttpPost(“webhook”) returns NULL

旧街凉风 提交于 2021-02-10 16:15:48
问题 I've integrated stripe checkout payments in my website according to stripe's example Everything works fine. I could verify webhooks are working with stripe CLI and also using ngrok, tunneling my localhost . Now I've started implementing interaction with the identity database. I wanto to store there the stripe session.CustomerId after the webhook has fired checkout.session.completed . For that I need to access my Identity database. My code is: [HttpPost("webhook")] public async Task

asp.net core 3.1 getting current identity user within stripe HttpPost(“webhook”) returns NULL

霸气de小男生 提交于 2021-02-10 16:13:19
问题 I've integrated stripe checkout payments in my website according to stripe's example Everything works fine. I could verify webhooks are working with stripe CLI and also using ngrok, tunneling my localhost . Now I've started implementing interaction with the identity database. I wanto to store there the stripe session.CustomerId after the webhook has fired checkout.session.completed . For that I need to access my Identity database. My code is: [HttpPost("webhook")] public async Task

Invalid Token - The audience 'empty' is invalid

走远了吗. 提交于 2021-02-10 15:43:09
问题 I have the following Identity Server 4 configuration on ASP.NET Core 3.1 projects: services .AddIdentityServer(y => { y.Events.RaiseErrorEvents = true; y.Events.RaiseInformationEvents = true; y.Events.RaiseFailureEvents = true; y.Events.RaiseSuccessEvents = true; }) .AddDeveloperSigningCredential() .AddInMemoryPersistedGrants() .AddInMemoryIdentityResources(Config.IdentityResources()) .AddInMemoryApiResources(Config.ApiResources()) .AddInMemoryApiScopes(Config.GetApiScopes())

Invalid Token - The audience 'empty' is invalid

余生长醉 提交于 2021-02-10 15:41:56
问题 I have the following Identity Server 4 configuration on ASP.NET Core 3.1 projects: services .AddIdentityServer(y => { y.Events.RaiseErrorEvents = true; y.Events.RaiseInformationEvents = true; y.Events.RaiseFailureEvents = true; y.Events.RaiseSuccessEvents = true; }) .AddDeveloperSigningCredential() .AddInMemoryPersistedGrants() .AddInMemoryIdentityResources(Config.IdentityResources()) .AddInMemoryApiResources(Config.ApiResources()) .AddInMemoryApiScopes(Config.GetApiScopes())

Unable to access HTTP request body content in ASP.NET Core 3.1 exception handler

独自空忆成欢 提交于 2021-02-10 14:58:36
问题 It seems .NET Core 3.1 makes it very difficult to access the raw HTTP request body following an exception The core of the issue seems to be you can't rewind the stream to the beginning so the whole thing can be read In the below sample the output is: Content-Length: 19 Can't rewind body stream. Specified method is not supported. Body: If I remove the Seek, there's no exception, but of course the body comes back as an empty string, because it's already been processed There is some new plumbing

How do I make and use JWT role based authentication?

十年热恋 提交于 2021-02-08 09:58:01
问题 I follow the tutorial link below. https://fullstackmark.com/post/13/jwt-authentication-with-aspnet-core-2-web-api-angular-5-net-core-identity-and-facebook-login I am trying to understand how it works and I want to use role-based authentication using this token. so I made another policy in the Startup.cs file as below. And I tried to use it like [Authorize(Policy = "admin")] or [Authorize(Policy = "ApiUser")] in the controller but every time I try I get unauthenticated using postman . What am

How do I make and use JWT role based authentication?

帅比萌擦擦* 提交于 2021-02-08 09:57:29
问题 I follow the tutorial link below. https://fullstackmark.com/post/13/jwt-authentication-with-aspnet-core-2-web-api-angular-5-net-core-identity-and-facebook-login I am trying to understand how it works and I want to use role-based authentication using this token. so I made another policy in the Startup.cs file as below. And I tried to use it like [Authorize(Policy = "admin")] or [Authorize(Policy = "ApiUser")] in the controller but every time I try I get unauthenticated using postman . What am