authscape 1.0.6 → 1.0.7
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.
- package/package.json +28 -28
- package/pages/authentication/login.js +0 -23
- package/pages/authentication/logout.js +0 -18
- package/pages/authentication/signup.js +0 -18
- package/pages/signin-oidc.js +0 -79
- package/pages/signout-oidc.js +0 -23
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
-
},
|
|
10
|
-
"author": "zuechb",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@emotion/react": "^11.9.3",
|
|
14
|
-
"@emotion/styled": "^11.9.3",
|
|
15
|
-
"@mui/material": "^5.8.5",
|
|
16
|
-
"@stripe/react-stripe-js": "^1.9.0",
|
|
17
|
-
"@stripe/stripe-js": "^1.32.0",
|
|
18
|
-
"axios": "^0.27.2",
|
|
19
|
-
"js-file-download": "^0.4.12",
|
|
20
|
-
"next": "^12.1.6",
|
|
21
|
-
"next-cookies": "^2.0.3",
|
|
22
|
-
"nookies": "^2.5.2",
|
|
23
|
-
"querystring": "^0.2.1",
|
|
24
|
-
"react": "^18.2.0",
|
|
25
|
-
"react-data-table-component": "^7.5.2",
|
|
26
|
-
"react-dom": "^18.2.0"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "authscape",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"author": "zuechb",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@emotion/react": "^11.9.3",
|
|
14
|
+
"@emotion/styled": "^11.9.3",
|
|
15
|
+
"@mui/material": "^5.8.5",
|
|
16
|
+
"@stripe/react-stripe-js": "^1.9.0",
|
|
17
|
+
"@stripe/stripe-js": "^1.32.0",
|
|
18
|
+
"axios": "^0.27.2",
|
|
19
|
+
"js-file-download": "^0.4.12",
|
|
20
|
+
"next": "^12.1.6",
|
|
21
|
+
"next-cookies": "^2.0.3",
|
|
22
|
+
"nookies": "^2.5.2",
|
|
23
|
+
"querystring": "^0.2.1",
|
|
24
|
+
"react": "^18.2.0",
|
|
25
|
+
"react-data-table-component": "^7.5.2",
|
|
26
|
+
"react-dom": "^18.2.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { useRouter } from 'next/router';
|
|
3
|
-
import authService from '../../services/authService';
|
|
4
|
-
|
|
5
|
-
export default function Login() {
|
|
6
|
-
|
|
7
|
-
const router = useRouter();
|
|
8
|
-
|
|
9
|
-
useEffect(async () => {
|
|
10
|
-
if(!router.isReady) return;
|
|
11
|
-
|
|
12
|
-
await authService().login(router.query.redirecturl, router.query.deviceId);
|
|
13
|
-
|
|
14
|
-
}, [router.isReady]);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<div>
|
|
19
|
-
Please wait loading...
|
|
20
|
-
</div>
|
|
21
|
-
</>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import apiService from '../../services/apiService';
|
|
3
|
-
|
|
4
|
-
export default function LogoutPage({userLoaded}) {
|
|
5
|
-
|
|
6
|
-
useEffect(async () => {
|
|
7
|
-
|
|
8
|
-
await apiService().logout();
|
|
9
|
-
window.location.href = "/";
|
|
10
|
-
|
|
11
|
-
}, [userLoaded]);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div>
|
|
15
|
-
Please wait logging you out...
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { useRouter } from 'next/router'
|
|
3
|
-
import apiService from '../../services/apiService';
|
|
4
|
-
|
|
5
|
-
export default function SignUp() {
|
|
6
|
-
|
|
7
|
-
const router = useRouter()
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
|
|
11
|
-
apiService().signUp(router.query.redirecturl);
|
|
12
|
-
|
|
13
|
-
}, []);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div> </div>
|
|
17
|
-
);
|
|
18
|
-
}
|
package/pages/signin-oidc.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { useRouter } from 'next/router';
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import querystring from "querystring";
|
|
5
|
-
import { parseCookies, setCookie, destroyCookie } from 'nookies';
|
|
6
|
-
|
|
7
|
-
export default function SigninOidc() {
|
|
8
|
-
|
|
9
|
-
const router = useRouter();
|
|
10
|
-
useEffect(async () => {
|
|
11
|
-
if(!router.isReady) return;
|
|
12
|
-
|
|
13
|
-
let codeVerifier = window.localStorage.getItem("verifier");
|
|
14
|
-
if (router.query.code != null && codeVerifier != null)
|
|
15
|
-
{
|
|
16
|
-
const headers = {'Content-Type': 'application/x-www-form-urlencoded'}
|
|
17
|
-
|
|
18
|
-
let queryString = querystring.stringify({
|
|
19
|
-
code: router.query.code,
|
|
20
|
-
grant_type: "authorization_code",
|
|
21
|
-
redirect_uri: window.location.origin + "/signin-oidc",
|
|
22
|
-
client_id: process.env.client_id,
|
|
23
|
-
client_secret: process.env.client_secret,
|
|
24
|
-
code_verifier: codeVerifier
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
let response = await axios.post(process.env.AUTHORITYURI + '/connect/token', queryString, {
|
|
28
|
-
headers: headers
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
window.localStorage.removeItem("verifier");
|
|
32
|
-
|
|
33
|
-
let domain = process.env.cookieDomain;
|
|
34
|
-
|
|
35
|
-
await setCookie(null, "access_token", response.data.access_token,
|
|
36
|
-
{
|
|
37
|
-
maxAge: 2147483647,
|
|
38
|
-
path: '/',
|
|
39
|
-
domain: domain,
|
|
40
|
-
secure: true
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
await setCookie(null, "expires_in", response.data.expires_in,
|
|
44
|
-
{
|
|
45
|
-
maxAge: 2147483647,
|
|
46
|
-
path: '/',
|
|
47
|
-
domain: domain,
|
|
48
|
-
secure: true
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
52
|
-
{
|
|
53
|
-
maxAge: 2147483647,
|
|
54
|
-
path: '/',
|
|
55
|
-
domain: domain,
|
|
56
|
-
secure: true
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let redirectUri = localStorage.getItem("redirectUri")
|
|
61
|
-
localStorage.clear();
|
|
62
|
-
if (redirectUri != null)
|
|
63
|
-
{
|
|
64
|
-
window.location.href = redirectUri;
|
|
65
|
-
}
|
|
66
|
-
else
|
|
67
|
-
{
|
|
68
|
-
window.location.href = "/";
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}, [router.isReady]);
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<div>
|
|
76
|
-
Redirecting...
|
|
77
|
-
</div>
|
|
78
|
-
)
|
|
79
|
-
};
|
package/pages/signout-oidc.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
2
|
-
import { useRouter } from 'next/router'
|
|
3
|
-
|
|
4
|
-
function SignoutOidc() {
|
|
5
|
-
const router = useRouter();
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
async function signoutAsync() {
|
|
9
|
-
|
|
10
|
-
alert("need to remove items from local storage");
|
|
11
|
-
router.push('/');
|
|
12
|
-
}
|
|
13
|
-
signoutAsync()
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div>
|
|
18
|
-
Redirecting...
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default SignoutOidc
|