Skip to content

Commit 674cbb6

Browse files
SSO for browser (#1478)
* Initial implementation * Remove dep on querystring * Restore search params properly * Remove unneeded changes * Touch up connect frame and update licenses * Cleanup discovery duck * Add helper fns to discovery duck * cleanup * Touch up connect frame * Respect discoveryURL param * Borrow bloom auth debugger fn * Updated auth code from bloom * Fix keycloak implicit flow * cleanup * Add bloom updates * Fix crashes * mellan * Update tests * fix styling * Add better logging * mel * Show error messages from SSO * Self review * Fix normal discovery * Downloadable logs * Update naming as per review comments * comments * Fix comment around logging * Add rejections per review comments * Fix comment about history.replace * More throws * List missing keys on invalid sso provider * Update log message about principal and secure context * Use constant for url param * Stop log and throwing * Improve error handling * Add better types * Helper fn for getting valid sso providers * Handle connectURL and multiple discovery endpoints properly * Update from jons review comments * Add discovery logs to :debug frame * Update styling as per lizas comments * Fix typo * Rename provider id * remove extra newline in :debug logs * Move code to styled comp * Cleanup comment * Fix unit tests
1 parent b9e38d6 commit 674cbb6

File tree

24 files changed

+1393
-235
lines changed

24 files changed

+1393
-235
lines changed

LICENSES.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5805,6 +5805,32 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL
58055805

58065806
-----
58075807

5808+
The following software may be included in this product: jwt-decode. A copy of the source code may be downloaded from git://github.com/auth0/jwt-decode. This software contains the following license and notice below:
5809+
5810+
The MIT License (MIT)
5811+
5812+
Copyright (c) 2015 Auth0, Inc. <[email protected]> (http://auth0.com)
5813+
5814+
Permission is hereby granted, free of charge, to any person obtaining a copy
5815+
of this software and associated documentation files (the "Software"), to deal
5816+
in the Software without restriction, including without limitation the rights
5817+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5818+
copies of the Software, and to permit persons to whom the Software is
5819+
furnished to do so, subject to the following conditions:
5820+
5821+
The above copyright notice and this permission notice shall be included in all
5822+
copies or substantial portions of the Software.
5823+
5824+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5825+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5826+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5827+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5828+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5829+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
5830+
SOFTWARE.
5831+
5832+
-----
5833+
58085834
The following software may be included in this product: keyboard-key. A copy of the source code may be downloaded from git+ssh://github.com/levithomason/keyboard-key.git. This software contains the following license and notice below:
58095835

58105836
MIT License

NOTICE.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,10 @@ Third-party licenses
12751275
12761276
│ │ ├─ URL: git://github.com/brianloveswords/node-jws.git
12771277
│ │ └─ VendorName: Brian J Brennan
1278+
1279+
│ │ ├─ URL: git://github.com/auth0/jwt-decode
1280+
│ │ ├─ VendorName: Jose F. Romaniello
1281+
│ │ └─ VendorUrl: https://github.com/auth0/jwt-decode#readme
12781282
12791283
│ │ ├─ URL: git+ssh://github.com/levithomason/keyboard-key.git
12801284
│ │ └─ VendorName: Levi Thomason

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
"isomorphic-fetch": "^2.2.1",
182182
"jsonic": "^0.3.0",
183183
"jszip": "^3.2.2",
184+
"jwt-decode": "^3.1.2",
184185
"lodash-es": "^4.17.15",
185186
"memoize-one": "^5.2.1",
186187
"monaco-editor": "0.23.0",

src/browser/AppInit.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ import { shouldAllowOutgoingConnections } from 'shared/modules/dbMeta/dbMetaDuck
5353
import { getUuid } from 'shared/modules/udc/udcDuck'
5454
import { DndProvider } from 'react-dnd'
5555
import { HTML5Backend } from 'react-dnd-html5-backend'
56+
import {
57+
restoreSearchAndHashParams,
58+
wasRedirectedBackFromSSOServer
59+
} from 'shared/modules/auth/common'
5660

5761
// Configure localstorage sync
5862
applyKeys(
@@ -199,6 +203,14 @@ export function setupSentry(): void {
199203
// Introduce environment to be able to fork functionality
200204
const env = detectRuntimeEnv(window, NEO4J_CLOUD_DOMAINS)
201205

206+
// SSO requires a redirect that removes our search parameters
207+
// To work around this they are stored in sessionStorage before
208+
// we redirect to the server, and then restore them when we get
209+
// redirected back
210+
if (wasRedirectedBackFromSSOServer()) {
211+
restoreSearchAndHashParams()
212+
}
213+
202214
// URL we're on
203215
const url = window.location.href
204216

src/browser/components/buttons/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ export const NavigationButtonContainer = styled.li<{ isOpen: boolean }>`
115115

116116
const StyledFormButton = styled.button`
117117
color: ${props => props.theme.primaryButtonText};
118-
background-color: ${props => props.theme.primaryButtonBackground};
119-
border: 1px solid ${props => props.theme.primaryButtonBackground};
118+
background-color: ${props => props.theme.primary};
119+
border: 1px solid ${props => props.theme.primary};
120120
font-family: ${props => props.theme.primaryFontFamily};
121121
padding: 6px 18px;
122122
margin-right: 10px;
@@ -129,9 +129,9 @@ const StyledFormButton = styled.button`
129129
border-radius: 4px;
130130
line-height: 20px;
131131
&:hover {
132-
background-color: ${props => props.theme.secondaryButtonBackgroundHover};
132+
background-color: ${props => props.theme.primary50};
133133
color: ${props => props.theme.secondaryButtonTextHover};
134-
border: 1px solid ${props => props.theme.secondaryButtonBackgroundHover};
134+
border: 1px solid ${props => props.theme.primary50};
135135
}
136136
`
137137

src/browser/components/headers/Headers.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ export const H3 = styled.h3`
2626
font-family: ${props => props.theme.primaryFontFamily};
2727
color: ${props => props.theme.headerText};
2828
`
29+
export const H4 = styled.h3`
30+
font-weight: 500;
31+
font-size: 18px;
32+
font-family: ${props => props.theme.primaryFontFamily};
33+
color: ${props => props.theme.headerText};
34+
margin-bottom: 32px;
35+
`

0 commit comments

Comments
 (0)