neozhu / CleanArchitectureWithBlazorServer

This is a repository for creating a Blazor Server dashboard application following the principles of Clean Architecture
https://architecture.blazorserver.com/
MIT License
816 stars 221 forks source link

Problem with authentication #414

Closed BogdanJak closed 1 year ago

BogdanJak commented 1 year ago

Hello

Gentlemen, please help me

Attached is a code sample with your modified application. I don't know where I'm making a mistake but after starting the application, the login page or home page does not open. You can see where the error is. I don't feel very confident in authentication processes. I can't draw any more. OrganizerPRO.zip

neozhu commented 1 year ago

@BogdanJak I would strongly advise against modifying the namespaces of this project, including the "ApplicationDbContext". There are too many parts that require refactoring, which means you will need to invest significant time in debugging and fixing issues. Moreover, I haven't done testing in this regard. Please reconsider your approach.

Bram1903 commented 1 year ago

@BogdanJak,

As follow up to Neozhu his response, refactoring the namespaces and other important classes within this project is quite difficult. I have done so myself, but it takes a lot of refactoring and debugging in order to get everything to work properly again. Even when you think everything is working again, some things may still not function properly.

Besides that, I'm not going to download a random .zip file to check your code. You are better of pushing that code to your own respority, and then sent us a link to that respority, from a security point of view.

Kind regards, Bram

BogdanJak commented 1 year ago

I don't mind the naming. However, I have an aversion to MudBlazor. The sole purpose of my attempt to rework your design is to eliminate MudBlazor entirely and replace it with Syncfusion controls. Unfortunately, I am doing something wrong because on a different version (after removing all references to MudBlazor) I also stop at the same stage, i.e. the login page does not start.

Bram1903 commented 1 year ago

I don't mind the naming. However, I have an aversion to MudBlazor. The sole purpose of my attempt to rework your design is to eliminate MudBlazor entirely and replace it with Syncfusion controls. Unfortunately, I am doing something wrong because on a different version (after removing all references to MudBlazor) I also stop at the same stage, i.e. the login page does not start.

Well, I mean, we built our login screen in MudBlazor, so you'll have to rewrite that page if you removed MudBlazor?

BogdanJak commented 1 year ago

I have a login page rewritten :-). Everything worked until I removed references to MudBlazor from ConfigureServices.cs to be exact

//services.AddMudBlazorDialog(); //services.AddMudServices(config => //{ // config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomRight; // config.SnackbarConfiguration.PreventDuplicates = false; // config.SnackbarConfiguration.NewestOnTop = true; // config.SnackbarConfiguration.ShowCloseIcon = true; // config.SnackbarConfiguration.VisibleStateDuration = 4000; // config.SnackbarConfiguration.HideTransitionDuration = 500; // config.SnackbarConfiguration.ShowTransitionDuration = 500; // config.SnackbarConfiguration.SnackbarVariant = Variant.Filled; //}); //services.AddMudExtensions();

Bram1903 commented 1 year ago

So just to be clear, you have rewritten the login page, which was working fine with the new rewrite, until you removed those mud services from the services pipeline?

BogdanJak commented 1 year ago

exactly. After restoring these lines - the login page starts correctly.

Bram1903 commented 1 year ago

@neozhu Would you have any idea why the login page might not function after removing the MudBlazorDialog or MudExtension?

BogdanJak commented 1 year ago

I played a bit with different settings and exactly disabling this fragment causes the lack of entering the login page

//services.AddMudServices(config => //{ // config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomRight; // config.SnackbarConfiguration.PreventDuplicates = false; // config.SnackbarConfiguration.NewestOnTop = true; // config.SnackbarConfiguration.ShowCloseIcon = true; // config.SnackbarConfiguration.VisibleStateDuration = 4000; // config.SnackbarConfiguration.HideTransitionDuration = 500; // config.SnackbarConfiguration.ShowTransitionDuration = 500; // config.SnackbarConfiguration.SnackbarVariant = Variant.Filled; //});

neozhu commented 1 year ago

@neozhu Would you have any idea why the login page might not function after removing the MudBlazorDialog or MudExtension?

Yes, I did use the Password TextInput control, which is part of MudExtension. Therefore, you need to replace all the TextInput controls, which is indeed a significant task.

BogdanJak commented 1 year ago

I don't have such a control on the Login.razor page. All listed with Syncfusion controls.

Below is the code of the Login.razor page

` @page "/pages/authentication/login" @inject AccessTokenProvider TokenProvider @inject IJSRuntime JS @inject ILocalizationService LOC

@inherits OwningComponentBase @using Infrastructure.Services.JWT @using Microsoft.AspNetCore.DataProtection @using Application.Common.Security @using Application.Constants.Role @using Application.Constants.User @using OrganizerPRO.Pages.Identity.Users @using Application.Common.ExceptionHandlers

@implements IDisposable

Login

@LOC["Global_Login"]

@LOC["Global_Sign_up"]
@LOC["Global_Forgot_Pass"]
@ConstantString.Microsoft @ConstantString.Google

@code {

public Syncfusion.Blazor.Inputs.InputType passtype = Syncfusion.Blazor.Inputs.InputType.Password;
SfTextBox? _passTxt;
public string Title = "Sign In";  

} `

BogdanJak commented 1 year ago

Here is the link to my repository

https://github.com/BogdanJak/OrganizerPRO

If I remove the fragment >autostart="false"< from the following script - the login page is opened. However, the token is probably not saved - because I have to log in every time I start the application.

BogdanJak commented 1 year ago

Silence

Bram1903 commented 1 year ago

Silence

I mean, we are all extremely busy with our actual job, and besides that are trying to properly maintain this reposrity. We don't just have the time to take a look at someone else their custom codebase which doesn't work, and neither should you expect that from us. Maybe once someone has the time they will take a look, but since we are extremely busy it doesn't have a high priority.

BogdanJak commented 1 year ago

There is no sign of MudBlazor - everything works fine. I replaced everything via Syncfusion controls. Syncfusion color themes - great thing.

neozhu commented 1 year ago

@BogdanJak Syncfusion isn't free, right?

Bram1903 commented 1 year ago

Inactive