-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' into CB-5450-console-error
- Loading branch information
Showing
106 changed files
with
1,531 additions
and
867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/jetty/CBSessionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* DBeaver - Universal Database Manager | ||
* Copyright (C) 2010-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.cloudbeaver.server.jetty; | ||
|
||
import io.cloudbeaver.server.CBApplication; | ||
import jakarta.servlet.SessionCookieConfig; | ||
import org.eclipse.jetty.http.Syntax; | ||
import org.eclipse.jetty.server.session.SessionHandler; | ||
|
||
public class CBSessionHandler extends SessionHandler { | ||
private final CBCookieConfig cbCookieConfig; | ||
private final CBApplication<?> application; | ||
|
||
public CBSessionHandler(CBApplication<?> application) { | ||
this.cbCookieConfig = new CBCookieConfig(); | ||
this.application = application; | ||
} | ||
|
||
|
||
@Override | ||
public SessionCookieConfig getSessionCookieConfig() { | ||
return this.cbCookieConfig; | ||
} | ||
|
||
|
||
//mostly copy of org.eclipse.jetty.server.session.CookieConfig but allows to use dynamic setSecure flag | ||
public final class CBCookieConfig implements SessionCookieConfig { | ||
public CBCookieConfig() { | ||
} | ||
|
||
public String getComment() { | ||
return CBSessionHandler.this._sessionComment; | ||
} | ||
|
||
public String getDomain() { | ||
return CBSessionHandler.this._sessionDomain; | ||
} | ||
|
||
public int getMaxAge() { | ||
return CBSessionHandler.this._maxCookieAge; | ||
} | ||
|
||
public String getName() { | ||
return CBSessionHandler.this._sessionCookie; | ||
} | ||
|
||
public String getPath() { | ||
return CBSessionHandler.this._sessionPath; | ||
} | ||
|
||
public boolean isHttpOnly() { | ||
return CBSessionHandler.this._httpOnly; | ||
} | ||
|
||
public boolean isSecure() { | ||
var serverUrl = CBSessionHandler.this.application.getServerURL(); | ||
return serverUrl != null && serverUrl.startsWith("https://"); | ||
} | ||
|
||
public void setComment(String comment) { | ||
if (CBSessionHandler.this._context != null && CBSessionHandler.this._context.getContextHandler() | ||
.isAvailable()) { | ||
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); | ||
} else { | ||
CBSessionHandler.this._sessionComment = comment; | ||
} | ||
} | ||
|
||
public void setDomain(String domain) { | ||
if (CBSessionHandler.this._context != null && CBSessionHandler.this._context.getContextHandler() | ||
.isAvailable()) { | ||
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); | ||
} else { | ||
CBSessionHandler.this._sessionDomain = domain; | ||
} | ||
} | ||
|
||
public void setHttpOnly(boolean httpOnly) { | ||
if (CBSessionHandler.this._context != null && CBSessionHandler.this._context.getContextHandler() | ||
.isAvailable()) { | ||
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); | ||
} else { | ||
CBSessionHandler.this._httpOnly = httpOnly; | ||
} | ||
} | ||
|
||
public void setMaxAge(int maxAge) { | ||
if (CBSessionHandler.this._context != null && CBSessionHandler.this._context.getContextHandler() | ||
.isAvailable()) { | ||
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); | ||
} else { | ||
CBSessionHandler.this._maxCookieAge = maxAge; | ||
} | ||
} | ||
|
||
public void setName(String name) { | ||
if (CBSessionHandler.this._context != null && CBSessionHandler.this._context.getContextHandler() | ||
.isAvailable()) { | ||
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); | ||
} else if ("".equals(name)) { | ||
throw new IllegalArgumentException("Blank cookie name"); | ||
} else { | ||
if (name != null) { | ||
Syntax.requireValidRFC2616Token(name, "Bad Session cookie name"); | ||
} | ||
|
||
CBSessionHandler.this._sessionCookie = name; | ||
} | ||
} | ||
|
||
public void setPath(String path) { | ||
if (CBSessionHandler.this._context != null && CBSessionHandler.this._context.getContextHandler() | ||
.isAvailable()) { | ||
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); | ||
} else { | ||
CBSessionHandler.this._sessionPath = path; | ||
} | ||
} | ||
|
||
public void setSecure(boolean secure) { | ||
if (CBSessionHandler.this._context != null && CBSessionHandler.this._context.getContextHandler() | ||
.isAvailable()) { | ||
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); | ||
} else { | ||
CBSessionHandler.this._secureCookies = secure; | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
export default [ | ||
['administration_menu_enter', '管理'], | ||
['administration_menu_back', '返回应用'], | ||
['administration_configuration_wizard_title', '初始化服务器配置'], | ||
['administration_configuration_wizard_finish_success_title', 'Server configured'], | ||
['administration_configuration_wizard_finish_success_message', 'You can log-in as administrator in order to set up additional parameters.'], | ||
['administration_configuration_wizard_finish_success_title', '服务器已完成配置'], | ||
['administration_configuration_wizard_finish_success_message', '您可以使用管理员登录后进行更多参数配置。'], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
export default [ | ||
['core_authentication_auth_settings_group', 'Authentication'], | ||
['settings_authentication_disable_anonymous_access_name', 'Disable anonymous access'], | ||
['settings_authentication_disable_anonymous_access_description', 'Disable anonymous access function'], | ||
['core_authentication_auth_settings_group', '认证'], | ||
['settings_authentication_disable_anonymous_access_name', '禁用匿名访问'], | ||
['settings_authentication_disable_anonymous_access_description', '禁用匿名访问功能'], | ||
|
||
['core_authentication_password_policy_min_length', 'Password must be at least {arg:min} characters long'], | ||
['core_authentication_password_policy_upper_lower_case', 'Password must contain both upper and lower case letters'], | ||
['core_authentication_password_policy_min_digits', 'Password must contain at least {arg:min} digits'], | ||
['core_authentication_password_policy_min_special_characters', 'Password must contain at least {arg:min} special characters'], | ||
['core_authentication_password_policy_min_length', '密码长度需要至少 {arg:min} 个字符'], | ||
['core_authentication_password_policy_upper_lower_case', '密码必须包含大写和小写字母'], | ||
['core_authentication_password_policy_min_digits', '密码至少需要包含 {arg:min} 个数字'], | ||
['core_authentication_password_policy_min_special_characters', '密码至少需要包含 {arg:min} 个特殊字符'], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.