[java-idp-oidc] 01/03: JCOMOIDC-41 - Move OIDC Signature Validation resolvers and parameter classes to commons
Henri Mikkonen
henri.mikkonen at iki.fi
Thu Jan 19 14:14:09 UTC 2023
This is an automated email from the git hooks/post-receive script.
hjmikkon pushed a commit to branch main
in repository java-idp-oidc.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-oidc.git;a=commit;h=73a57b26ab7861b665426431275a68813af176c2
commit 73a57b26ab7861b665426431275a68813af176c2
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Thu Jan 19 16:08:08 2023 +0200
JCOMOIDC-41 - Move OIDC Signature Validation resolvers and parameter classes to commons
https://shibboleth.atlassian.net/browse/JCOMOIDC-41
Took DecryptJWE from commons into use instead of OP's own DecryptRequestObject.
---
.../oauth2/profile/impl/DecryptRequestObject.java | 199 ------------------
.../idp/flows/oidc/authorize/authorize-beans.xml | 18 +-
.../profile/impl/DecryptRequestObjectTest.java | 231 ---------------------
3 files changed, 15 insertions(+), 433 deletions(-)
diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/DecryptRequestObject.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/DecryptRequestObject.java
deleted file mode 100644
index 3b553d18..00000000
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/DecryptRequestObject.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * 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.oidc.op.oauth2.profile.impl;
-
-import java.security.PrivateKey;
-import java.security.interfaces.ECPrivateKey;
-import java.text.ParseException;
-import java.util.Iterator;
-import java.util.function.Function;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.crypto.SecretKey;
-
-import org.opensaml.messaging.context.navigate.ChildContextLookup;
-import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.saml.saml2.profile.context.EncryptionContext;
-import org.opensaml.security.credential.Credential;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.nimbusds.jose.JOSEException;
-import com.nimbusds.jose.JWEAlgorithm;
-import com.nimbusds.jose.JWEDecrypter;
-import com.nimbusds.jose.crypto.AESDecrypter;
-import com.nimbusds.jose.crypto.ECDHDecrypter;
-import com.nimbusds.jose.crypto.RSADecrypter;
-import com.nimbusds.jwt.EncryptedJWT;
-import com.nimbusds.jwt.JWT;
-import com.nimbusds.jwt.JWTParser;
-
-import net.shibboleth.idp.profile.context.RelyingPartyContext;
-import net.shibboleth.oidc.profile.core.OidcEventIds;
-import net.shibboleth.oidc.security.impl.OIDCDecryptionParameters;
-import net.shibboleth.utilities.java.support.component.ComponentSupport;
-import net.shibboleth.utilities.java.support.logic.Constraint;
-
-/**
- * Action decrypts request object if it is encrypted. Decrypted object is updated to response context.
- */
-public class DecryptRequestObject extends AbstractOAuthAuthorizationResponseAction {
-
- /** Class logger. */
- @Nonnull private Logger log = LoggerFactory.getLogger(DecryptRequestObject.class);
-
- /** Strategy used to look up the {@link EncryptionContext} to store parameters in. */
- @Nonnull private Function<ProfileRequestContext, EncryptionContext> encryptionContextLookupStrategy;
-
- /** Decryption parameters for decrypting payload. */
- @Nullable private OIDCDecryptionParameters params;
-
- /** Request Object. */
- @Nullable private JWT requestObject;
-
- /**
- * Constructor.
- */
- public DecryptRequestObject() {
- encryptionContextLookupStrategy = new ChildContextLookup<>(EncryptionContext.class).compose(
- new ChildContextLookup<>(RelyingPartyContext.class));
- }
-
- /**
- * Set the strategy used to look up the {@link EncryptionContext} to set the flags for.
- *
- * @param strategy lookup strategy
- */
- public void setEncryptionContextLookupStrategy(
- @Nonnull final Function<ProfileRequestContext, EncryptionContext> strategy) {
- ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-
- encryptionContextLookupStrategy =
- Constraint.isNotNull(strategy, "EncryptionContext lookup strategy cannot be null");
- }
-
- /** {@inheritDoc} */
- @Override
- protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
- if (!super.doPreExecute(profileRequestContext)) {
- return false;
- }
-
- requestObject = getOidcResponseContext().getRequestObject();
- if (requestObject == null) {
- log.debug("{} No request object, nothing to do", getLogPrefix());
- return false;
- }
- if (!(requestObject instanceof EncryptedJWT)) {
- log.debug("{} Request object not encrypted, nothing to do", getLogPrefix());
- return false;
- }
- // OIDC decryption parameters are set to stock shibboleth context as
- // EncryptionContex#getAttributeEncryptionParameters()
- final EncryptionContext encryptCtx = encryptionContextLookupStrategy.apply(profileRequestContext);
- if (encryptCtx == null
- || !(encryptCtx.getAttributeEncryptionParameters() instanceof OIDCDecryptionParameters)) {
- log.error(
- "{} Encrypted request object but no EncryptionContext/OIDCDecryptionParameters available",
- getLogPrefix());
- ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_SEC_CFG);
- return false;
- }
- params = (OIDCDecryptionParameters) encryptCtx.getAttributeEncryptionParameters();
- return true;
- }
-
- // Checkstyle: CyclomaticComplexity OFF
-
- /**
- * Decrypt request object.
- *
- * @param encryptedObject request object to decrypt.
- * @return Decrypted request object. Null if decrypting failed.
- */
- private JWT decryptRequestObject(@Nonnull final EncryptedJWT encryptedObject) {
- if (!encryptedObject.getHeader().getAlgorithm().getName().equals(params.getKeyTransportEncryptionAlgorithm())) {
- log.error("{} Request object alg {} not matching expected {}", getLogPrefix(),
- encryptedObject.getHeader().getAlgorithm().getName(), params.getKeyTransportEncryptionAlgorithm());
- return null;
- }
- if (!encryptedObject.getHeader().getEncryptionMethod().getName().equals(params.getDataEncryptionAlgorithm())) {
- log.error("{} Request object enc {} not matching expected {}", getLogPrefix(),
- encryptedObject.getHeader().getEncryptionMethod().getName(), params.getDataEncryptionAlgorithm());
- return null;
- }
- final JWEAlgorithm encAlg = encryptedObject.getHeader().getAlgorithm();
- final Iterator<Credential> it = params.getKeyTransportDecryptionCredentials().iterator();
- while (it.hasNext()) {
- final Credential credential = it.next();
- JWEDecrypter decrypter = null;
- try {
- if (JWEAlgorithm.Family.RSA.contains(encAlg)) {
- decrypter = new RSADecrypter((PrivateKey) credential.getPrivateKey());
- }
- if (JWEAlgorithm.Family.ECDH_ES.contains(encAlg)) {
- decrypter = new ECDHDecrypter((ECPrivateKey) credential.getPrivateKey());
- }
- if (JWEAlgorithm.Family.AES_GCM_KW.contains(encAlg) || JWEAlgorithm.Family.AES_KW.contains(encAlg)) {
- decrypter = new AESDecrypter((SecretKey) credential.getSecretKey());
- }
- if (decrypter == null) {
- log.error("{} No decrypter for request object for encAlg {}", getLogPrefix(),
- encryptedObject.getHeader().getEncryptionMethod().getName());
- return null;
- }
- encryptedObject.decrypt(decrypter);
- return JWTParser.parse(encryptedObject.getPayload().toString());
- } catch (final JOSEException | ParseException e) {
- if (it.hasNext()) {
- log.debug("{} Unable to decrypt request object with credential, {}, picking next key",
- getLogPrefix(), e.getMessage());
- } else {
- log.error("{} Unable to decrypt request object with credential, {}", getLogPrefix(),
- e.getMessage());
- return null;
- }
- }
- }
- // Should never come here
- return null;
- }
-
- // Checkstyle: CyclomaticComplexity ON
-
- /** {@inheritDoc} */
- @Override
- protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
-
- requestObject = decryptRequestObject((EncryptedJWT) requestObject);
- if (requestObject == null) {
- log.error("{} Unable to decrypt request object", getLogPrefix());
- ActionSupport.buildEvent(profileRequestContext, OidcEventIds.INVALID_REQUEST_OBJECT);
- return;
- }
-
- // Let's update decrypted request object back to response context
- getOidcResponseContext().setRequestObject(requestObject);
- log.debug("{} Request object decrypted as {}", getLogPrefix(),
- getOidcResponseContext().getRequestObject().serialize());
- }
-
-}
\ No newline at end of file
diff --git a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/authorize/authorize-beans.xml b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/authorize/authorize-beans.xml
index fd0b78e4..c0277d93 100644
--- a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/authorize/authorize-beans.xml
+++ b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/authorize/authorize-beans.xml
@@ -87,7 +87,6 @@
p:configurationLookupStrategy-ref="DecryptionConfigurationLookup"
p:decryptionParametersResolver-ref="JWTDecryptionParametersResolver" />
-
<bean id="DecryptionConfigurationLookup" lazy-init="true"
class="net.shibboleth.oidc.profile.config.navigate.JWTDecryptionConfigurationLookupFunction"
p:relyingPartyConfigurationResolver-ref="shibboleth.RelyingPartyConfigurationResolver" />
@@ -113,8 +112,21 @@
p:httpClient="#{getObject('shibboleth.oidc.NonBrowser.HttpClient') ?: getObject('shibboleth.InternalHttpClient')}"
p:httpClientSecurityParameters="#{getObject('shibboleth.oidc.NonBrowser.HttpClientSecurityParameters')}" />
- <bean id="DecryptRequestObject" class="net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl.DecryptRequestObject"
- scope="prototype" />
+ <bean id="DecryptRequestObject" class="net.shibboleth.oidc.security.impl.DecryptJWE" scope="prototype">
+ <property name="jwtTokenLookupStrategy">
+ <bean class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction"
+ c:_0="#{ T(org.opensaml.profile.context.ProfileRequestContext) }"
+ c:outputType="#{T(com.nimbusds.jwt.EncryptedJWT)}"
+ c:expression="#input.getOutboundMessageContext().getSubcontext(T(net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext)).getRequestObject()" />
+ </property>
+ <property name="jwtUpdateStrategy">
+ <bean class="net.shibboleth.idp.plugin.oidc.op.profile.context.navigate.RequestObjectUpdateStrategy" />
+ </property>
+ <property name="activationCondition">
+ <bean parent="shibboleth.Conditions.Expression"
+ c:_0="#profileContext.getOutboundMessageContext().getSubcontext(T(net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext)).getRequestObject() instanceof T(com.nimbusds.jwt.EncryptedJWT)" />
+ </property>
+ </bean>
<bean id="RequestObjectSignedCondition" parent="shibboleth.Conditions.Expression"
c:expression="#input.getOutboundMessageContext().getSubcontext(T(net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext)).getRequestObject() instanceof T(com.nimbusds.jwt.SignedJWT)" />
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/DecryptRequestObjectTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/DecryptRequestObjectTest.java
deleted file mode 100644
index e218c714..00000000
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/DecryptRequestObjectTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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.oidc.op.oauth2.profile.impl;
-
-import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext;
-import net.shibboleth.idp.profile.context.RelyingPartyContext;
-import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.idp.profile.testing.RequestContextBuilder;
-import net.shibboleth.oidc.metadata.context.OIDCMetadataContext;
-import net.shibboleth.oidc.profile.core.OidcEventIds;
-import net.shibboleth.oidc.security.credential.BasicJWKCredential;
-import net.shibboleth.oidc.security.impl.OIDCDecryptionParameters;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-import java.security.interfaces.RSAPublicKey;
-import java.text.ParseException;
-
-import org.opensaml.messaging.context.BaseContext;
-import org.opensaml.profile.action.EventIds;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.saml.saml2.profile.context.EncryptionContext;
-import org.springframework.webflow.execution.Event;
-import org.springframework.webflow.execution.RequestContext;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.nimbusds.jose.EncryptionMethod;
-import com.nimbusds.jose.JOSEException;
-import com.nimbusds.jose.JWEAlgorithm;
-import com.nimbusds.jose.JWEHeader;
-import com.nimbusds.jose.JWEObject;
-import com.nimbusds.jose.Payload;
-import com.nimbusds.jose.crypto.RSAEncrypter;
-import com.nimbusds.jwt.EncryptedJWT;
-import com.nimbusds.jwt.JWTClaimsSet;
-import com.nimbusds.jwt.PlainJWT;
-import com.nimbusds.oauth2.sdk.ResponseType;
-import com.nimbusds.oauth2.sdk.Scope;
-import com.nimbusds.oauth2.sdk.auth.Secret;
-import com.nimbusds.oauth2.sdk.id.ClientID;
-import com.nimbusds.oauth2.sdk.id.State;
-import com.nimbusds.openid.connect.sdk.AuthenticationRequest;
-import com.nimbusds.openid.connect.sdk.rp.OIDCClientInformation;
-import com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata;
-
-import org.testng.Assert;
-
-/** {@link DecryptRequestObject} unit test. */
-public class DecryptRequestObjectTest {
-
- private ProfileRequestContext prc;
-
- private DecryptRequestObject action;
-
- private RequestContext requestCtx;
-
- private OIDCMetadataContext oidcCtx;
-
- private OIDCAuthenticationResponseContext oidcRespCtx;
-
- private KeyPair kp;
-
- @BeforeMethod
- public void setup() throws ComponentInitializationException, NoSuchAlgorithmException {
- requestCtx = new RequestContextBuilder().buildRequestContext();
- prc = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
- oidcCtx = prc.getInboundMessageContext().getSubcontext(OIDCMetadataContext.class, true);
- oidcRespCtx = new OIDCAuthenticationResponseContext();
- prc.getOutboundMessageContext().addSubcontext(oidcRespCtx);
- OIDCClientMetadata metaData = new OIDCClientMetadata();
- OIDCClientInformation information = new OIDCClientInformation(new ClientID("test"), null, metaData,
- new Secret("ultimatetopsecretultimatetopsecret"), null, null);
- oidcCtx.setClientInformation(information);
- BaseContext ctx = prc.getSubcontext(RelyingPartyContext.class, true);
- EncryptionContext encCtx = (EncryptionContext) ctx.getSubcontext(EncryptionContext.class, true);
- OIDCDecryptionParameters params = new OIDCDecryptionParameters();
- KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
- kpg.initialize(2048);
- kp = kpg.generateKeyPair();
- BasicJWKCredential credentialRSA = new BasicJWKCredential();
- credentialRSA.setPrivateKey(kp.getPrivate());
- params.getKeyTransportDecryptionCredentials().add(credentialRSA);
- kp = kpg.generateKeyPair();
- BasicJWKCredential credentialRSA2 = new BasicJWKCredential();
- credentialRSA2.setPrivateKey(kp.getPrivate());
- params.getKeyTransportDecryptionCredentials().add(credentialRSA2);
- params.setKeyTransportEncryptionAlgorithm("RSA-OAEP-256");
- params.setDataEncryptionAlgorithm("A128CBC-HS256");
- encCtx.setAttributeEncryptionParameters(params);
- action = new DecryptRequestObject();
- action.initialize();
- }
-
- /**
- * Test success in case of not having request object
- */
- @Test
- public void testSuccessNoObject()
- throws NoSuchAlgorithmException, ComponentInitializationException, URISyntaxException {
- AuthenticationRequest req = new AuthenticationRequest.Builder(new ResponseType("code"), new Scope("openid"),
- new ClientID("000123"), URI.create("https://example.com/callback")).state(new State()).build();
- prc.getInboundMessageContext().setMessage(req);
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertProceedEvent(event);
- }
-
- /**
- * Test success in case of not having to decrypt.
- * @throws ParseException
- */
- @Test
- public void testSuccessNotJWE()
- throws NoSuchAlgorithmException, ComponentInitializationException, URISyntaxException, ParseException {
- JWTClaimsSet ro = new JWTClaimsSet.Builder().subject("alice").build();
- AuthenticationRequest req = new AuthenticationRequest.Builder(new ResponseType("code"), new Scope("openid"),
- new ClientID("000123"), URI.create("https://example.com/callback")).requestObject(new PlainJWT(ro))
- .state(new State()).build();
- prc.getInboundMessageContext().setMessage(req);
- oidcRespCtx.setRequestObject(req.getRequestObject());
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertProceedEvent(event);
- Assert.assertEquals("alice",oidcRespCtx.getRequestObject().getJWTClaimsSet().getSubject());
- }
-
- private void setObject(JWEAlgorithm alg, EncryptionMethod enc) throws JOSEException, ParseException {
- PlainJWT plainJWT = new PlainJWT(new JWTClaimsSet.Builder().subject("alice").build());
- JWEObject jweObject = new JWEObject(new JWEHeader.Builder(alg, enc).contentType("JWT").build(),
- new Payload(plainJWT.serialize()));
- jweObject.encrypt(new RSAEncrypter((RSAPublicKey) kp.getPublic()));
- AuthenticationRequest req = new AuthenticationRequest.Builder(new ResponseType("code"), new Scope("openid"),
- new ClientID("000123"), URI.create("https://example.com/callback"))
- .requestObject(EncryptedJWT.parse(jweObject.serialize())).state(new State()).build();
- prc.getInboundMessageContext().setMessage(req);
- oidcRespCtx.setRequestObject(req.getRequestObject());
- }
-
- /**
- * Test decrypt success.
- */
- @Test
- public void testRequestObjectDecryptSuccess() throws NoSuchAlgorithmException, ComponentInitializationException,
- URISyntaxException, JOSEException, ParseException {
- setObject(JWEAlgorithm.RSA_OAEP_256, EncryptionMethod.A128CBC_HS256);
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertProceedEvent(event);
- Assert.assertEquals("alice",oidcRespCtx.getRequestObject().getJWTClaimsSet().getSubject());
- }
-
- /**
- * Test decrypt failure, no matching key.
- */
- @Test
- public void testRequestObjectDecryptFailureNoMatchingKey() throws NoSuchAlgorithmException,
- ComponentInitializationException, URISyntaxException, JOSEException, ParseException {
- KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
- kpg.initialize(2048);
- kp = kpg.generateKeyPair();
- setObject(JWEAlgorithm.RSA_OAEP_256, EncryptionMethod.A128CBC_HS256);
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertEvent(event, OidcEventIds.INVALID_REQUEST_OBJECT);
- }
-
- /**
- * Test decrypt failure, kt alg not matching.
- */
- @SuppressWarnings("deprecation")
- @Test
- public void testRequestObjectDecryptFailureNoMatchingAlg() throws NoSuchAlgorithmException,
- ComponentInitializationException, URISyntaxException, JOSEException, ParseException {
- setObject(JWEAlgorithm.RSA_OAEP, EncryptionMethod.A128CBC_HS256);
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertEvent(event, OidcEventIds.INVALID_REQUEST_OBJECT);
- }
-
- /**
- * Test decrypt failure, enc alg not matching.
- */
- @Test
- public void testRequestObjectDecryptFailureNoMatchingEnc() throws NoSuchAlgorithmException,
- ComponentInitializationException, URISyntaxException, JOSEException, ParseException {
- setObject(JWEAlgorithm.RSA_OAEP_256, EncryptionMethod.A128GCM);
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertEvent(event, OidcEventIds.INVALID_REQUEST_OBJECT);
- }
-
- /**
- * Test decrypt failure, no params.
- */
- @Test
- public void testRequestObjectFailureNoParameters() throws NoSuchAlgorithmException,
- ComponentInitializationException, URISyntaxException, JOSEException, ParseException {
- prc.getSubcontext(RelyingPartyContext.class, false).getSubcontext(EncryptionContext.class, false)
- .setAttributeEncryptionParameters(null);
- setObject(JWEAlgorithm.RSA_OAEP_256, EncryptionMethod.A128CBC_HS256);
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertEvent(event, EventIds.INVALID_SEC_CFG);
- }
-
- /**
- * Test decrypt failure, no enc context.
- */
- @Test
- public void testRequestObjectFailureNoEncCtx() throws NoSuchAlgorithmException, ComponentInitializationException,
- URISyntaxException, JOSEException, ParseException {
- prc.getSubcontext(RelyingPartyContext.class, false).removeSubcontext(EncryptionContext.class);
- setObject(JWEAlgorithm.RSA_OAEP_256, EncryptionMethod.A128CBC_HS256);
- final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertEvent(event, EventIds.INVALID_SEC_CFG);
- }
-
-}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list