[java-idp-plugin-vci] 06/06: Tests of FormOutboundTokenResponseMessageT removed for now
Codeberg
noreply at shibboleth.net
Tue Dec 9 07:22:01 UTC 2025
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch dev/DPOP
in repository java-idp-plugin-vci.
View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-vci/commit/46052da7961822e7b6ca9fc0077ea024ab4445f5
commit 46052da7961822e7b6ca9fc0077ea024ab4445f5
Author: jlauros <janne.lauros at csc.fi>
AuthorDate: Tue Dec 9 09:21:43 2025 +0200
Tests of FormOutboundTokenResponseMessageT removed for now
---
.../impl/FormOutboundTokenResponseMessageTest.java | 126 ---------------------
1 file changed, 126 deletions(-)
diff --git a/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundTokenResponseMessageTest.java b/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundTokenResponseMessageTest.java
deleted file mode 100644
index 306fe74..0000000
--- a/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundTokenResponseMessageTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2025, GÉANT
- *
- * Licensed 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 org.geant.shibboleth.plugin.openidvci.profile.impl;
-
-import java.io.IOException;
-import java.net.URI;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.util.Arrays;
-
-import org.geant.shibboleth.plugin.openidvci.config.impl.DefaultOpenIDVCITokenConfiguration;
-import org.geant.shibboleth.plugin.openidvci.messaging.context.TokenContext;
-import org.geant.shibboleth.plugin.openidvci.messaging.impl.CredentialOfferRequest;
-import org.geant.shibboleth.plugin.openidvci.messaging.impl.CredentialOfferTxCode;
-import org.geant.shibboleth.plugin.openidvci.messaging.impl.OpenIDVCITokenRequest;
-import org.geant.shibboleth.plugin.openidvci.storage.CredentialOfferObject;
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.webflow.execution.RequestContext;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.nimbusds.oauth2.sdk.AccessTokenResponse;
-import com.nimbusds.oauth2.sdk.http.HTTPRequest;
-import com.nimbusds.oauth2.sdk.id.ClientID;
-
-import net.minidev.json.parser.ParseException;
-import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.idp.profile.testing.RequestContextBuilder;
-import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.profile.relyingparty.BasicRelyingPartyConfiguration;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.security.DataSealer;
-import net.shibboleth.shared.security.impl.BasicKeystoreKeyStrategy;
-import net.shibboleth.shared.spring.resource.ResourceHelper;
-import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
-
-/**
- * Unit tests for {@link FormOutboundTokenResponseMessage}.
- */
-public class FormOutboundTokenResponseMessageTest {
-
- protected RequestContext requestCtx;
-
- protected ProfileRequestContext profileRequestCtx;
-
- private FormOutboundTokenResponseMessage action;
-
- @BeforeMethod
- protected void setUp() throws Exception {
- requestCtx = new RequestContextBuilder().buildRequestContext();
- profileRequestCtx = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
- profileRequestCtx.setInboundMessageContext(new MessageContext());
- profileRequestCtx.setOutboundMessageContext(new MessageContext());
- profileRequestCtx.getInboundMessageContext().setMessage(new OpenIDVCITokenRequest(null,
- new ClientID("clientID"), OpenIDVCITokenRequest.grantTypeValuePreAuth, "123456", null, null, null, null, null));
- profileRequestCtx.getOutboundMessageContext().addSubcontext(new OIDCAuthenticationResponseContext());
- TokenContext tokenContext = (TokenContext) profileRequestCtx.getInboundMessageContext()
- .addSubcontext(new TokenContext());
-
- RelyingPartyContext rpCtx = ((RelyingPartyContext) profileRequestCtx.addSubcontext(new RelyingPartyContext(),
- true)).setProfileConfig(new DefaultOpenIDVCITokenConfiguration());
- rpCtx.setRelyingPartyId("clientID");
- BasicRelyingPartyConfiguration rpConf = new BasicRelyingPartyConfiguration();
- rpConf.setId("mock");
- rpConf.setIssuer("my_id");
- rpConf.initialize();
- rpCtx.setConfiguration(rpConf);
-
- HTTPRequest credentialOfferObjectBuildHelper = new HTTPRequest(HTTPRequest.Method.POST,
- new URI("http://example.com"));
- credentialOfferObjectBuildHelper.setAuthorization("Basic dGVzdDp0ZXN0");
- credentialOfferObjectBuildHelper.setContentType("application/json");
- credentialOfferObjectBuildHelper.setQuery(
- "{\"preAuthorizedCredentials\":{\"GeantIncubatorSdJwt2\":[{\"path\":[\"mail\"],\"value\":\"incubatorUser at example.org\"},{\"path\":[\"edu\",\"eppn\"],\"value\":\"incubatorUser at example.org\"},{\"path\":[\"givenName\"],\"value\":\"Gemma Gemina Erasmus\"},{\"path\":[\"familyName\"],\"value\":\"Erasmus\"}]}}");
- CredentialOfferObject object = new CredentialOfferObject(new ClientID("clientID_XYZ"),
- CredentialOfferRequest.parse(credentialOfferObjectBuildHelper).getPreAuthorizedCredentials(),
- Arrays.asList("GeantIncubatorSdJwt", "GeantIncubatorSdJwt2", "GeantIncubatorSdJwt3"),
- new CredentialOfferTxCode("numeric", 5, "description", "12345"));
- tokenContext.setCredentialOfferObject(object);
-
- action = new FormOutboundTokenResponseMessage(getDataSealer());
- action.initialize();
- }
-
- public DataSealer getDataSealer() throws ComponentInitializationException, NoSuchAlgorithmException {
- final BasicKeystoreKeyStrategy strategy = new BasicKeystoreKeyStrategy();
- strategy.setKeystoreResource(ResourceHelper.of(new ClassPathResource("credentials/sealer.jks")));
- strategy.setKeyVersionResource(ResourceHelper.of(new ClassPathResource("credentials/sealer.kver")));
- strategy.setKeystorePassword("password");
- strategy.setKeyAlias("secret");
- strategy.setKeyPassword("password");
- strategy.initialize();
- final DataSealer dataSealer = new DataSealer();
- dataSealer.setKeyStrategy(strategy);
- dataSealer.setRandom(SecureRandom.getInstance("SHA1PRNG"));
- dataSealer.initialize();
- return dataSealer;
- }
-
- @Test
- public void testSuccess() throws IOException, ParseException {
- ActionTestingSupport.assertProceedEvent(action.execute(requestCtx));
- AccessTokenResponse resp = (AccessTokenResponse) profileRequestCtx.getOutboundMessageContext().getMessage();
- Assert.assertNotNull(resp.getTokens().getAccessToken().getValue());
-
- }
-
-}
\ 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