-
Notifications
You must be signed in to change notification settings - Fork 559
dbeaver/cloudbeaver#4564 change db user password #4586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| /* | ||
| * DBeaver - Universal Database Manager | ||
| * Copyright (C) 2010-2026 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.events; | ||
|
|
||
| import org.jkiss.code.NotNull; | ||
| import org.jkiss.code.Nullable; | ||
| import org.jkiss.dbeaver.model.websocket.event.WSAbstractEvent; | ||
|
|
||
| public class WSSecurityAuditEvent extends WSAbstractEvent { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need that class? I think it would be better just write logs as usual by using Log.getLog(Class.class)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||
| public static final String TOPIC = "cb_security_audit"; | ||
| public static final String ID = "cb_security_audit_updated"; | ||
|
|
||
| public enum Kind { | ||
| /** Emitted before invoking the DBeaver core password-change handler. */ | ||
| ATTEMPTED, | ||
| /** Emitted after handler completes and credentials are persisted. */ | ||
| SUCCEEDED, | ||
| /** Emitted when the handler raises an exception or credential persistence fails. */ | ||
| FAILED, | ||
| /** Emitted when any pre-invocation gate rejects the request. */ | ||
| GATE_REJECTED | ||
| } | ||
|
|
||
| @Nullable | ||
| private final String projectId; | ||
| @Nullable | ||
| private final String connectionId; | ||
| @Nullable | ||
| private final String driverId; | ||
| @NotNull | ||
| private final Kind kind; | ||
| @Nullable | ||
| private final String reasonCode; | ||
| @Nullable | ||
| private final String errorClass; | ||
|
|
||
| public WSSecurityAuditEvent( | ||
| @Nullable String sessionId, | ||
| @Nullable String userId, | ||
| @Nullable String projectId, | ||
| @Nullable String connectionId, | ||
| @Nullable String driverId, | ||
| @NotNull Kind kind, | ||
| @Nullable String reasonCode, | ||
| @Nullable String errorClass | ||
| ) { | ||
| super(ID, TOPIC, sessionId, userId); | ||
| this.projectId = projectId; | ||
| this.connectionId = connectionId; | ||
| this.driverId = driverId; | ||
| this.kind = kind; | ||
| this.reasonCode = reasonCode; | ||
| this.errorClass = errorClass; | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getProjectId() { | ||
| return projectId; | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getConnectionId() { | ||
| return connectionId; | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getDriverId() { | ||
| return driverId; | ||
| } | ||
|
|
||
| @NotNull | ||
| public Kind getKind() { | ||
| return kind; | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getReasonCode() { | ||
| return reasonCode; | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getErrorClass() { | ||
| return errorClass; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * DBeaver - Universal Database Manager | ||
| * Copyright (C) 2010-2026 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.events; | ||
|
|
||
| import org.jkiss.code.NotNull; | ||
| import org.jkiss.dbeaver.Log; | ||
| import org.jkiss.dbeaver.model.websocket.WSEventHandler; | ||
|
|
||
| public class WSSecurityAuditEventHandler implements WSEventHandler<WSSecurityAuditEvent> { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think that we need it.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #4586 (comment). Please confirm you really don't want it, before I just fall back.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TobyTheHutt Let's remove it. |
||
| private static final Log auditLog = Log.getLog(WSSecurityAuditEventHandler.class); | ||
|
|
||
| @Override | ||
| public void handleEvent(@NotNull WSSecurityAuditEvent event) { | ||
| auditLog.info(String.format( | ||
| "topic=%s id=%s kind=%s reasonCode=%s userId=%s sessionId=%s " | ||
| + "projectId=%s connectionId=%s driverId=%s errorClass=%s timestamp=%d", | ||
| event.getTopicId(), | ||
| event.getId(), | ||
| event.getKind(), | ||
| event.getReasonCode(), | ||
| event.getUserId(), | ||
| event.getSessionId(), | ||
| event.getProjectId(), | ||
| event.getConnectionId(), | ||
| event.getDriverId(), | ||
| event.getErrorClass(), | ||
| event.getTimestamp() | ||
| )); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.