From f4a73513e1dcf1095b93e7e87248c6acc58e1d91 Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Fri, 22 May 2020 15:28:08 +0200 Subject: [PATCH 1/3] Fix auth scheme error --- src/shared/services/bolt/globalDrivers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/services/bolt/globalDrivers.js b/src/shared/services/bolt/globalDrivers.js index 0c7e5583f64..5d5d13a5881 100644 --- a/src/shared/services/bolt/globalDrivers.js +++ b/src/shared/services/bolt/globalDrivers.js @@ -90,7 +90,7 @@ export const buildAuthObj = props => { ) { auth = neo4j.auth.basic(props.username, props.password) } else { - auth = null + auth = neo4j.auth.basic('', '') } return auth } From e7100d40bf62889458fc985f66d8530ee2f9c753 Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Fri, 22 May 2020 15:36:36 +0200 Subject: [PATCH 2/3] Show auth status on `:server connect` after connection Reflect what `:server status` shows. Also clear out cached creds when auth disabled detected during runtime. --- .../modules/Stream/Auth/ConnectionForm.jsx | 19 +++++++++++++++++-- .../Stream/Auth/ConnectionForm.test.js | 3 ++- .../modules/connections/connectionsDuck.js | 10 ++++++++-- src/shared/services/bolt/bolt.js | 4 ++-- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/browser/modules/Stream/Auth/ConnectionForm.jsx b/src/browser/modules/Stream/Auth/ConnectionForm.jsx index ec970007329..ff4c0ed9a69 100644 --- a/src/browser/modules/Stream/Auth/ConnectionForm.jsx +++ b/src/browser/modules/Stream/Auth/ConnectionForm.jsx @@ -49,6 +49,7 @@ import { toggleSchemeRouting, isNonSupportedRoutingSchemeError } from 'services/boltscheme.utils' +import { StyledConnectionBody } from './styled' export class ConnectionForm extends Component { constructor(props) { @@ -260,15 +261,29 @@ export class ConnectionForm extends Component { {this.props.children} ) - } else if (this.props.isConnected) { + } else if ( + this.props.isConnected && + this.props.activeConnectionData && + this.props.activeConnectionData.authEnabled !== false // falsy value indicates (except false) we don't know yet, so see that as enabled. + ) { view = ( ) + } else if ( + this.props.isConnected && + this.props.activeConnectionData && + this.props.activeConnectionData.authEnabled === false // excplicit false = auth enabled for sure + ) { + view = ( + + You have a working connection and server auth is disabled. + + ) } else if (!this.props.isConnected && !this.state.passwordChangeNeeded) { view = ( { activeConnection = true activeConnectionData = { username, - host + host, + authEnabled: true } rerender( { ...state.connectionsById[connectionId], authEnabled } + + if (!authEnabled) { + updatedConnection.username = '' + updatedConnection.password = '' + } + const updatedConnectionByIds = { ...state.connectionsById } @@ -341,7 +347,7 @@ export const connectEpic = (action$, store) => { .openConnection(action, { connectionTimeout: getConnectionTimeout(store.getState()) }) - .then(res => ({ type: action.$$responseChannel, success: true })) + .then(() => ({ type: action.$$responseChannel, success: true })) .catch(e => { if (!action.noResetConnectionOnFail) { store.dispatch(setActiveConnection(null)) @@ -587,7 +593,7 @@ export const switchConnectionEpic = (action$, store) => { { encrypted: action.encrypted }, onLostConnection(store.dispatch) ) - .then(connection => { + .then(() => { store.dispatch(setActiveConnection(discovery.CONNECTION_ID)) resolve({ type: SWITCH_CONNECTION_SUCCESS }) }) diff --git a/src/shared/services/bolt/bolt.js b/src/shared/services/bolt/bolt.js index aefa8175ace..73e75e1ebd9 100644 --- a/src/shared/services/bolt/bolt.js +++ b/src/shared/services/bolt/bolt.js @@ -47,7 +47,7 @@ function openConnection(props, opts = {}, onLostConnection) { return new Promise((resolve, reject) => { boltConnection .openConnection(props, opts, onLostConnection) - .then(r => { + .then(() => { connectionProperties = { authenticationMethod: props.authenticationMethod || NATIVE, username: props.username, @@ -55,7 +55,7 @@ function openConnection(props, opts = {}, onLostConnection) { host: props.host, opts } - resolve(r) + resolve() }) .catch(e => { connectionProperties = null From 7f4615fdff493063a774e7c399d47be545402f55 Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Tue, 26 May 2020 08:51:33 +0200 Subject: [PATCH 3/3] Fix comment logic --- src/browser/modules/Stream/Auth/ConnectionForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/modules/Stream/Auth/ConnectionForm.jsx b/src/browser/modules/Stream/Auth/ConnectionForm.jsx index ff4c0ed9a69..b8006ca1632 100644 --- a/src/browser/modules/Stream/Auth/ConnectionForm.jsx +++ b/src/browser/modules/Stream/Auth/ConnectionForm.jsx @@ -277,7 +277,7 @@ export class ConnectionForm extends Component { } else if ( this.props.isConnected && this.props.activeConnectionData && - this.props.activeConnectionData.authEnabled === false // excplicit false = auth enabled for sure + this.props.activeConnectionData.authEnabled === false // excplicit false = auth disabled for sure ) { view = (