mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
fix: CB-970 hide authentication params in a connection form
This commit is contained in:
@@ -45,14 +45,14 @@ export class UserInfoResource extends CachedDataResource<UserInfo | null, void>
|
||||
}
|
||||
|
||||
hasToken(type: string, subType?: string): boolean {
|
||||
if (!this.data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type === AUTH_PROVIDER_LOCAL_ID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!this.data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: will be changed due wrong origin in authTokens
|
||||
return this.data.authTokens.some(token => token.origin.type === (subType ?? type))
|
||||
|| this.data.authTokens.some(token => token.origin.type === type && token.origin.subType === subType);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useCallback, useRef } from 'react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import { useAdministrationSettings } from '@cloudbeaver/core-administration';
|
||||
import { AUTH_PROVIDER_LOCAL_ID } from '@cloudbeaver/core-authentication';
|
||||
import {
|
||||
InputFieldNew,
|
||||
SubmittingForm,
|
||||
@@ -30,6 +31,7 @@ import {
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
import { useTranslate } from '@cloudbeaver/core-localization';
|
||||
import { useStyles } from '@cloudbeaver/core-theming';
|
||||
import { useAuthenticationAction } from '@cloudbeaver/core-ui';
|
||||
|
||||
import { isLocalConnection } from '../../Administration/ConnectionsResource';
|
||||
import { DatabaseAuthModelsResource } from '../../DatabaseAuthModelsResource';
|
||||
@@ -64,6 +66,10 @@ export const Options: TabContainerPanelComponent<IConnectionFormProps> = observe
|
||||
disabled,
|
||||
} = state;
|
||||
|
||||
const authentication = useAuthenticationAction({
|
||||
origin: state.info?.origin ?? { type: AUTH_PROVIDER_LOCAL_ID, displayName: 'Local' },
|
||||
});
|
||||
|
||||
useFormValidator(submittingHandlers.for(service.formValidationTask), formRef);
|
||||
const optionsHook = useOptions(props.state);
|
||||
const { credentialsSavingEnabled } = useAdministrationSettings();
|
||||
@@ -185,7 +191,7 @@ export const Options: TabContainerPanelComponent<IConnectionFormProps> = observe
|
||||
</Group>
|
||||
</Container>
|
||||
<Container medium gap>
|
||||
{(authModel && !driver.data?.anonymousAccess && properties) && (
|
||||
{(authModel && !driver.data?.anonymousAccess && properties && authentication.authorized) && (
|
||||
<Group form gap>
|
||||
<GroupTitle>{translate('connections_connection_edit_authentication')}</GroupTitle>
|
||||
<Container wrap gap>
|
||||
|
||||
Reference in New Issue
Block a user