jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Login Controller

ahmedshahjr opened this issue · comments

i was wondering where is login controller in webapi project?
the login controller is missing there or how to import identitylogin service in webapi

You can also check my repository. I added LoginController to webapi project.
iayti/CleanArchitecture
have a nice coding 😊

@amedouardi in which layer ?

@amedouardi in which layer ?

you can keep it as it is in WebUi=>Areas=>Identity=>Pages=>Account. unless you are ready to create your own controllers with the same logic used in *.chtml.cs (heavy task but can be done).

You can also check my repository. I added LoginController to webapi project. iayti/CleanArchitecture have a nice coding 😊

your folder isn't the same as the main repo. did you start from scratch on that one?

you could use this in the startup.cs

services.AddDefaultIdentity<ApplicationUser>(options =>
            {
                options.SignIn.RequireConfirmedAccount = true;
                options.Password.RequireDigit = true;
                options.Password.RequiredLength = 8;
            }).AddRoles<IdentityRole>()
            .AddEntityFrameworkStores<ApplicationDbContext>();
        services.AddIdentityServer().AddApiAuthorization<ApplicationUser, ApplicationDbContext>();
        services.AddAuthentication().AddIdentityServerJwt();

I know this is very old, but just in case this helps someone else: there is no login controller. As mentioned above you should scaffold identity and view the code generated. This code will interact with Identity UserManager within Razor pages. You can use this code as a very good example that can be the basis of a login controller that you build.