Skip to content

Commit a1f5923

Browse files
authored
Merge pull request #148 from overture-stack/rc/4.2.0
Rc/4.2.0
2 parents f52a68a + f487e8a commit a1f5923

File tree

5 files changed

+51
-20
lines changed

5 files changed

+51
-20
lines changed

.env.schema

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ REACT_APP_API=https://...
33
REACT_APP_EGO_CLIENT_ID=ego
44
# debug namespace, e.g. "app". See https://www.npmjs.com/package/debug
55
REACT_APP_DEBUG=app
6+
REACT_APP_KEYCLOAK_ENABLED=false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auth-ui",
3-
"version": "4.1.0",
3+
"version": "4.2.0",
44
"private": true,
55
"dependencies": {
66
"axios": "^0.21.1",

src/common/RESOURCE_MAP.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ const RESOURCE_MAP: { [key in TResourceType]: IResource } = {
385385
panelSection: 'meta',
386386
required: true,
387387
},
388+
{
389+
fieldName: 'Error Redirect Uri',
390+
key: 'errorRedirectUri',
391+
panelSection: 'meta',
392+
required: true,
393+
},
388394
],
389395
updateItem: updateApplication,
390396
},

src/common/injectGlobals.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export const USE_DUMMY_DATA = process.env.REACT_APP_DUMMY;
1313

1414
export const PUBLIC_PATH = process.env.REACT_APP_PUBLIC_PATH;
1515

16+
export const KEYCLOAK_ENABLED = process.env.REACT_APP_KEYCLOAK_ENABLED === 'true' || false;
17+
1618
export const STATUSES = ['DISABLED', 'APPROVED', 'PENDING', 'REJECTED'];
1719
export const DATE_KEYS = ['createdAt', 'lastLogin'];
1820
export const DATE_FORMAT = 'YYYY-MM-DD hh:mm A';
@@ -22,9 +24,9 @@ const createPubsub = () => {
2224
let listeners = [];
2325
const subscribe = callback => (listeners = listeners.concat(callback));
2426
const unsubscribe = callback =>
25-
(listeners = listeners.filter(l => {
26-
l !== callback;
27-
}));
27+
(listeners = listeners.filter(l => {
28+
l !== callback;
29+
}));
2830
const publish = payload => {
2931
listeners.forEach((callback: Function) => {
3032
callback(payload);

src/components/Login.tsx

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { API_ROOT, EGO_CLIENT_ID } from 'common/injectGlobals';
1+
import { API_ROOT, EGO_CLIENT_ID, KEYCLOAK_ENABLED } from 'common/injectGlobals';
22
import { injectState } from 'freactal';
33
import { css } from 'glamor';
44
import jwtDecode from 'jwt-decode';
@@ -7,7 +7,7 @@ import React, { ComponentType } from 'react';
77
import { compose } from 'recompose';
88
import ajax from 'services/ajax';
99

10-
import { BLUE, LIGHT_BLUE, TEAL, WHITE } from 'common/colors';
10+
import { BLUE, DEFAULT_BLACK, LIGHT_BLUE, TEAL, WHITE } from 'common/colors';
1111
import { Orcid, Facebook, Google, GitHub, LinkedIn } from './Icons';
1212

1313
const styles = {
@@ -51,6 +51,7 @@ const styles = {
5151
const enhance = compose(injectState);
5252

5353
enum LoginProvider {
54+
Keycloak = 'Keycloak',
5455
Google = 'Google',
5556
// Facebook = 'Facebook',
5657
Github = 'GitHub',
@@ -59,6 +60,7 @@ enum LoginProvider {
5960
}
6061

6162
enum ProviderLoginPaths {
63+
keycloak = 'keycloak',
6264
google = 'google',
6365
// facebook = 'facebook',
6466
github = 'github',
@@ -71,7 +73,7 @@ type IconComponent = ComponentType<{ width: number; height: number }>;
7173
type ProviderType = {
7274
name: LoginProvider;
7375
path: ProviderLoginPaths;
74-
Icon: IconComponent;
76+
Icon?: IconComponent;
7577
};
7678

7779
const providers: ProviderType[] = [
@@ -82,6 +84,16 @@ const providers: ProviderType[] = [
8284
{ name: LoginProvider.Linkedin, path: ProviderLoginPaths.linkedin, Icon: LinkedIn },
8385
];
8486

87+
const KeycloakLogin = () => {
88+
return <a
89+
key={LoginProvider.Keycloak}
90+
href={`${API_ROOT}/oauth/login/${ProviderLoginPaths.keycloak}?client_id=${EGO_CLIENT_ID}`}
91+
className={`${css(styles.loginButton)}`}
92+
>
93+
<span className={`${css({ paddingLeft: 10 })}`}>Login/Register</span>
94+
</a>
95+
}
96+
8597
class Component extends React.Component<any, any> {
8698
static propTypes = {
8799
effects: PropTypes.object,
@@ -129,7 +141,14 @@ class Component extends React.Component<any, any> {
129141
<div className={`Login ${css(styles.container)}`}>
130142
<img src={require('assets/brand-image.svg')} alt="" className={`${css(styles.logo)}`} />
131143
<h1 className={`${css(styles.title)}`}>Admin Portal</h1>
132-
<h3 className={`${css(styles.title)}`}>Login with one of the following</h3>
144+
{
145+
KEYCLOAK_ENABLED && <KeycloakLogin />
146+
}
147+
{
148+
KEYCLOAK_ENABLED
149+
? <h3 className={`${css(styles.title)}`}>Or login with one of the following services</h3>
150+
: <h3 className={`${css(styles.title)}`}>Login with one of the following</h3>
151+
}
133152
<ul
134153
className={`${css({
135154
display: 'flex',
@@ -139,18 +158,21 @@ class Component extends React.Component<any, any> {
139158
padding: 0,
140159
})}`}
141160
>
142-
{providers.map(({ name, path, Icon }) => {
143-
return (
144-
<a
145-
key={name}
146-
href={`${API_ROOT}/oauth/login/${path}?client_id=${EGO_CLIENT_ID}`}
147-
className={`${css(styles.loginButton)}`}
148-
>
149-
<Icon width={15} height={15} />
150-
<span className={`${css({ paddingLeft: 10 })}`}>{name}</span>
151-
</a>
152-
);
153-
})}
161+
{providers
162+
.map(({ name, path, Icon }) => {
163+
return (
164+
<a
165+
key={name}
166+
href={`${API_ROOT}/oauth/login/${path}?client_id=${EGO_CLIENT_ID}`}
167+
className={`${css(styles.loginButton)}`}
168+
>
169+
{Icon !== undefined &&
170+
<Icon width={15} height={15} />
171+
}
172+
<span className={`${css({ paddingLeft: 10 })}`}>{name}</span>
173+
</a>
174+
);
175+
})}
154176
</ul>
155177
</div>
156178
);

0 commit comments

Comments
 (0)