This is still an issue with 4.6.2. The changes I made are listed bellow to work around it. Just a recap of why these changes are needed:
- When a user is created through AD, the password is not valid, so a call to GetUser which relies on username and password will fail.
- Because it fails, the system will try to create a user, however the username already exists which creates an issue. In my case, it goes into an endless loop of authentication and rejection.
- I have not tested this against a mixed login environment. Mine is purely AD based with no forms login.
A current issue with the authentication provider method is that when you get down to the level of CreateUser in the AspNetMembershipProvider, you have no idea which provider sent you there. I think all of them need to include a DotNetNuke.Services.Authentication.AuthenticationController.SetAuthenticationType call.
DotNetNuke.Authentication.ActiveDirectory.UserController
Public Function AddDNNUser(ByVal AuthenticationUser As UserInfo) As UserCreateStatus
Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings
Dim objSecurity As New PortalSecurity
DotNetNuke.Services.Authentication.AuthenticationController.SetAuthenticationType("ActiveDirectory")
<snip>
DotNetNuke.Security.Membership.AspNetMembershipProvider
Public Overrides Function CreateUser(ByRef user As UserInfo) As UserCreateStatus
Dim createStatus As UserCreateStatus
Dim authType As DotNetNuke.Services.Authentication.AuthenticationInfo = DotNetNuke.Services.Authentication.AuthenticationController.GetAuthenticationType()
Dim isADSIProvider As Boolean = False
Dim ProviderTypeName As String = String.Empty
If Not authType Is Nothing Then ProviderTypeName = authType.AuthenticationType
isADSIProvider = (ProviderTypeName.IndexOf("ActiveDirectory") >= 0) Or (ProviderTypeName.IndexOf("Authentication.ADSIProvider") >= 0)
Try
' check if username exists in database for any portal
Dim objVerifyUser As UserInfo = GetUserByUserName(Null.NullInteger, user.Username, False)
If Not objVerifyUser Is Nothing Then
If objVerifyUser.IsSuperUser Then
' the username belongs to an existing super user
createStatus = UserCreateStatus.UserAlreadyRegistered
Else
' the username exists so we should now verify the password
If isADSIProvider Or ValidateUser(objVerifyUser.PortalID, user.Username, user.Membership.Password) Then
<snip>