[java-idp-plugin-oidc-rp] branch main updated: Add more tests

Phil Smart philip.smart at jisc.ac.uk
Mon Sep 12 14:07:52 UTC 2022


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-idp-plugin-oidc-rp.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=5a00e6597466318037afec2760aaa9234f9253d2

The following commit(s) were added to refs/heads/main by this push:
     new 5a00e65  Add more tests
5a00e65 is described below

commit 5a00e6597466318037afec2760aaa9234f9253d2
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Sep 12 15:07:46 2022 +0100

    Add more tests
---
 .../authn/oidc/rp/messaging/impl/AddStateTest.java |  94 +++++++
 .../impl/BuildPlainRequestObjectJWTTest.java       |  96 +++++++
 .../oidc/rp/messaging/impl/EncryptJWTTest.java     | 310 +++++++++++++++++++++
 3 files changed, 500 insertions(+)

diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddStateTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddStateTest.java
new file mode 100644
index 0000000..e3ad43c
--- /dev/null
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddStateTest.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Date;
+
+import org.apache.commons.codec.binary.Hex;
+import org.opensaml.messaging.handler.MessageHandlerException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.nimbusds.jwt.JWTClaimsSet;
+import com.nimbusds.jwt.PlainJWT;
+import com.nimbusds.oauth2.sdk.id.ClientID;
+
+import net.shibboleth.idp.plugin.authn.oidc.rp.context.OutboundMessageHandlerContext;
+import net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractOIDCTest;
+import net.shibboleth.oidc.profile.core.OIDCAuthenticationRequest;
+
+/** Tests for AddState.*/
+public class AddStateTest extends AbstractOIDCTest {
+    
+    /** The SWF key.*/
+    private static final String SWF_KEY = "s1e1";
+    
+    /** The message handler to test.*/
+    private AddState handler;
+    
+    /** The authn request.*/
+    private OIDCAuthenticationRequest request;
+    
+    /** The outbound handler context.*/
+    private OutboundMessageHandlerContext handlerContext;
+    
+    @Override
+    @BeforeMethod
+    public void setup() throws Exception {
+        super.setup();
+        handler = new AddState();
+        
+        request = new OIDCAuthenticationRequest(new ClientID("test-client"));
+        final JWTClaimsSet claims = new JWTClaimsSet.Builder()
+                .issuer("test-client")
+                .audience("test-op")
+                .issueTime(new Date())
+                .build();
+        request.setRequestObject(new PlainJWT(claims));
+        
+        prc.getOutboundMessageContext().setMessage(request);
+        handlerContext = new OutboundMessageHandlerContext(SWF_KEY);
+        prc.getOutboundMessageContext().addSubcontext(handlerContext);
+    }
+    
+    @Test
+    public void testSuccess() throws Exception {
+        handler.initialize();
+        handler.invoke(prc.getOutboundMessageContext());
+        
+        assertTrue(prc.getOutboundMessageContext().getMessage() instanceof OIDCAuthenticationRequest);
+        assertNotNull(request.getState());
+        
+        final var keyHex = Hex.encodeHexString(SWF_KEY.getBytes());
+        
+        assertTrue(request.getState().getValue().contains("."));
+        assertEquals(request.getState().getValue().split("\\.").length, 2);
+        assertTrue(request.getState().getValue().split("\\.")[1].equals(keyHex));
+    }
+    
+    @Test(expectedExceptions = MessageHandlerException.class)
+    public void testFailure_NoOutBoundContext() throws Exception {
+        prc.getOutboundMessageContext().removeSubcontext(OutboundMessageHandlerContext.class);
+        handler.initialize();
+        handler.invoke(prc.getOutboundMessageContext());
+    }
+
+}
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/BuildPlainRequestObjectJWTTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/BuildPlainRequestObjectJWTTest.java
new file mode 100644
index 0000000..b92920d
--- /dev/null
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/BuildPlainRequestObjectJWTTest.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.nimbusds.oauth2.sdk.id.Audience;
+import com.nimbusds.oauth2.sdk.id.ClientID;
+import com.nimbusds.oauth2.sdk.id.Issuer;
+import com.nimbusds.openid.connect.sdk.claims.ClaimsSet;
+
+import net.shibboleth.idp.plugin.authn.oidc.rp.context.OutboundMessageHandlerContext;
+import net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractOIDCTest;
+import net.shibboleth.oidc.profile.core.OIDCAuthenticationRequest;
+
+/** Tests for BuildPlainRequestObjectJWT.*/
+public class BuildPlainRequestObjectJWTTest extends AbstractOIDCTest {
+    
+    /** The SWF key.*/
+    private static final String SWF_KEY = "s1e1";
+    
+    /** The message handler to test.*/
+    private BuildPlainRequestObjectJWT handler;
+    
+    /** The authn request.*/
+    private OIDCAuthenticationRequest request;
+    
+    /** The outbound handler context.*/
+    private OutboundMessageHandlerContext handlerContext;
+    
+    @Override
+    @BeforeMethod
+    public void setup() throws Exception {
+        super.setup();
+        handler = new BuildPlainRequestObjectJWT();
+        
+        request = new OIDCAuthenticationRequest(new ClientID("test-client"));
+
+        handlerContext = new OutboundMessageHandlerContext(SWF_KEY);
+        prc.getOutboundMessageContext().addSubcontext(handlerContext);
+        prc.getOutboundMessageContext().setMessage(request);
+        
+        final var claims = new ClaimsSet();
+        claims.setAudience(new Audience("https://op.example.com"));
+        claims.setIssuer(new Issuer("https://rp.example.com"));
+        claims.setClaim("redirect_uri", "http://rp.example.com/callback");
+        
+        request.setRequestObjectClaimsSet(claims);
+
+    }
+    
+    @Test
+    public void testSuccess() throws Exception {
+        handler.initialize();
+        handler.invoke(prc.getOutboundMessageContext());
+        
+        assertTrue(prc.getOutboundMessageContext().getMessage() instanceof OIDCAuthenticationRequest);
+        assertNotNull(request.getRequestObject());
+        assertTrue(request.getRequestObject().getJWTClaimsSet().getAudience().get(0).equals("https://op.example.com"));
+        assertTrue(request.getRequestObject().getJWTClaimsSet().getIssuer().equals("https://rp.example.com"));
+        assertTrue(request.getRequestObject().getJWTClaimsSet().getClaim("redirect_uri")
+                .equals("http://rp.example.com/callback"));
+    }
+    
+    @Test
+    public void testFail_NoClaims() throws Exception {
+        request.setRequestObjectClaimsSet(null);
+        handler.initialize();
+        handler.invoke(prc.getOutboundMessageContext());
+        
+        assertTrue(prc.getOutboundMessageContext().getMessage() instanceof OIDCAuthenticationRequest);
+        assertNull(request.getRequestObject());
+    }
+  
+
+}
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/EncryptJWTTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/EncryptJWTTest.java
new file mode 100644
index 0000000..4ba0609
--- /dev/null
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/EncryptJWTTest.java
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl;
+
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.text.ParseException;
+import java.util.Date;
+
+import javax.annotation.Nonnull;
+
+import org.opensaml.messaging.handler.MessageHandlerException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.nimbusds.jose.JWEAlgorithm;
+import com.nimbusds.jose.JWEObject.State;
+import com.nimbusds.jose.Payload;
+import com.nimbusds.jose.crypto.AESDecrypter;
+import com.nimbusds.jose.crypto.DirectDecrypter;
+import com.nimbusds.jose.crypto.ECDHDecrypter;
+import com.nimbusds.jose.crypto.RSADecrypter;
+import com.nimbusds.jose.jwk.Curve;
+import com.nimbusds.jose.jwk.ECKey;
+import com.nimbusds.jose.jwk.KeyUse;
+import com.nimbusds.jose.jwk.RSAKey;
+import com.nimbusds.jose.jwk.gen.ECKeyGenerator;
+import com.nimbusds.jose.jwk.gen.RSAKeyGenerator;
+import com.nimbusds.jwt.EncryptedJWT;
+import com.nimbusds.jwt.JWT;
+import com.nimbusds.jwt.JWTClaimsSet;
+import com.nimbusds.jwt.PlainJWT;
+import com.nimbusds.jwt.SignedJWT;
+import com.nimbusds.oauth2.sdk.id.ClientID;
+import com.nimbusds.openid.connect.sdk.claims.ClaimsSet;
+
+import net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractOIDCTest;
+import net.shibboleth.idp.plugin.authn.oidc.rp.impl.TestCredentialHelper;
+import net.shibboleth.oidc.jwa.support.EncryptionConstants;
+import net.shibboleth.oidc.jwa.support.KeyManagementConstants;
+import net.shibboleth.oidc.profile.core.OIDCAuthenticationRequest;
+import net.shibboleth.oidc.security.JWTEncryptionParameters;
+import net.shibboleth.oidc.security.context.JWTSecurityParametersContext;
+
+/** 
+ * Tests for the {@link EncryptJWT} message handler. 
+ * 
+ * <p>Note, These tests encrypt a RequestObject. </p>
+ */
+public class EncryptJWTTest extends AbstractOIDCTest {
+    
+    /** A client_secret to use.*/
+    @Nonnull private static final String CLIENT_SECRET = "Xp2s5v8y/B?E(H+MbQeThWmYq3t6w9z$";
+    
+    /** The signer to test.*/
+    private EncryptJWT encrypter;
+    
+    /** The authn request.*/
+    private OIDCAuthenticationRequest request;
+    
+    @Override
+    @BeforeMethod
+    public void setup() throws Exception {
+        super.setup();
+        encrypter = new EncryptJWT();
+        
+        encrypter.setPayloadToEncryptLookupStrategy(mc -> {
+            final OIDCAuthenticationRequest authnRequest = (OIDCAuthenticationRequest)mc.getMessage();
+            if (authnRequest.getRequestObject() instanceof SignedJWT) {
+                return new Payload((SignedJWT) authnRequest.getRequestObject());
+            } else if (authnRequest.getRequestObject() instanceof PlainJWT) {
+                try {
+                    return new Payload(authnRequest.getRequestObject().getJWTClaimsSet().getClaims());
+                } catch (final ParseException e) {
+                    fail();
+                }
+            }
+            return null;
+        });
+        encrypter.setJwtUpdateConsumer((jwt, mc) -> {
+            final OIDCAuthenticationRequest ar = (OIDCAuthenticationRequest)mc.getMessage();
+            ar.setRequestObject(jwt);
+        });
+        
+        request = new OIDCAuthenticationRequest(new ClientID("test-client"));
+        final JWTClaimsSet claims = new JWTClaimsSet.Builder()
+                .issuer("https://rp.example.com")
+                .audience("https://op.example.com")
+                .issueTime(new Date())
+                .build();
+        request.setRequestObject(new PlainJWT(claims));
+        
+        prc.getOutboundMessageContext().setMessage(request);
+    }
+    
+    private void assertStandardClaimsExist(final EncryptedJWT jwt) {
+        final ClaimsSet claims = new ClaimsSet();
+        claims.putAll(jwt.getPayload().toJSONObject());
+        assertTrue(jwt.getState() == State.DECRYPTED);
+        assertEquals(claims.getIssuer().getValue(), "https://rp.example.com");
+        assertEquals(claims.getAudience().get(0).getValue(),"https://op.example.com");
+    }
+    
+    @Test
+    public void testEncryptRSA_Success() throws Exception {
+        
+        final JWTSecurityParametersContext secParamCtx = new JWTSecurityParametersContext();
+        final var params = new JWTEncryptionParameters();
+        params.setDataEncryptionAlgorithm(EncryptionConstants.ALGO_ID_ENC_ALG_A256GCM);
+        params.setKeyTransportEncryptionAlgorithm(KeyManagementConstants.ALGO_ID_ALG_RSA_OAEP_256);
+        
+        final RSAKey key = new RSAKeyGenerator(2048)
+                .algorithm(JWEAlgorithm.RSA_OAEP_256)
+                .keyUse(KeyUse.ENCRYPTION)
+                .keyID("mock-key-rsa")
+                .generate();
+        params.setKeyTransportEncryptionCredential(TestCredentialHelper.createKeyEncryptionCredential(key));
+        
+     
+        secParamCtx.setEncryptionParameters(params);  
+        prc.getOutboundMessageContext().addSubcontext(secParamCtx);
+        
+        encrypter.initialize();
+        encrypter.invoke(prc.getOutboundMessageContext());
+        final JWT jwt = request.getRequestObject();
+        
+        assertTrue(JWEAlgorithm.Family.RSA.contains(jwt.getHeader().getAlgorithm()));
+        assertTrue(jwt instanceof EncryptedJWT);
+        final var encryptedJWT = (EncryptedJWT)jwt;
+        assertTrue(JWEAlgorithm.Family.ASYMMETRIC.contains(encryptedJWT.getHeader().getAlgorithm()));
+        final RSADecrypter testDecrypter = new RSADecrypter(key.toPrivateKey());
+        encryptedJWT.decrypt(testDecrypter);
+        
+        assertStandardClaimsExist(encryptedJWT);
+        
+    }
+    
+    @Test
+    public void testEncryptEC_Success() throws Exception {
+        
+        final JWTSecurityParametersContext secParamCtx = new JWTSecurityParametersContext();
+        final var params = new JWTEncryptionParameters();
+        params.setDataEncryptionAlgorithm(EncryptionConstants.ALGO_ID_ENC_ALG_A256GCM);
+        params.setKeyTransportEncryptionAlgorithm(KeyManagementConstants.ALGO_ID_ALG_ECDH_ES);
+        
+        final ECKey key = new ECKeyGenerator(Curve.P_256)
+                .algorithm(JWEAlgorithm.RSA_OAEP_256)
+                .keyUse(KeyUse.ENCRYPTION)
+                .keyID("mock-key-rsa")
+                .generate();
+        params.setKeyTransportEncryptionCredential(TestCredentialHelper.createKeyAgreementCredential(key));
+        
+     
+        secParamCtx.setEncryptionParameters(params);  
+        prc.getOutboundMessageContext().addSubcontext(secParamCtx);
+        
+        encrypter.initialize();
+        encrypter.invoke(prc.getOutboundMessageContext());
+        final JWT jwt = request.getRequestObject();
+        
+        assertTrue(JWEAlgorithm.Family.ECDH_ES.contains(jwt.getHeader().getAlgorithm()));
+        assertTrue(jwt instanceof EncryptedJWT);
+        final var encryptedJWT = (EncryptedJWT)jwt;
+        assertTrue(JWEAlgorithm.Family.ASYMMETRIC.contains(encryptedJWT.getHeader().getAlgorithm()));
+        final ECDHDecrypter testDecrypter = new ECDHDecrypter(key);
+        encryptedJWT.decrypt(testDecrypter);
+        
+        assertStandardClaimsExist(encryptedJWT);
+        
+    }
+    
+    @Test
+    public void testEncryptDirect_Success() throws Exception {
+        
+        final JWTSecurityParametersContext secParamCtx = new JWTSecurityParametersContext();
+        final var params = new JWTEncryptionParameters();
+        params.setDataEncryptionAlgorithm(EncryptionConstants.ALGO_ID_ENC_ALG_A256GCM);
+        params.setKeyTransportEncryptionAlgorithm(KeyManagementConstants.ALGO_ID_ALG_DIR);
+
+        final var dirCred = TestCredentialHelper.createDirectEncryptionCredentialFromSharedSecret(CLIENT_SECRET);
+        params.setDataEncryptionCredential(dirCred);
+        
+     
+        secParamCtx.setEncryptionParameters(params);  
+        prc.getOutboundMessageContext().addSubcontext(secParamCtx);
+        
+        encrypter.initialize();
+        encrypter.invoke(prc.getOutboundMessageContext());
+        final JWT jwt = request.getRequestObject();
+        
+        assertTrue(JWEAlgorithm.DIR.equals(jwt.getHeader().getAlgorithm()));
+        assertTrue(jwt instanceof EncryptedJWT);
+        final var encryptedJWT = (EncryptedJWT)jwt;
+
+        final DirectDecrypter testDecrypter = new DirectDecrypter(dirCred.getSecretKey());
+        encryptedJWT.decrypt(testDecrypter);
+        
+        assertStandardClaimsExist(encryptedJWT);
+        
+    }
+    
+    @Test
+    public void testKeyWrap_Success() throws Exception {
+        
+        final JWTSecurityParametersContext secParamCtx = new JWTSecurityParametersContext();
+        final var params = new JWTEncryptionParameters();
+        params.setDataEncryptionAlgorithm(EncryptionConstants.ALGO_ID_ENC_ALG_A256GCM);
+        params.setKeyTransportEncryptionAlgorithm(KeyManagementConstants.ALGO_ID_ALG_AES_256_KW);
+
+        final var kwCred = TestCredentialHelper.createClientSecretCredential(CLIENT_SECRET);
+        params.setKeyTransportEncryptionCredential(kwCred);
+        
+     
+        secParamCtx.setEncryptionParameters(params);  
+        prc.getOutboundMessageContext().addSubcontext(secParamCtx);
+        
+        encrypter.initialize();
+        encrypter.invoke(prc.getOutboundMessageContext());
+        final JWT jwt = request.getRequestObject();
+        
+        assertTrue(JWEAlgorithm.A256KW.equals(jwt.getHeader().getAlgorithm()));
+        assertTrue(jwt instanceof EncryptedJWT);
+        final var encryptedJWT = (EncryptedJWT)jwt;
+
+        final AESDecrypter testDecrypter = new AESDecrypter(kwCred.getSecretKey());
+        encryptedJWT.decrypt(testDecrypter);
+        
+        assertStandardClaimsExist(encryptedJWT);
+        
+    }
+    
+    @Test(expectedExceptions = MessageHandlerException.class)
+    public void testEncryptDirect_Fail_WrongAlgorithmForCredential() throws Exception {
+        
+        final JWTSecurityParametersContext secParamCtx = new JWTSecurityParametersContext();
+        final var params = new JWTEncryptionParameters();
+        params.setDataEncryptionAlgorithm(EncryptionConstants.ALGO_ID_ENC_ALG_A256GCM);
+        params.setKeyTransportEncryptionAlgorithm(KeyManagementConstants.ALGO_ID_ALG_RSA_OAEP_256);
+
+        final var dirCred = TestCredentialHelper.createDirectEncryptionCredentialFromSharedSecret(CLIENT_SECRET);
+        params.setDataEncryptionCredential(dirCred);
+        
+     
+        secParamCtx.setEncryptionParameters(params);  
+        prc.getOutboundMessageContext().addSubcontext(secParamCtx);
+        
+        encrypter.initialize();
+        encrypter.invoke(prc.getOutboundMessageContext());
+
+    }
+    
+    /* No exception, but should not have performed any operation on the plain JWT.*/
+    @Test
+    public void testFail_NoEncryptionParams() throws Exception {   
+        encrypter.initialize();
+        encrypter.invoke(prc.getOutboundMessageContext());
+        final JWT jwt = request.getRequestObject();
+        assertTrue(jwt instanceof PlainJWT);
+
+    }
+    
+    /* Both content and transport enc credentials defined*/
+    @Test(expectedExceptions = MessageHandlerException.class)
+    public void testFail_IncorrectParamState() throws Exception {   
+        
+        final JWTSecurityParametersContext secParamCtx = new JWTSecurityParametersContext();
+        final var params = new JWTEncryptionParameters();
+        params.setDataEncryptionAlgorithm(EncryptionConstants.ALGO_ID_ENC_ALG_A256GCM);
+        params.setKeyTransportEncryptionAlgorithm(KeyManagementConstants.ALGO_ID_ALG_RSA_OAEP_256);
+        final var dirCred = TestCredentialHelper.createDirectEncryptionCredentialFromSharedSecret(CLIENT_SECRET);
+        params.setDataEncryptionCredential(dirCred);
+        
+        final ECKey key = new ECKeyGenerator(Curve.P_256)
+                .algorithm(JWEAlgorithm.RSA_OAEP_256)
+                .keyUse(KeyUse.ENCRYPTION)
+                .keyID("mock-key-rsa")
+                .generate();
+        params.setKeyTransportEncryptionCredential(TestCredentialHelper.createKeyAgreementCredential(key));
+        
+        secParamCtx.setEncryptionParameters(params);  
+        prc.getOutboundMessageContext().addSubcontext(secParamCtx);
+        
+        encrypter.initialize();
+        encrypter.invoke(prc.getOutboundMessageContext());
+        final JWT jwt = request.getRequestObject();
+        assertTrue(jwt instanceof PlainJWT);
+
+    }
+    
+
+
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list