如何解决Spring LDAP Basic Auth 缓存一些客户端而不是其他客户端
我正在使用 Private Sub OkButton_Click(sender As Object,e As EventArgs) Handles OkButton.Click
Dim count As Integer = 0
Dim sqlcommand As String = String.Empty
'if there are "dirty" rows,manually update the "updated" fields in the DGV before calling update command
If _DGVchanged Then
Using con As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & VE_docPath & VE_currentProject & ".accdb;Persist Security Info=True")
Using cmd As New OleDb.OleDbCommand("",con)
Try
cmd.CommandText = "(SELECT * FROM PartDeFinitions)"
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.open()
_partsDataAdapter.SelectCommand = cmd
'command text extracted update command,works ok
sqlcommand = "UPDATE PartDeFinitions SET PartClass = ?,PartNumber = ?,PartNumberAlt = ?,Description = ?,ShellType = ?,ElementCount = ?,TerminalCount = ?,KitNumber = ?,StockNumber = ?,WiringPartName = ?,ArticleName = ?,Manufacturer = ?,ManufacturerID = ?,supplier = ?,FamilyCode = ?,UseVoltage = ?,CoVoltage = ?,UseFrequency = ?,CoFrequency = ?,IsObsolete = ?,Series = ?,SymbolName = ?,PartType = ?,Weight = ?,WeightUnits = ?,CostEach = ?,ConnectionType = ?,MaxSection = ?,MaxGuage = ?,MinSection = ?,MinGauge = ?,InsertedBy = ?,InsertedDate = ?,UpdatedBy = ?,UpdatedDate = ? WHERE ((PartDefID = ?) And ((? = 1 And PartClass Is NULL) Or (PartClass = ?)) And ((? = 1 And ElementCount Is NULL) Or (ElementCount = ?)) And ((? = 1 And TerminalCount Is NULL) Or (TerminalCount = ?)) And ((? = 1 And ManufacturerID Is NULL) Or (ManufacturerID = ?)) And ((? = 1 And IsObsolete Is NULL) Or (IsObsolete = ?)) And ((? = 1 And PartType Is NULL) Or (PartType = ?)) And ((? = 1 And Weight Is NULL) Or (Weight = ?)) And ((? = 1 And CostEach Is NULL) Or (CostEach = ?)) And ((? = 1 And MaxSection Is NULL) Or (MaxSection = ?)) And ((? = 1 And MaxGuage Is NULL) Or (MaxGuage = ?)) And ((? = 1 And MinSection Is NULL) Or (MinSection = ?)) And ((? = 1 And MinGauge Is NULL) Or (MinGauge = ?)) And ((? = 1 And InsertedDate Is NULL) Or (InsertedDate = ?)) And ((? = 1 And UpdatedDate Is NULL) Or (UpdatedDate = ?)))"
'tried to insert my own value,does NOT work
sqlcommand = "UPDATE PartDeFinitions SET PartClass = ?,UpdatedBy = '" & VE_currentUser & "',UpdatedDate = '" & DateTime.Now & "' WHERE ((PartDefID = ?) And ((? = 1 And PartClass Is NULL) Or (PartClass = ?)) And ((? = 1 And ElementCount Is NULL) Or (ElementCount = ?)) And ((? = 1 And TerminalCount Is NULL) Or (TerminalCount = ?)) And ((? = 1 And ManufacturerID Is NULL) Or (ManufacturerID = ?)) And ((? = 1 And IsObsolete Is NULL) Or (IsObsolete = ?)) And ((? = 1 And PartType Is NULL) Or (PartType = ?)) And ((? = 1 And Weight Is NULL) Or (Weight = ?)) And ((? = 1 And CostEach Is NULL) Or (CostEach = ?)) And ((? = 1 And MaxSection Is NULL) Or (MaxSection = ?)) And ((? = 1 And MaxGuage Is NULL) Or (MaxGuage = ?)) And ((? = 1 And MinSection Is NULL) Or (MinSection = ?)) And ((? = 1 And MinGauge Is NULL) Or (MinGauge = ?)) And ((? = 1 And InsertedDate Is NULL) Or (InsertedDate = ?)) And ((? = 1 And UpdatedDate Is NULL) Or (UpdatedDate = ?)))"
'this simplified version didnt work either
sqlcommand = "UPDATE PartDeFinitions Set PartClass = ?,**UpdatedDate = '" & DateTime.Now & "'** WHERE ((PartDefID = ?) And (PartClass = ?) And (ElementCount = ?) And (TerminalCount = ?) And (ManufacturerID = ?) And (IsObsolete = ?)) And (PartType = ?) And (Weight = ?) And (CostEach = ?) And (MaxSection = ?) And (MaxGuage = ?) And (MinSection = ?) And (MinGauge = ?) And (InsertedDate = NULL) And (UpdatedDate = NULL))"
'_partsDataAdapter.UpdateCommand = New OleDb.OleDbCommand(sqlcommand,con)
_partsDataAdapter.UpdateCommand = New OleDbCommandBuilder(_partsDataAdapter).GetUpdateCommand()
'debugging tool to see what the command text is
Dim test As String = _partsDataAdapter.UpdateCommand.CommandText
'I can manually edit rows in the data table and it will work,but first have to determine which rows have been edited in the DGV.
'_PartsDataTable.Rows(0).Item("UpdatedBy") = "joe kidd"
Me.Validate()
Me.BindingSource1.EndEdit()
count = _partsDataAdapter.Update(_PartsDataTable) 'get number of affected rows
MessageBox.Show("Updated " & count & "rows")
Catch sqlError As System.Data.sqlTypes.sqlTypeException
MsgBox(sqlError.Message,MsgBoxStyle.OkOnly,"Error")
Catch ex As Exception
MsgBox(ex.Message,"Error")
End Try
End Using
End Using
End If
Me.Close()
Me.dispose()
End Sub
来验证我的客户。当我从 SoapUI 调用时,我可以看到每次 org.springframework.security.ldap.authentication.LdapAuthenticationProvider.LdapAuthenticationProvider(LdapAuthenticator authenticator,LdapAuthoritiesPopulator authoritiesPopulator)
都会执行这个切入点当我从邮递员那里调用时,它只会在邮递员第一次调用时执行。
我的应用程序似乎以某种方式缓存了客户端,并说当我从邮递员那里打电话时它不需要重新进行身份验证,但是当我从soapui 打电话时却没有发生这种情况。有什么区别?
我已尝试更改我可以在 postman 和 soapui 中看到的所有设置,但我似乎无法对结果产生任何影响。有人可以描述一下,或向我指出描述正在发生的事情的资源吗?
解决方法
似乎和cookies有关...在postman中我发现了一个属性,禁用cookie jar。如果启用该功能,我将获得与soapui 相同的性能,并且它始终有效。我想现在我需要看看 cookie 如何与 Spring Security 一起工作。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。