JSRS saved teh day with JWT
This commit is contained in:
parent
ce1c02cd04
commit
b9f6f45ac5
2 changed files with 19 additions and 2 deletions
|
@ -6,6 +6,9 @@
|
||||||
<link rel="icon" href="../Icons/favicon.ico" />
|
<link rel="icon" href="../Icons/favicon.ico" />
|
||||||
<link rel="stylesheet" href="../CSS/mail.css">
|
<link rel="stylesheet" href="../CSS/mail.css">
|
||||||
<script type="module" src="../JS/mail.js"></script>
|
<script type="module" src="../JS/mail.js"></script>
|
||||||
|
<!-- Dependenci -->
|
||||||
|
<script language="JavaScript" type="text/javascript" src="https://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js">
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="margin: 0px; text-align: center;">
|
<body style="margin: 0px; text-align: center;">
|
||||||
|
|
|
@ -41,8 +41,22 @@ export async function CreatePAR() {
|
||||||
|
|
||||||
// Component 4/7
|
// Component 4/7
|
||||||
export async function ClientDPoP() {
|
export async function ClientDPoP() {
|
||||||
let KeyPair = await crypto.subtle.generateKey({name: "ECDSA", namedCurve: "P-256"}, true, ["sign", "verify"]);
|
// Header
|
||||||
console.log(KeyPair);
|
var Header = {alg: 'HS256', typ: 'JWT', };
|
||||||
|
// Payload
|
||||||
|
var Payload = {};
|
||||||
|
var tNow = KJUR.jws.IntDate.get('now');
|
||||||
|
Payload.iss = "http://foo.com";
|
||||||
|
Payload.sub = "mailto:mike@foo.com";
|
||||||
|
Payload.nbf = tNow;
|
||||||
|
Payload.iat = tNow;
|
||||||
|
Payload.jti = "id123456";
|
||||||
|
Payload.aud = "http://foo.com/employee";
|
||||||
|
// Sign JWT, password=616161
|
||||||
|
var sHeader = JSON.stringify(Header);
|
||||||
|
var sPayload = JSON.stringify(Payload);
|
||||||
|
var JWT = KJUR.jws.JWS.sign("HS256", sHeader, sPayload, "616161");
|
||||||
|
console.log(JWT);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function ServerDPoP() {
|
export async function ServerDPoP() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue