提交 b1a5ecff authored 作者: mysinmyc's avatar mysinmyc

fix and improvements

上级 d99e1791
...@@ -2959,11 +2959,12 @@ public class Database implements DataHandler { ...@@ -2959,11 +2959,12 @@ public class Database implements DataHandler {
try { try {
String authenticatorString=null; String authenticatorString=null;
Setting authenticatorSetting =findSetting("AUTHENTICATOR"); Setting authenticatorSetting =findSetting("AUTHENTICATOR");
if (authenticatorSetting!=null) { if (authenticatorSetting==null) {
setAuthenticator(null);
} else {
authenticatorString = authenticatorSetting.getStringValue(); authenticatorString = authenticatorSetting.getStringValue();
setAuthenticator(AuthenticatorBuilder.buildAuthenticator(authenticatorString));
} }
Authenticator authenticator=AuthenticatorBuilder.buildAuthenticator(authenticatorString);
setAuthenticator(authenticator);
} catch (Exception e) { } catch (Exception e) {
throw DbException.convert(e); throw DbException.convert(e);
} }
......
...@@ -55,7 +55,6 @@ public class Engine implements SessionFactory { ...@@ -55,7 +55,6 @@ public class Engine implements SessionFactory {
boolean openNew = ci.getProperty("OPEN_NEW", false); boolean openNew = ci.getProperty("OPEN_NEW", false);
boolean opened = false; boolean opened = false;
User user = null; User user = null;
AuthenticationInfo authenticationInfo=new AuthenticationInfo(ci);
synchronized (DATABASES) { synchronized (DATABASES) {
if (openNew || ci.isUnnamedInMemory()) { if (openNew || ci.isUnnamedInMemory()) {
database = null; database = null;
...@@ -94,6 +93,7 @@ public class Engine implements SessionFactory { ...@@ -94,6 +93,7 @@ public class Engine implements SessionFactory {
if (user == null) { if (user == null) {
if (database.validateFilePasswordHash(cipher, ci.getFilePasswordHash())) { if (database.validateFilePasswordHash(cipher, ci.getFilePasswordHash())) {
try { try {
AuthenticationInfo authenticationInfo=new AuthenticationInfo(ci);
user = database.getAuthenticator().authenticate(authenticationInfo, database); user = database.getAuthenticator().authenticate(authenticationInfo, database);
} catch (AuthenticationException authenticationError) { } catch (AuthenticationException authenticationError) {
database.getTrace(Trace.DATABASE).error(authenticationError, database.getTrace(Trace.DATABASE).error(authenticationError,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论