And ultimately never logs in.
After coding and modifying a console app as provided in one of the examples, I can authenticate to On-Prem Windows Server AD.
Here's the working code for the console app, slightly modified. Note using static LdapForNet... was necessary and all LdapForNet.Native was required.
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using LdapForNet;
using LdapForNet.Native;
using static LdapForNet.Native.Native;
/**********************
cmd to find logon DC
systeminfo | find /i "logon server"
distinguished name (DN) = CN=Doe\, Michael,OU=DEVELOPERS,OU=MarketSt,OU=MYOU,DC=mydomain,DC=local (DN ldap entry for Michael Doe)
Filter example: ds.Filter = "(&(objectCategory=User)(objectClass=person)(name=" + userName + "*))";
********************/
namespace LDAPTester
{
public class Program
{
static async Task Main(string[] args)
{
var server = "10.10.10.11";
var serverPort = 389;
var baseDc = "OU=users,DC=mydomain,DC=local";
using (var cn = new LdapConnection())
{
try
{
cn.Connect("ldap://10.10.10.11:389");
// bind using userdn and password
cn.Bind(LdapAuthMechanism.SIMPLE, "mydomain\\michaeldoe", "Password111444");
var entries = cn.Search("DC=mydomain,DC=local", "(&(objectCategory=user)(objectClass=person) (sAMAccountName=michaeldoe))").Take(10);
foreach (var entry in entries)
{
var x = entry;
// key/value pairs of attributes directoryAttributes are the LDAP //field category names, givenName, surName etc.
var de = x.ToDirectoryEntry();
Console.WriteLine(entry);
//Debug.WriteLine(x.Dn["name"][0].ToString());
}
string s = "";
}
catch (Exception exception)
{
string msg = exception.Message;
bool stopHere = true;
}
}
```
Thank you for the quick reply. NO: Not using IIS\WINDOWS authentication.
2. protected virtual async Task<string> NormalizeUserNameAsync(string userName)
{
string usertoLogin=$"mydomain\\{userName}, {await LdapSettingProvider.GetBaseDcAsync()}";
return usertoLogin;
// not used: return $"uid={userName}, {await LdapSettingProvider.GetBaseDcAsync()}";
}
When I login with the built-in admin account:
OpenLdapManager calls ConnectAsync
schema var gets set to LDAP
Next,`ldapConnection.Connect(await LdapSettingProvider.GetServerHostAsync(), await LdapSettingProvider.GetServerPortAsync(), schema);` is called.
I expect this to fail, of course. I get an invalid username and password. The login does not fall back to a local ABP account. Can't login at all.
Next. trying a domain account in format mydomain\myusername and I get further:
In Method DetermineProviderCultureResult(HttpContext httpContext)
and I get to this point:
`string returnUrl = request.Query[ReturnUrl]; // this is empty.
if (returnUrl.IsNullOrWhiteSpace())
{
return await NullProviderCultureResult;
}`
action returns and same message invalid username and password.
At some point the code keeps moving along and I get the authservermodule
`.AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, options =>
{
//Personal Microsoft accounts as an example.
options.AuthorizationEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize";
options.TokenEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";
options.ClaimActions.MapCustomJson("picture", _ => "https://graph.microsoft.com/v1.0/me/photo/$value");
options.SaveTokens = true;
})`
Another issue is it seems the AD being looked for is some generic AD, not windows AD. Many code changes for AD had to be made to finally authenticate. Even then, it seems something is missing. Shouldn't be this much work.
Where in code do we start?
If you want automatic user creation on first login
Use the same logic in the login callback (after AD validation) to create the ABP IdentityUser record the first time that AD user signs in.
Using ABP 8.3.3. Have not yet upgraded to the latest 10 version due to breaking changes. Currently on ABP Enterprise subscription.
Provide us with the following info:
🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.
ABP Framework version: v8.2 UI Type: Blazor (MAUI) Database System: EF Core (SQL Server) Tiered (for MVC) or Auth Server Separated (for Angular): No
Exception message and full stack trace: There is no specific exception message, but modals fail to render after launching and trying to add a user for example.
Steps to reproduce the issue: Create a new MAUI Blazor project from ABP Studio NO Mobile App. Use SQL Server. This is a Tiered Non-Layered project. Set the HOST project and the Maui Project as startups. Run the application. Attempt to open a modal dialog (e.g., through a button click or any other trigger). Shade appears, but the modal does not.
Ran this command Abp bundle -t maui-blazor and it fails with unsupported project type. must be Microsoft.NET.Sdk.BlazorWebAssembly.
Thanks for looking into this.
NOTE: You May also have to fix up the Splash error know for Blazor apps. I added <MauiImage Update="Resources\Images\splash.svg" BaseSize="168,168"> to the MauiBlazor .csproj file and I copied to splash.svg to the resources\images folder.
Correction: Version is 8.3.2 ABP and 0.9.2 Studio
Hi, can you try to install the related module with source code via ABP Studio (https://abp.io/docs/latest/studio/solution-explorer#replace-with-source-code)?
If you look at the first part of my problem, that is exactly what I did. And that is what causes the problem. Thanks for looking into this.
Create a project using ABP studio 0.9.1 and ABP 8.3.1 Add the Volo.AuditLogging.Ui source from the ABP Suite Launcher in ABP Studio. Try to build. Project fails. The Binaries in Contract get doubled up.
Create a command line MVC project using ABP make it an MVC with sql server project.
Specify version 8.3.1
Launch the project in VS 2022 and it should build successfully. Launch Migrations: OK.
Open ABP Suite with command abp suite.
Install the module source abp add-module Volo.AuditLogging.Ui using the add as project button.
Source Code Installs. Build: OK. Launch and use Audit Logging: OK.
The Studio version Installs 2 packages. Volo.AuditLogging.Pro and another Package Volo.AuditLogging.Ui
whereas the ABP Studio version seems to correctly install only the needed source module Volo.AuditLogging.UI.
Even right clicking and installing a module source from ABP Studio causes the wrong solution source to get pulled down and embedded in the project.
Create an ABP MVC project in ABP Studio 0.9.1 and use ABP Suite from within Studio to add CMSKit Pro Source Code. Attempt to ADD an FAQ. FAQ Group is required. FAQ Group presents as an Empty dropdown list. There is no way to add a group. No group, no FAQ.
In addition, codemirror script is missing from wwwroot/libs. Pages in CMS Kit Pro cannot be edited without CodeMirror.css and .js files. I Retrieved the files from codemirror.net
Next, I installed a brand new project, Chose CMS KIT PRO as well. No source code. Right out of the box, no way to add Group for FAQ. This used to work in a previous version.
This is a serious issue for us. Thanks for your quick support.
****** BUG in Code Module ********
Create a project using ABP Studio 0.9.1 and ABP Suite 8.3.1
Add the source for Account to the project.
Volo.Abp.Account.Pro.Public.MauiBlazor project fails to build.
Build the source and this code section causes a build failure.
var scheme = callbackUri.Scheme; if(scheme = "http" || scheme == "https")
Project fails to build because the left side of the comparison expression is missing an "=" symbol.
I corrected the code to: if(scheme == "http" || scheme == "https")
and the project builds correctly.