FAQ | This is a LIVE service | Changelog

Skip to content

enable sign in via OAuth2 token

Dr Rich Wareham requested to merge github/fork/rjw57/add-oauth2-sign-in into master

Add redux-implicit-oauth2 and configure a basic sign in flow using a redux store. The OAuth2 flow is pre-configured to make use of our experimental OAuth2 deployment. It is left as an open question of where central configuration information should live for the application.

See [0] for an introduction to the basics of Redux and how it is used in React apps.

In order to render the Sign In page if the user is not logged in, the existing Route-s are replaced with a LoginRequiredRoute which examines the current store to determine if the user is logged in. If not, they display the sign in page.

In order to allow the sign in page to not have a sidebar, the components are re-jigged a little to be contained within a common "Page" component which renders the sidebar. The LoginPage component does not use the "Page" component and hence does not have a sifebar.

Add the react-styleguidist package which provides browsable documentation for the components. See [1] for information on how to document components.

The OAuth2 implicit flow implementation examines window.localStorage when the page is rendered to determine if an auth token is present. This does not exist by default in our test environment and so it is mocked for those tests which require it.

[0] https://redux.js.org/docs/basics/ [1] https://react-styleguidist.js.org/docs/documenting.html

Merge request reports

Loading