Open Closed

windows Authentication #6204


User avatar
0
s.alshammari.c created
  • ABP Framework version: v7
  • UI Type: Angular
  • Database System: EF Core (SQL Server)

how to implement windows Authentication in ABP suite

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

22 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We have a sample pull reqeust.

    https://github.com/abpframework/abp/pull/8419

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    I added context.Services.Configure<IISServerOptions>(iis => { iis.AuthenticationDisplayName = "Windows"; iis.AutomaticAuthentication = false; });

    but still, this button is not showing

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You also need to configure the Windows authentication.

    Services.AddAuthentication

    https://learn.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    I want automatic login is that possible or do I must press windows button and then register by email ?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can override the public virtual async Task<IActionResult> OnGetAsync() of the Login page.

    This is the same as you click the Windows button.

    public override async Task<IActionResult> OnGetAsync()
    {
        var redirectUrl = Url.Page("./Login", pageHandler: "ExternalLoginCallback", values: new { ReturnUrl, ReturnUrlHash, });
        var properties = SignInManager.ConfigureExternalAuthenticationProperties("Windows", redirectUrl);
        properties.Items["scheme"] = "Windows";
    
        return await Task.FromResult(Challenge(properties, provider));
    }
    

    See the sign in code

    https://github.com/search?q=repo%3Aabpframework%2Fabp%20ProcessWindowsLoginAsync&type=code

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    can I send you my code ? provide me your email please

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can share a simple project. liming.ma@volosoft.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    its a fresh project can you just implement it and share it with me please

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    ok, What's your email?

    I will use OpenIddict as auth server.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    hi saudalshammari2030@gmail.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Sent. The key code is src\BookStore.Web\MyLoginModel.cs

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    I didn't receive anything on my email yet (already checked spam etc..). can you make sure that its sent please? I sent you an email reply to it with the project please

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I sent it again.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    still I have to register by email , what I need is to integrate it with the active directory so once someone open the website it automatically log in

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can debug to check this, and make sure the email claim exists in it.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    no email claim exist , I only got the name. should I add this id.AddClaim(new Claim(ClaimTypes.Email,result.Principal.FindFirstValue(ClaimTypes.Email))); ?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    no email claim exist

    You can find a way to get an email from result.Principal or add a random email claim to id.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    inside result.Principal about 22 claims first one is "Name" and "PrimarySid" and all others are "groupsid" , there is no email claim

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    hi

    no email claim exist

    You can find a way to get an email from result.Principal or add a random email claim to id.

    I did this and here is what I got

    is there a way to bypass register page ? I want everything to run in background and user automatically log in.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Try to use the AbpClaimTypes.Email as the claim type.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    thank you , now it works but user still need to press login button in order to login . is there a way to auto login on website enter

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Add redirect to your index page.

    if (!CurrentUser.IsAuthenticated)
    {
        return Redirect("/account/login); 
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 24, 2026, 12:09
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.