diff --git a/src/browser/modules/Stream/Auth/ConnectForm.tsx b/src/browser/modules/Stream/Auth/ConnectForm.tsx index 23a623f7497..4e69f932186 100644 --- a/src/browser/modules/Stream/Auth/ConnectForm.tsx +++ b/src/browser/modules/Stream/Auth/ConnectForm.tsx @@ -111,18 +111,18 @@ export default function ConnectForm(props: ConnectFormProps): JSX.Element { hasSecureSchemes ? '+s' : '' }:// for a direct connection to a DBMS instance.` - const multipleSchemesAllowed = props.allowedSchemes.length > 1 + const schemeRestriction = props.allowedSchemes.length > 0 return ( Connect URL - {multipleSchemesAllowed ? ( + {schemeRestriction ? ( <> { storeCredentials: shouldRetainConnectionCredentials(state), isConnected: isConnected(state), allowedSchemes: getAllowedBoltSchemes(state), - allowedAuthMethods: inCloudEnv(state) ? [NATIVE] : [NATIVE, NO_AUTH] + allowedAuthMethods: getAllowedAuthSchemes(state) } } diff --git a/src/browser/modules/Stream/Auth/ConnectionFrame.jsx b/src/browser/modules/Stream/Auth/ConnectionFrame.jsx index 23d6b4bdf7d..36fc71ac2a5 100644 --- a/src/browser/modules/Stream/Auth/ConnectionFrame.jsx +++ b/src/browser/modules/Stream/Auth/ConnectionFrame.jsx @@ -29,7 +29,8 @@ import { Lead } from 'browser-components/Text' import Render from 'browser-components/Render' import { StyledConnectionAside, StyledConnectionBodyContainer } from './styled' import { connect } from 'react-redux' -import { inCloudEnv } from 'shared/modules/app/appDuck' +import { getAllowedAuthSchemes } from 'shared/modules/app/appDuck' +import { NO_AUTH } from 'services/bolt/boltHelpers' export class ConnectionFrame extends Component { constructor(props) { @@ -69,9 +70,11 @@ export class ConnectionFrame extends Component { <>

Connect to Neo4j

- {this.props.inCloudEnv - ? 'Database access on Neo4j Aura requires an authenticated connection' - : 'Database access might require an authenticated connection.'} + Database access + {this.props.mightRequireAuth + ? ' might require ' + : ' requires '} + an authenticated connection )} @@ -92,7 +95,7 @@ export class ConnectionFrame extends Component { const mapStateToProps = state => { return { - inCloudEnv: inCloudEnv(state) + mightRequireAuth: getAllowedAuthSchemes(state).includes(NO_AUTH) } } diff --git a/src/shared/modules/app/appDuck.js b/src/shared/modules/app/appDuck.js index 9b7f5acdf46..74eb2698e8c 100644 --- a/src/shared/modules/app/appDuck.js +++ b/src/shared/modules/app/appDuck.js @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +import { NATIVE, NO_AUTH } from 'services/bolt/boltHelpers' + // Action type constants export const NAME = 'app' export const APP_START = `${NAME}/APP_START` @@ -35,12 +37,15 @@ const INSECURE_SCHEMES = ['neo4j', 'bolt'] // Selectors export const getHostedUrl = state => (state[NAME] || {}).hostedUrl || null -export const getEnv = state => (state[NAME] || {}).env || WEB +export const getEnv = state => CLOUD //(state[NAME] || {}).env || WEB export const hasDiscoveryEndpoint = state => [WEB, CLOUD].includes(getEnv(state)) export const inWebEnv = state => getEnv(state) === WEB export const inCloudEnv = state => getEnv(state) === CLOUD export const inWebBrowser = state => [WEB, CLOUD].includes(getEnv(state)) +export const getAllowedAuthSchemes = state => + inCloudEnv(state) ? [] : [NATIVE, NO_AUTH] + export const getAllowedBoltSchemes = (state, encryptionFlag) => { if (inCloudEnv(state) /* Aura only allows neo4j+s */) { return ['neo4j+s']