@axa-fr/react-oidc 5.7.0-aplha0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -18
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <H1> @axa-fr/react-oidc-context</H1>
1
+ <H1> @axa-fr/react-oidc</H1>
2
2
 
3
3
  Try the demo at https://black-rock-0dc6b0d03.1.azurestaticapps.net/
4
4
 
@@ -19,8 +19,8 @@ Try the demo at https://black-rock-0dc6b0d03.1.azurestaticapps.net/
19
19
  - [How It Works](#how-it-works)
20
20
  - [Service Worker Support](#service-worker-support)
21
21
 
22
- Easy set up of OIDC for react and use the new react context api as state management.
23
- It use AppAuthJS behind the scene.
22
+ Easy set up of OIDC for react.
23
+ It use AppAuthJS behind the scene because it very lightweight and created by openid certification team. oidc-client use in V3 is heavy and not longer maintained.
24
24
 
25
25
  - **Secure** :
26
26
  - With the use of Service Worker, your tokens (refresh_token and access_token) are not accessible to the javascript client code (big protection against XSRF attacks)
@@ -30,11 +30,11 @@ It use AppAuthJS behind the scene.
30
30
  - refresh_token and access_token are auto refreshed in background
31
31
  - with the use of the Service Worker, you do not need to inject the access_token in every fetch, you have only to configure OidcTrustedDomains.js file
32
32
  - **No cookies problem** : You can disable silent signin (that internally use an iframe)
33
- - **Multiple Authentification** :
34
- - You can authenticate many times to the same provider with different scope (for exemple you can acquire a new 'payment' scope for a payment)
33
+ - **Multiple Authentication** :
34
+ - You can authenticate many times to the same provider with different scope (for example you can acquire a new 'payment' scope for a payment)
35
35
  - You can authenticate to multiple different providers inside the same SPA (single page application) website
36
36
  - **Flexible** :
37
- - Work with Service Worker (more secure) and whithout for older browser (less secure)
37
+ - Work with Service Worker (more secure) and without for older browser (less secure)
38
38
 
39
39
  <p align="center">
40
40
  <img src="https://github.com/AxaGuilDEv/react-oidc/blob/master/docs/img/schema_pcke_client_side_with_service_worker.png?raw=true"
@@ -47,7 +47,7 @@ It use AppAuthJS behind the scene.
47
47
  # Getting Started
48
48
 
49
49
  ```sh
50
- npm install @axa-fr/react-oidc-context copyfiles --save
50
+ npm install @axa-fr/react-oidc copyfiles --save
51
51
  ```
52
52
 
53
53
  If you need a very secure mode where refresh_token and access_token will be hide behind a service worker that will proxify requests.
@@ -59,7 +59,7 @@ The only file you should edit is "OidcTrustedDomains.js" which will never be era
59
59
  #package.json
60
60
  {
61
61
  "scripts": {
62
- "copy": "copyfiles -f ./node_modules/@axa-fr/react-oidc-context/dist/OidcServiceWorker.js ./public && copyfiles -f -s ./node_modules/@axa-fr/react-oidc-context/dist/OidcTrustedDomains.js ./public",
62
+ "copy": "copyfiles -f ./node_modules/@axa-fr/react-oidc/dist/OidcServiceWorker.js ./public && copyfiles -f -s ./node_modules/@axa-fr/react-oidc/dist/OidcTrustedDomains.js ./public",
63
63
  "start:server": "react-scripts start",
64
64
  "build:server": "npm run copy && react-scripts build",
65
65
  "prepare": "npm run copy"
@@ -79,7 +79,7 @@ const trustedDomains = {
79
79
 
80
80
  ```sh
81
81
  git clone https://github.com/AxaGuilDEv/react-oidc.git
82
- cd react-oidc/packages/context
82
+ cd react-oidc/packages/react
83
83
  npm install
84
84
  npm start
85
85
  # then navigate to http://localhost:4200
@@ -99,7 +99,7 @@ The default routes used internally :
99
99
  import React from 'react';
100
100
  import { render } from 'react-dom';
101
101
  import { BrowserRouter as Router } from 'react-router-dom';
102
- import { OidcProvider } from '@axa-fr/react-oidc-context';
102
+ import { OidcProvider } from '@axa-fr/react-oidc';
103
103
  import Header from './Layout/Header';
104
104
  import Routes from './Router';
105
105
 
@@ -197,7 +197,7 @@ The Hook method exposes :
197
197
 
198
198
  ```javascript
199
199
  import React from 'react';
200
- import { OidcSecure } from '@axa-fr/react-oidc-context';
200
+ import { OidcSecure } from '@axa-fr/react-oidc';
201
201
 
202
202
  const AdminSecure = () => (
203
203
  <OidcSecure>
@@ -216,7 +216,7 @@ export default AdminSecure;
216
216
  ```javascript
217
217
  import React from 'react';
218
218
  import { Switch, Route } from 'react-router-dom';
219
- import { withOidcSecure } from '@axa-fr/react-oidc-context';
219
+ import { withOidcSecure } from '@axa-fr/react-oidc';
220
220
  import Home from '../Pages/Home';
221
221
  import Dashboard from '../Pages/Dashboard';
222
222
  import Admin from '../Pages/Admin';
@@ -236,7 +236,7 @@ export default Routes;
236
236
  ## How to get "Access Token" : Hook method
237
237
 
238
238
  ```javascript
239
- import { useOidcAccessToken } from '@axa-fr/react-oidc-context';
239
+ import { useOidcAccessToken } from '@axa-fr/react-oidc';
240
240
 
241
241
  const DisplayAccessToken = () => {
242
242
  const{ accessToken, accessTokenPayload } = useOidcAccessToken();
@@ -260,7 +260,7 @@ const DisplayAccessToken = () => {
260
260
  ## How to get IDToken : Hook method
261
261
 
262
262
  ```javascript
263
- import { useOidcIdToken } from '@axa-fr/react-oidc-context';
263
+ import { useOidcIdToken } from '@axa-fr/react-oidc';
264
264
 
265
265
  const DisplayIdToken =() => {
266
266
  const{ idToken, idTokenPayload } = useOidcIdToken();
@@ -286,7 +286,7 @@ const DisplayIdToken =() => {
286
286
  ## How to get User Information : Hook method
287
287
 
288
288
  ```javascript
289
- import { useOidcUser, UserStatus } from '@axa-fr/react-oidc-context';
289
+ import { useOidcUser, UserStatus } from '@axa-fr/react-oidc';
290
290
 
291
291
  const DisplayUserInfo = () => {
292
292
  const{ oidcUser, oidcUserLoadingState } = useOidcUser();
@@ -319,7 +319,7 @@ This Hook give you a wrapped fetch that add the access token for you.
319
319
 
320
320
  ```javascript
321
321
  import React, {useEffect, useState} from 'react';
322
- import { useOidcFetch, OidcSecure } from '@axa-fr/react-oidc-context';
322
+ import { useOidcFetch, OidcSecure } from '@axa-fr/react-oidc';
323
323
 
324
324
  const DisplayUserInfo = ({ fetch }) => {
325
325
  const [oidcUser, setOidcUser] = useState(null);
@@ -375,7 +375,7 @@ This HOC give you a wrapped fetch that add the access token for you.
375
375
 
376
376
  ```javascript
377
377
  import React, {useEffect, useState} from 'react';
378
- import { useOidcFetch, OidcSecure } from '@axa-fr/react-oidc-context';
378
+ import { useOidcFetch, OidcSecure } from '@axa-fr/react-oidc';
379
379
 
380
380
  const DisplayUserInfo = ({ fetch }) => {
381
381
  const [oidcUser, setOidcUser] = useState(null);
@@ -433,7 +433,7 @@ All components definition receive props "configurationName". Please checkout and
433
433
  import React from 'react';
434
434
  import { render } from 'react-dom';
435
435
  import { BrowserRouter as Router } from 'react-router-dom';
436
- import { OidcProvider } from '@axa-fr/react-oidc-context';
436
+ import { OidcProvider } from '@axa-fr/react-oidc';
437
437
  import Header from './Layout/Header';
438
438
  import Routes from './Router';
439
439
 
@@ -489,6 +489,7 @@ render(<App />, document.getElementById('root'));
489
489
 
490
490
  These components encapsulate the use of "AppAuth-JS" in order to hide workfow complexity.
491
491
  Internally, native History API is used to be router library agnostic.
492
+ It use AppAuthJS behind the scene because it very lightweight and created by openid certification team. oidc-client used in V3 is heavy and not longer maintained.
492
493
 
493
494
  More information about OIDC
494
495
  - French: https://medium.com/just-tech-it-now/augmentez-la-s%C3%A9curit%C3%A9-et-la-simplicit%C3%A9-de-votre-syst%C3%A8me-dinformation-avec-oauth-2-0-cf0732d71284
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/react-oidc",
3
- "version": "5.7.0-aplha0",
3
+ "version": "5.7.0",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "jsnext:main": "dist/index.js",