From 8e51d97872f77aa884cc5bf3370031177f93e454 Mon Sep 17 00:00:00 2001 From: "shengzhaoli.shengz" Date: Tue, 24 Oct 2023 11:56:26 +0800 Subject: [PATCH] JWT_BEARER flow --- .../sos/service/JwtBearerFlowTest.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/monkeyk/sos/service/JwtBearerFlowTest.java b/src/test/java/com/monkeyk/sos/service/JwtBearerFlowTest.java index 40f9729..4a9d9e1 100644 --- a/src/test/java/com/monkeyk/sos/service/JwtBearerFlowTest.java +++ b/src/test/java/com/monkeyk/sos/service/JwtBearerFlowTest.java @@ -22,14 +22,14 @@ public class JwtBearerFlowTest { /** - * MAC 生成 token + * MAC 生成 assertion * HS256 * method: CLIENT_SECRET_JWT * * @throws Exception e */ @Test - void macToken() throws Exception { + void macAssertion() throws Exception { String clientId = "vLIXDF9GXg6Psfh1uzwVFUj0fucX2Zn9"; // client_secret 加密后的值 @@ -53,9 +53,24 @@ public class JwtBearerFlowTest { //签名 jwsObject.sign(jwsSigner); - String idToken = jwsObject.serialize(); - assertNotNull(idToken); - System.out.println(idToken); + // 将 assertion 复制放到请求参数 client_assertion 的值 + String assertion = jwsObject.serialize(); + assertNotNull(assertion); +// System.out.println(assertion); + + } + + + /** + * RSA 生成 assertion + * SignatureAlgorithm: RS256 + * method: PRIVATE_KEY_JWT + * + * @throws Exception e + */ + void rs256Assertion() throws Exception { + + }