Is there an existing issue for this?
What happened?
I am using a module to delegate auth on azure AD (https://github.com/davidjrh/dnn.azureadprovider).
When some users try to login i get an error "Cannot insert duplicate key row in object 'dbo.UserAuthentication' with unique index 'IX_UserAuthentication'. The duplicate key value is (123, Azure). The statement has been terminated.". This only manifests with two users of my portal.
I do not see a way of this error happening as it is checked in the previous line:
|
var dnnAuthToken = MembershipProvider.Instance().GetUserByAuthToken(settings.PortalId, token, this.Service); |
// user already exists... lets check for a token next...
var dnnAuthToken = MembershipProvider.Instance().GetUserByAuthToken(settings.PortalId, token, this.Service);
if (dnnAuthToken == null)
{
DataProvider.Instance().AddUserAuthentication(objUserInfo.UserID, this.Service, token, objUserInfo.UserID);
}
I actualy see in the database table ([UserAuthentication]) the rows with the correct UserIDs and UserNames (tokens) for the users that cannot login.
I am focusing on this code as the stack trace points to it.
I am looking for any ideas that might help diagnose this strange behaviour.
Steps to reproduce?
Unable to reproduce localy due to infrastructure complexity
Current Behavior
No response
Expected Behavior
No response
Relevant log output
AbsoluteURL:/Default.aspx
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:37166c6b-5a92-4196-8468-c7e52e0ed75f
RawUrl:/login?code=1.AUcAUeKEmhJgH****jB
Referrer:https://login.microsoftonline.com/
Message:Cannot insert duplicate key row in object 'dbo.UserAuthentication' with unique index 'IX_UserAuthentication'. The duplicate key value is (123, Azure). The statement has been terminated.
StackTrace:
InnerMessage:Cannot insert duplicate key row in object 'dbo.UserAuthentication' with unique index 'IX_UserAuthentication'. The duplicate key value is (123, Azure). The statement has been terminated.
InnerStackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at PetaPoco.Database.CommandHelper(IDbCommand cmd, Func`2 executionFunction)
at PetaPoco.Database.ExecuteScalarInternal[T](CommandType commandType, String sql, Object[] args)
at DotNetNuke.Data.PetaPoco.PetaPocoHelper.ExecuteScalar[T](String connectionString, CommandType type, Int32 timeoutSec, String sql, Object[] args)
at DotNetNuke.Data.SqlDataProvider.ExecuteScalar[T](String procedureName, Object[] commandParameters)
at DotNetNuke.Services.Authentication.OAuth.OAuthClientBase.AuthenticateUser(UserData user, PortalSettings settings, String ipAddress, Action`1 addCustomProperties, Action`1 onAuthenticated)
at DotNetNuke.Authentication.Azure.Components.AzureClient.AuthenticateUser(UserData user, PortalSettings settings, String IPAddress, Action`1 addCustomProperties, Action`1 onAuthenticated)
at DotNetNuke.Services.Authentication.OAuth.OAuthLoginBase.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.<LoadRecursiveAsync>d__246.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Util.WithinCancellableCallbackTaskAwaitable.WithinCancellableCallbackTaskAwaiter.GetResult()
at System.Web.UI.Page.<ProcessRequestMainAsync>d__523.MoveNext()
Source:
FileName:
FileLineNumber:0
FileColumnNumber:0
Method:
Anything else?
No response
Affected Versions
10.3.2 (latest release)
What browsers are you seeing the problem on?
No response
Code of Conduct
Is there an existing issue for this?
What happened?
I am using a module to delegate auth on azure AD (https://github.com/davidjrh/dnn.azureadprovider).
When some users try to login i get an error "Cannot insert duplicate key row in object 'dbo.UserAuthentication' with unique index 'IX_UserAuthentication'. The duplicate key value is (123, Azure). The statement has been terminated.". This only manifests with two users of my portal.
I do not see a way of this error happening as it is checked in the previous line:
Dnn.Platform/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs
Line 192 in abd7477
I actualy see in the database table ([UserAuthentication]) the rows with the correct UserIDs and UserNames (tokens) for the users that cannot login.
I am focusing on this code as the stack trace points to it.
I am looking for any ideas that might help diagnose this strange behaviour.
Steps to reproduce?
Unable to reproduce localy due to infrastructure complexity
Current Behavior
No response
Expected Behavior
No response
Relevant log output
Anything else?
No response
Affected Versions
10.3.2 (latest release)
What browsers are you seeing the problem on?
No response
Code of Conduct