Skip to content

Commit 8e8e058

Browse files
ReshmaRamaiah10Ramaiah
andauthored
Unauthorized page is no longer blank (#528)
Co-authored-by: Ramaiah <[email protected]>
1 parent be684df commit 8e8e058

File tree

4 files changed

+55
-39
lines changed

4 files changed

+55
-39
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,4 @@ Desktop.ini
166166
/src/test/javascript/screenshots/diff
167167
# Sentry Config File
168168
.env.sentry-build-plugin
169+
.vscode/settings.json

README.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
1. [Docker](https://www.docker.com/get-started).
99
2. [mysql 8](https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/).
10-
3. [Java 11](https://dev.java/download/) SDK.
10+
3. [Java 17](https://dev.java/download/) SDK.
1111
4. [Node.js](https://nodejs.org): We use Node to run a development web server
1212
and build the project. Depending on your system, you can install Node either
1313
from source or as a pre-packaged bundle. The version of node we are using can
@@ -24,7 +24,13 @@
2424

2525
5. [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/)
2626

27-
2. After installing Node and yarn, you should be able to run the following command
27+
2. Run the brew command for the Mac in the [compiling section](https://github.com/Automattic/node-canvas?tab=readme-ov-file#compiling) of the node-canvas readme. For other systems, please see [compiling section](https://github.com/Automattic/node-canvas?tab=readme-ov-file#compiling) for instructions.
28+
29+
```sh
30+
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
31+
```
32+
33+
3. After installing Node and yarn, you should be able to run the following command
2834
to install development tools. You will only need to run this command when
2935
dependencies change in [package.json](package.json).
3036

@@ -34,7 +40,7 @@
3440

3541
We use yarn scripts and [Webpack](https://webpack.js.org/) as our build system.
3642

37-
3. If you are using redis as a cache, you will have to launch a cache server.
43+
4. If you are using redis as a cache, you will have to launch a cache server (Optional).
3844

3945
- To start your cache server, run:
4046

@@ -53,7 +59,7 @@
5359
See [here](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-caching.html#boot-features-caching-provider-none)
5460
for details.
5561

56-
4. Configure Keycloak and Google SSO
62+
5. Configure Keycloak and Google SSO
5763

5864
To log in to your app, you'll need to have [Keycloak](https://keycloak.org)
5965
up and running.
@@ -114,7 +120,7 @@
114120
scope: openid,profile,email
115121
```
116122
117-
5. Configure Firebase
123+
6. Configure Firebase
118124
119125
1. Go to [Firebase Console](https://console.firebase.google.com/) and create
120126
a new project
@@ -155,7 +161,7 @@
155161
17. Expand **Build** and click **Authentication**
156162
18. Click the **Sign-in method** section and add email/password provider
157163
158-
6. Verify that your mysql configuration in [application-dev.yaml](src/main/resources/config/application-dev.yml)
164+
7. Verify that your mysql configuration in [application-dev.yaml](src/main/resources/config/application-dev.yml)
159165
is correct for you mysql server instance.
160166
161167
```yaml
@@ -166,7 +172,7 @@
166172
password: root
167173
```
168174
169-
7. Run the application (Don't login just yet)
175+
8. Run the application (Don't login just yet)
170176

171177
- Note your a oncokb_curation schema will be created in your mysql database.
172178
Data will also be seeded for it.
@@ -175,40 +181,40 @@
175181
./mvnw
176182
```
177183

178-
8. Wait until the server is listening to requests and is able to redirect you to
184+
9. Wait until the server is listening to requests and is able to redirect you to
179185
the login screen. (server url defaults to `http://localhost:9090`)
180186

181-
9. Add a login for yourself into your mysql instance. Replace <your_email>
182-
with your gmail email address.
183-
184-
```sql
185-
INSERT INTO `oncokb_curation`.`user`
186-
(
187-
`login`,
188-
`email`,
189-
`created_by`,
190-
`activated`)
191-
VALUES
192-
('<your_email>',
193-
'<your_email>',
194-
'SYSTEM',
195-
1);
196-
197-
SET @UserID = (SELECT Id
198-
FROM `oncokb_curation`.`user`
199-
WHERE email = '<your_email>');
200-
201-
INSERT INTO `oncokb_curation`.`user_authority`
202-
(user_id, authority_name)
203-
VALUES
204-
(@UserId, 'ROLE_ADMIN'),
205-
(@UserId, 'ROLE_DEV'),
206-
(@UserId, 'ROLE_CURATOR'),
207-
(@UserId, 'ROLE_USER');
187+
10. Add a login for yourself into your mysql instance. Replace <your_email>
188+
with your gmail email address.
189+
190+
```sql
191+
INSERT INTO `oncokb_curation`.`user`
192+
(
193+
`login`,
194+
`email`,
195+
`created_by`,
196+
`activated`)
197+
VALUES
198+
('<your_email>',
199+
'<your_email>',
200+
'SYSTEM',
201+
1);
202+
203+
SET @UserID = (SELECT Id
204+
FROM `oncokb_curation`.`user`
205+
WHERE email = '<your_email>');
206+
207+
INSERT INTO `oncokb_curation`.`user_authority`
208+
(user_id, authority_name)
209+
VALUES
210+
(@UserId, 'ROLE_ADMIN'),
211+
(@UserId, 'ROLE_DEV'),
212+
(@UserId, 'ROLE_CURATOR'),
213+
(@UserId, 'ROLE_USER');
208214
209-
```
215+
```
210216

211-
10. Login to curation!
217+
11. Login to curation!
212218

213219
## Building for production
214220

src/main/webapp/app/pages/login/logout.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ export const Logout = (props: ILogoutProps) => {
4848
}
4949

5050
if (unauthorizedAccess) {
51-
return <></>;
51+
return (
52+
<>
53+
<h2>Your account is not authorized to access this application.</h2>
54+
<p>Please log in with an authorized google account or contact support for access.</p>
55+
<Link to={PAGE_ROUTE.OAUTH} className="login-link">
56+
← Go back to Login
57+
</Link>
58+
</>
59+
);
5260
}
5361

5462
const unauthorizedAccessContent = (

src/main/webapp/app/stores/authentication.store.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import BaseStore from 'app/shared/util/base-store';
44
import { IRootStore } from 'app/stores/createStore';
55
import { OncoKBError } from 'app/oncokb-commons/components/alert/ErrorAlertUtils';
66
import { defaultValue as USER_DEFAULT_VALUE, IUser } from 'app/shared/model/user.model';
7+
import { notifyError } from 'app/oncokb-commons/components/util/NotificationUtils';
78

89
export const AUTH_TOKEN_KEY = 'jhi-authenticationToken';
910

@@ -120,7 +121,7 @@ export class AuthStore extends BaseStore {
120121
this.loginError = e as Error;
121122
this.loading = false;
122123
if (!axios.isAxiosError(e) || (e as AxiosError).response?.status !== 401) {
123-
throw e;
124+
notifyError(e, 'Network error while authenticating');
124125
}
125126
}
126127
}

0 commit comments

Comments
 (0)