diff --git a/.github/workflows/release-build-publish.yaml b/.github/workflows/release-build-publish.yaml
index 5abb2c7..7fa760a 100644
--- a/.github/workflows/release-build-publish.yaml
+++ b/.github/workflows/release-build-publish.yaml
@@ -88,8 +88,12 @@ jobs:
- name: Build image
run: docker build . --file docker/Dockerfile --tag "p8e-ui:$VERSION"
- - name: Log into registry
- run: echo "${{ secrets.DOCKER_REGISTRY_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Push image
run: |
@@ -103,3 +107,11 @@ jobs:
docker tag "p8e-ui:$VERSION" $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
+
+ PRERELEASE=${{ github.event.release.prerelease }}
+ echo PRERELEASE=$PRERELEASE
+
+ if [ "$PRERELEASE" == "false" ]; then
+ docker tag "p8e-ui:$VERSION" $IMAGE_ID:latest
+ docker push $IMAGE_ID:latest
+ fi
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index 6f29b53..b890cb0 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,41 +1,17 @@
-import React, { useEffect } from 'react';
+import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import DashboardContainer from 'components/Dashboard/DashboardContainer';
import { ContractContainer, ContractListContainer } from 'components/Contract';
-import { LoginContainer } from 'components/Login';
import { KeyManagerContainer, AddServiceKeyModal } from 'components/KeyManagement';
-import { OAuthCallback } from 'components/OAuth';
import KeyDetailsContainer from 'components/KeyManagement/KeyDetailsContainer';
import { ScopeContainer, ScopeHistoryContainer, ScopeListContainer } from 'components/Scopes';
import { Settings } from 'Constant';
-import { useDeepLink } from 'hooks';
-
-const App = ({ isAuthenticated }) => {
- const { performDeepLink } = useDeepLink();
-
- useEffect(() => {
- if (isAuthenticated) {
- performDeepLink();
- }
- }, [isAuthenticated, performDeepLink]);
-
- if (!isAuthenticated) {
- return (
- <>
-
-
-
-
- >
- );
- }
+const App = () => {
return (
<>
- {/* */}
- {/* */}
diff --git a/src/AppContainer.tsx b/src/AppContainer.tsx
index 7c72b66..790d164 100644
--- a/src/AppContainer.tsx
+++ b/src/AppContainer.tsx
@@ -1,14 +1,10 @@
import React from 'react';
-import { useSelector } from 'react-redux';
import App from 'App';
import { ErrorCardContainer } from 'components/ErrorCards';
export const AppContainer = () => {
- const { jwt } = useSelector(({ identityReducer }) => identityReducer);
- const isAuthenticated = typeof jwt === 'string' && jwt.length > 0;
-
return (<>
-
+
>);
}
\ No newline at end of file
diff --git a/src/Constant/identity.ts b/src/Constant/identity.ts
deleted file mode 100644
index 7dd4790..0000000
--- a/src/Constant/identity.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const OAUTH_URL = 'https://test.provenance.io/login/oauth/authorize';
\ No newline at end of file
diff --git a/src/actions/identity-actions.ts b/src/actions/identity-actions.ts
deleted file mode 100644
index fcada20..0000000
--- a/src/actions/identity-actions.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { createAction } from "redux-actions";
-import { P8E_URL } from "Constant/http";
-import { addError } from "./error-actions";
-import { ajaxGet } from "./xhr-actions";
-
-const BASE_URL = `${P8E_URL}/external/api/v1/provenance/oauth`;
-
-export const LOGOUT = 'IDENTITY::LOGOUT';
-export const OAUTH_LOGIN = 'IDENTITY::OAUTH_LOGIN';
-export const OAUTH_TOKEN_EXCHANGE = 'IDENTITY::OAUTH_TOKEN_EXCHANGE';
-export const LOGIN = 'IDENTITY::LOGIN';
-
-export const logout = () => async dispatch => dispatch(createAction(LOGOUT)());
-
-export const oauthLogin = (redirectUrl: string) => async dispatch => ajaxGet(OAUTH_LOGIN, dispatch, `${BASE_URL}?redirectUrl=${redirectUrl}`)
- .then(({ url }) => window.location.href = url);
-
-export const oauthTokenExchange = (code, state) => async dispatch => ajaxGet(OAUTH_TOKEN_EXCHANGE, dispatch, `${BASE_URL}/callback`, { params: { code, state } })
- .then(({ access_token, cookie_name }) => dispatch(login(access_token)))
- .catch((err) => {
- err.data.errors.forEach(error => dispatch(addError(error)))
- return Promise.reject(err);
- });
-
-export const login = (jwt: string) => async dispatch => dispatch(createAction(LOGIN)(jwt));
\ No newline at end of file
diff --git a/src/components/Layout/Menu/MenuContainer.tsx b/src/components/Layout/Menu/MenuContainer.tsx
index e92d7db..9cbe673 100644
--- a/src/components/Layout/Menu/MenuContainer.tsx
+++ b/src/components/Layout/Menu/MenuContainer.tsx
@@ -1,8 +1,6 @@
import React from 'react';
-import { useDispatch } from 'react-redux';
import { withRouter } from 'react-router-dom';
-import { logout } from 'actions/identity-actions';
-import { Menu, MenuLink, MenuLinkText, MenuListItem } from './index';
+import { Menu, MenuLink } from './index';
import { Location } from 'history';
type MenuContainerProps = {
@@ -10,11 +8,6 @@ type MenuContainerProps = {
}
const MenuContainer = ({ location }) => {
- const dispatch = useDispatch();
- const handleLogout = () => {
- dispatch(logout());
- };
-
return (
@@ -22,9 +15,6 @@ const MenuContainer = ({ location }) => {
-
- Logout
-
);
diff --git a/src/components/Login/LoginContainer.tsx b/src/components/Login/LoginContainer.tsx
deleted file mode 100644
index a7e329b..0000000
--- a/src/components/Login/LoginContainer.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react';
-import { useDispatch } from 'react-redux';
-import PageLayout from 'components/Layout/PageLayout';
-import styled from 'styled-components';
-import { oauthLogin } from 'actions/identity-actions';
-import { IconButton } from 'components/Button';
-import { currentLocation } from 'helpers/general';
-import { Sprite } from 'components/Sprite';
-import { useDeepLink } from 'hooks';
-
-const Container = styled.div`
- display: flex;
- flex-grow: 1;
- align-items: center;
- justify-content: center;
-`;
-
-export const LoginContainer = () => {
- const dispatch = useDispatch();
- const { location, setDeepLinkLocation } = useDeepLink();
-
- const handleLogin = () => {
- setDeepLinkLocation(location.pathname);
- dispatch(oauthLogin(currentLocation()))
- };
-
- return
-
-
- Login with Provenance
-
-
-
-};
\ No newline at end of file
diff --git a/src/components/Login/index.ts b/src/components/Login/index.ts
deleted file mode 100644
index c0aa29e..0000000
--- a/src/components/Login/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { LoginContainer } from './LoginContainer';
\ No newline at end of file
diff --git a/src/components/OAuth/OAuthCallback.tsx b/src/components/OAuth/OAuthCallback.tsx
deleted file mode 100644
index 4aed68d..0000000
--- a/src/components/OAuth/OAuthCallback.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React, { useEffect } from 'react';
-import { withRouter } from 'react-router-dom';
-import { useDispatch } from 'react-redux';
-import { parseParams } from 'helpers/params';
-import { Loader } from 'components/Loader/Loader';
-import { oauthTokenExchange } from 'actions/identity-actions';
-
-const OAuthCallback = ({ location, history }) => {
- const { code, state } = parseParams(location.search);
- const dispatch = useDispatch();
-
- useEffect(() => {
- dispatch(oauthTokenExchange(code, state)).catch(() => history.push('/'))
- }, [code, state, dispatch, history])
-
- return
-}
-
-export default withRouter(OAuthCallback);
\ No newline at end of file
diff --git a/src/components/OAuth/index.ts b/src/components/OAuth/index.ts
deleted file mode 100644
index 1b9f006..0000000
--- a/src/components/OAuth/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as OAuthCallback } from './OAuthCallback';
\ No newline at end of file
diff --git a/src/interceptors/401-interceptor.ts b/src/interceptors/401-interceptor.ts
deleted file mode 100644
index 60728fc..0000000
--- a/src/interceptors/401-interceptor.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import store from 'store';
-import { logout } from 'actions/identity-actions';
-import { addError, ErrorLevels } from 'actions/error-actions';
-import debounce from 'lodash.debounce';
-import { axios } from 'actions';
-
-const handle401 = debounce(() => {
- store.dispatch(addError('Unauthenticated, please log in again', ErrorLevels.WARNING));
- store.dispatch(logout());
-}, 1000)
-
-export const setup401Interceptor = () => {
- axios.interceptors.response.use(response => response,
- error => {
- const response = error.response;
- if (response?.status === 401) {
- handle401();
- }
-
- throw error;
- })
-}
\ No newline at end of file
diff --git a/src/interceptors/index.ts b/src/interceptors/index.ts
deleted file mode 100644
index 7aecccc..0000000
--- a/src/interceptors/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { setupJwtInterceptor } from './jwt-interceptor';
-export { setup401Interceptor } from './401-interceptor';
\ No newline at end of file
diff --git a/src/interceptors/jwt-interceptor.ts b/src/interceptors/jwt-interceptor.ts
deleted file mode 100644
index e475fea..0000000
--- a/src/interceptors/jwt-interceptor.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import store from 'store';
-import { jwtStorageKey } from 'reducers/identity-reducer';
-import { logout, login } from 'actions/identity-actions';
-import { axios } from 'actions';
-
-const storeJwt = (): string | null => store.getState()?.identityReducer?.jwt;
-
-const getInterceptor = (jwt?: string) => config => {
- config = {
- ...config,
- headers: {
- ...config.headers,
- Authorization: `Bearer ${jwt}`
- }
- }
-
- return config;
-};
-
-let interceptor;
-export const setupJwtInterceptor = (jwt: string = '') => {
- if (interceptor !== undefined) {
- axios.interceptors.request.eject(interceptor);
- }
-
- interceptor = axios.interceptors.request.use(getInterceptor(jwt));
-}
-
-axios.interceptors.response.use(response => {
- if (response?.headers?.authorization) {
- store.dispatch(login(response.headers.authorization))
- }
- return response;
-})
-
-window.addEventListener('storage', (e) => {
- if (!e.key || e.key === jwtStorageKey) {
- const exitingJwt = storeJwt();
- const newJwt = window.localStorage.getItem(jwtStorageKey);
-
- if (exitingJwt && !newJwt) {
- store.dispatch(logout());
- } else if (newJwt && exitingJwt !== newJwt) {
- store.dispatch(login(newJwt));
- }
- }
-})
\ No newline at end of file
diff --git a/src/reducers/identity-reducer.ts b/src/reducers/identity-reducer.ts
deleted file mode 100644
index bcff56b..0000000
--- a/src/reducers/identity-reducer.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { handleActions } from "redux-actions"
-import { LOGOUT, LOGIN } from "actions/identity-actions";
-import { setupJwtInterceptor } from "interceptors";
-
-export const jwtStorageKey = 'jwt';
-
-const initialState = (() => {
- const storedJwt = window.localStorage.getItem(jwtStorageKey);
- setupJwtInterceptor(storedJwt || '');
-
- return {
- jwt: storedJwt || '',
- };
-})();
-
-const identityReducer = handleActions({
- [LOGOUT]: (state, action) => {
- window.localStorage.setItem(jwtStorageKey, '');
- setupJwtInterceptor();
-
- return {
- ...state,
- jwt: ''
- }
- },
- [LOGIN]: (state, { payload: jwt }) => {
- window.localStorage.setItem(jwtStorageKey, jwt);
- setupJwtInterceptor(jwt);
-
- return {
- ...state,
- jwt
- }
- }
-}, initialState);
-
-export default identityReducer;
\ No newline at end of file
diff --git a/src/reducers/index.ts b/src/reducers/index.ts
index 69d3b9b..198d08f 100644
--- a/src/reducers/index.ts
+++ b/src/reducers/index.ts
@@ -2,7 +2,6 @@ import { default as contractReducer } from './contract-reducer';
import { default as scopeReducer } from './scope-reducer';
import { default as objectReducer } from './object-reducer';
import { default as keyReducer } from './key-reducer';
-import { default as identityReducer } from './identity-reducer';
import { default as errorReducer } from './error-reducer';
export default {
@@ -10,6 +9,5 @@ export default {
scopeReducer,
objectReducer,
keyReducer,
- identityReducer,
errorReducer,
};
diff --git a/src/store/index.js b/src/store/index.js
index 71bbc69..c9660c1 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,7 +1,6 @@
import { applyMiddleware, createStore, combineReducers, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from 'reducers';
-import { setup401Interceptor } from 'interceptors';
const middleware = [
thunk, // thunk middleware allows us to return promises from and receive dispatch reference in redux action creators.
@@ -23,6 +22,4 @@ const composedEnhancers = compose(applyMiddleware(...middleware), ...enhancers);
const store = createStore(combineReducers({ ...rootReducer }), preloadedState, composedEnhancers);
-setup401Interceptor();
-
export default store;