[java-idp-plugin-vci] branch main updated: status list url and sub claim in it are formed from the configured issuer

Codeberg noreply at shibboleth.net
Mon Nov 16 16:37:23 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-idp-plugin-vci.

View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-vci/commit/f9bb27ec2c82c8aaab1ea7616395a6d1b83eb51f

The following commit(s) were added to refs/heads/main by this push:
     new f9bb27e  status list url and sub claim in it are formed from the configured issuer
f9bb27e is described below

commit f9bb27ec2c82c8aaab1ea7616395a6d1b83eb51f
Author: Janne Lauros <janne.lauros at csc.fi>
AuthorDate: Mon Nov 16 14:58:04 2026 +0200

    status list url and sub claim in it are formed from the configured issuer
---
 README.md                                          |  3 +
 .../openidvci/statuslist/StatusListParameters.java | 24 +++++++
 .../statuslist/profile/impl/AllocateIndex.java     | 78 +++++++++-------------
 .../profile/impl/FormStatusListToken.java          | 31 +++++++--
 .../oauth/status-list/assign/assign-beans.xml      |  2 +-
 .../statuslist/StatusListParametersTest.java       | 49 ++++++++++++++
 .../statuslist/profile/impl/AllocateIndexTest.java | 74 +++++++++++++++-----
 .../profile/impl/FormStatusListTokenTest.java      | 61 +++++++++++++++++
 8 files changed, 252 insertions(+), 70 deletions(-)

diff --git a/README.md b/README.md
index 8a8ea48..4267ae9 100644
--- a/README.md
+++ b/README.md
@@ -1299,6 +1299,9 @@ is told not to take one.
 
 </details>
 
+The `uri` and the `sub` of the Status List Token are formed from the scheme and host of
+`idp.oidc.issuer`.
+
 To revoke this credential, set bit 41337 in the `2027-03` list. The list a credential belongs to
 is determined by the month it **expires**, not the month it was issued. With the
 default `credentialLifetime` of `P180D` a credential that is issued in mid-September 2026 belongs to
diff --git a/openid-vci-api/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/StatusListParameters.java b/openid-vci-api/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/StatusListParameters.java
index 7b3a01d..cf5b23b 100644
--- a/openid-vci-api/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/StatusListParameters.java
+++ b/openid-vci-api/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/StatusListParameters.java
@@ -16,6 +16,7 @@
 
 package org.geant.shibboleth.plugin.openidvci.statuslist;
 
+import java.net.URI;
 import java.time.Duration;
 
 import javax.annotation.Nonnull;
@@ -60,6 +61,10 @@ public final class StatusListParameters {
     /** Member for the slot of a list, as in a credential status reference. */
     public static final String INDEX_PARAMETER = "idx";
 
+    /** Path of the endpoint publishing status lists. */
+    @Nonnull
+    public static final String LIST_PATH = "/idp/profile/oauth/status-list/list";
+
     /** Media type of a Status List Token in JWT format. */
     @Nonnull
     public static final String MEDIA_TYPE_JWT = "application/statuslist+jwt";
@@ -72,6 +77,25 @@ public final class StatusListParameters {
     private StatusListParameters() {
     }
 
+    /**
+     * Get the url of a status list, from the scheme and authority of the issuer of this deployment.
+     *
+     * @param issuer https url of this deployment
+     * @param path path of the endpoint publishing status lists
+     * @param reference list reference, tag included
+     * @return url of the status list
+     * @throws IllegalArgumentException if the issuer is not an https url with a host
+     */
+    @Nonnull
+    public static String listUri(@Nonnull final String issuer, @Nonnull final String path,
+            @Nonnull final String reference) {
+        final URI base = URI.create(issuer);
+        if (!"https".equals(base.getScheme()) || base.getHost() == null) {
+            throw new IllegalArgumentException("Issuer '" + issuer + "' is not an https url with a host");
+        }
+        return "https://" + base.getRawAuthority() + path + "?" + BUCKET_PARAMETER + "=" + reference;
+    }
+
     /**
      * Get piece of a list holding a slot.
      *
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndex.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndex.java
index 252187a..8404b01 100644
--- a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndex.java
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndex.java
@@ -17,8 +17,6 @@
 package org.geant.shibboleth.plugin.openidvci.statuslist.profile.impl;
 
 import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.time.Instant;
 import java.util.List;
 import java.util.function.Function;
@@ -38,7 +36,6 @@ import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.slf4j.Logger;
 
-import jakarta.servlet.http.HttpServletRequest;
 import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.shared.component.ComponentInitializationException;
@@ -77,11 +74,13 @@ public class AllocateIndex extends AbstractProfileAction {
     @Nonnull
     private final Function<Instant, StatusListBucket> bucketStrategy = new MonthlyBucketStrategy();
 
-    /**
-     * Path of endpoint publishing status lists. TODO: Maybe not hadcoded here.
-     */
+    /** Path of endpoint publishing status lists. */
     @Nonnull
-    private String pathPrefix = "/idp/profile/oauth/status-list/list";
+    private String pathPrefix = StatusListParameters.LIST_PATH;
+
+    /** Https url of this deployment, the status list url is formed from it. */
+    @NonnullAfterInit
+    private String issuer;
 
     /**
      * Strategy used to resolve the tag naming the issuer of the credential in
@@ -138,10 +137,28 @@ public class AllocateIndex extends AbstractProfileAction {
         pathPrefix = Constraint.isNotNull(prefix, "Path prefix cannot be null");
     }
 
+    /**
+     * Set the https url of this deployment.
+     *
+     * @param url url of this deployment
+     */
+    public void setIssuer(@Nonnull final String url) {
+        checkSetterPreconditions();
+        issuer = Constraint.isNotNull(url, "Issuer cannot be null");
+    }
+
     /** {@inheritDoc} */
     @Override
     protected void doInitialize() throws ComponentInitializationException {
         super.doInitialize();
+        if (issuer == null) {
+            throw new ComponentInitializationException("Issuer cannot be null");
+        }
+        try {
+            StatusListParameters.listUri(issuer, pathPrefix, "");
+        } catch (final IllegalArgumentException e) {
+            throw new ComponentInitializationException(e);
+        }
         if (statusListAllocator == null) {
             throw new ComponentInitializationException("StatusListIndexAllocator cannot be null");
         }
@@ -170,11 +187,6 @@ public class AllocateIndex extends AbstractProfileAction {
         if (!super.doPreExecute(profileRequestContext)) {
             return false;
         }
-        if (getHttpServletRequest() == null) {
-            log.error("{} Profile action does not contain an HttpServletRequest", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
-            return false;
-        }
 
         expiration = expirationLookupStrategy.apply(profileRequestContext);
         if (expiration == null) {
@@ -217,48 +229,18 @@ public class AllocateIndex extends AbstractProfileAction {
             return;
         }
 
-        final URI statusListUri;
-        try {
-            final HttpServletRequest request = getHttpServletRequest();
-            final String scheme = request.getScheme();
-            assert scheme != null;
-            final String serverName = request.getServerName();
-            assert serverName != null;
-            final String tag = issuerTagLookupStrategy == null ? null
-                    : issuerTagLookupStrategy.apply(profileRequestContext);
-            statusListUri = buildURIIgnoreDefaultPorts(scheme, serverName, request.getServerPort(), pathPrefix,
-                    StatusListParameters.BUCKET_PARAMETER + "=" + StatusListIssuerTag.reference(bucket.id(), tag));
-        } catch (final URISyntaxException e) {
-            log.error("{} Unable to build status list URI", getLogPrefix(), e);
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
-            return;
-        }
+        assert issuer != null;
+        final String tag = issuerTagLookupStrategy == null ? null
+                : issuerTagLookupStrategy.apply(profileRequestContext);
+        final String statusListUri =
+                StatusListParameters.listUri(issuer, pathPrefix, StatusListIssuerTag.reference(bucket.id(), tag));
 
         final StatusListContext ctx = outbound.ensureSubcontext(StatusListContext.class);
-        ctx.setStatusListUri(statusListUri.toString());
+        ctx.setStatusListUri(statusListUri);
         ctx.setIndices(indices);
 
         log.debug("{} Allocated {} status list slot(s) {} from bucket {} (retirable after {}) at uri {}",
                 getLogPrefix(), count, indices, bucket.id(), bucket.end(), statusListUri);
     }
 
-    /**
-     * Build a URI, omitting the port when it is the default for the scheme
-     * ({@code 443} for {@code https}, {@code 80} for {@code http}).
-     *
-     * @param scheme URI scheme
-     * @param host   host name
-     * @param port   server port
-     * @param path   path component
-     * @param query  query component
-     * @return constructed URI
-     * @throws URISyntaxException if the components do not form a valid URI
-     */
-    @Nonnull
-    private URI buildURIIgnoreDefaultPorts(@Nonnull final String scheme, @Nonnull final String host, final int port,
-            @Nonnull final String path, @Nonnull final String query) throws URISyntaxException {
-        final boolean defaultPort = "https".equals(scheme) && port == 443 || "http".equals(scheme) && port == 80;
-        return new URI(scheme, null, host, defaultPort ? -1 : port, path, query, null);
-    }
-
 }
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListToken.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListToken.java
index 79adc19..bb35ca4 100644
--- a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListToken.java
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListToken.java
@@ -95,14 +95,18 @@ public class FormStatusListToken extends AbstractProfileAction {
     @Nullable
     private StatusListBucket bucket;
 
-    /** Url this deployment is reached at, a did:web issuer is derived from it. */
-    @Nullable
+    /** Url this deployment is reached at, the status list url and a did:web issuer are derived from it. */
+    @NonnullAfterInit
     private String deploymentIssuer;
 
     /** Issuer identifier configured for this deployment. */
     @Nullable
     private String configuredIssuer;
 
+    /** Path of endpoint publishing status lists. */
+    @Nonnull
+    private String pathPrefix = StatusListParameters.LIST_PATH;
+
     /** Strategy used to obtain the configurations Status List Tokens are signed by. */
     @Nonnull
     private Function<ProfileRequestContext, List<SignatureSigningConfiguration>> configurationLookupStrategy;
@@ -160,6 +164,24 @@ public class FormStatusListToken extends AbstractProfileAction {
         if (statusListStore == null) {
             throw new ComponentInitializationException("StatusListStore cannot be null");
         }
+        if (deploymentIssuer == null) {
+            throw new ComponentInitializationException("Deployment issuer cannot be null");
+        }
+        try {
+            StatusListParameters.listUri(deploymentIssuer, pathPrefix, "");
+        } catch (final IllegalArgumentException e) {
+            throw new ComponentInitializationException(e);
+        }
+    }
+
+    /**
+     * Set the path prefix of the status list url.
+     *
+     * @param prefix path prefix to use
+     */
+    public void setPathPrefix(@Nonnull final String prefix) {
+        checkSetterPreconditions();
+        pathPrefix = Constraint.isNotNull(prefix, "Path prefix cannot be null");
     }
 
     /**
@@ -326,8 +348,9 @@ public class FormStatusListToken extends AbstractProfileAction {
             ActionSupport.buildEvent(profileRequestContext, EventIds.IO_ERROR);
             return;
         }
-        final String subject = getHttpServletRequest().getRequestURL().append('?')
-                .append(StatusListParameters.BUCKET_PARAMETER).append('=').append(reference).toString();
+        assert deploymentIssuer != null;
+        final String subject = StatusListParameters.listUri(deploymentIssuer, pathPrefix,
+                StatusListIssuerTag.reference(bucket.id(), StatusListIssuerTag.tagOf(reference)));
         final JWTClaimsSet claims = new JWTClaimsSet.Builder().issuer(issuerId).subject(subject)
                 .issueTime(Date.from(Instant.now())).expirationTime(Date.from(bucket.end()))
                 .claim("ttl", ttl.toSeconds())
diff --git a/openid-vci-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth/status-list/assign/assign-beans.xml b/openid-vci-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth/status-list/assign/assign-beans.xml
index 79c4024..c95a919 100644
--- a/openid-vci-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth/status-list/assign/assign-beans.xml
+++ b/openid-vci-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth/status-list/assign/assign-beans.xml
@@ -20,7 +20,7 @@
         scope="prototype"
         p:statusListAllocator-ref="openidvci.status-list.IndexAllocator"
         p:activationCondition-ref="openidvci.status-list.InclusionCondition"
-        p:httpServletRequestSupplier-ref="shibboleth.HttpServletRequestSupplier">
+        p:issuer="#{getObject('shibboleth.oidc.issuer')}">
     <property name="expirationLookupStrategy">
       <bean class="org.geant.shibboleth.plugin.openidvci.profile.logic.CredentialExpirationLookupFunction" />
     </property>
diff --git a/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/StatusListParametersTest.java b/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/StatusListParametersTest.java
new file mode 100644
index 0000000..c7a8295
--- /dev/null
+++ b/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/StatusListParametersTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.statuslist;
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** Tests for {@link StatusListParameters}. */
+public class StatusListParametersTest {
+
+    @Test
+    public void testListUri() {
+        Assert.assertEquals(StatusListParameters.listUri("https://issuer.example.org", StatusListParameters.LIST_PATH,
+                "2027-05"), "https://issuer.example.org/idp/profile/oauth/status-list/list?id=2027-05");
+    }
+
+    @Test
+    public void testListUriKeepsPortDropsPath() {
+        Assert.assertEquals(StatusListParameters.listUri("https://issuer.example.org:8443/oidc/op", "/status",
+                "2027-05~did-jwk:abc"), "https://issuer.example.org:8443/status?id=2027-05~did-jwk:abc");
+    }
+
+    @DataProvider(name = "invalidIssuers")
+    public Object[][] invalidIssuers() {
+        return new Object[][] { { "http://issuer.example.org" }, { "did:web:issuer.example.org" }, { "issuer" },
+            { "https:///path" }, { "https://issuer example" } };
+    }
+
+    @Test(dataProvider = "invalidIssuers", expectedExceptions = IllegalArgumentException.class)
+    public void testInvalidIssuer(final String issuer) {
+        StatusListParameters.listUri(issuer, StatusListParameters.LIST_PATH, "2027-05");
+    }
+
+}
diff --git a/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndexTest.java b/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndexTest.java
index d43a2aa..beea030 100644
--- a/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndexTest.java
+++ b/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/AllocateIndexTest.java
@@ -55,6 +55,8 @@ public class AllocateIndexTest {
     /** Expiration falling in the 2027-03 bucket. */
     private static final Instant LATER_EXPIRATION = Instant.parse("2027-03-01T00:00:00Z");
 
+    private static final String ISSUER = "https://issuer.example.org";
+
     private static final String EXPECTED_URI = "https://issuer.example.org/idp/profile/oauth/status-list/list?id=2027-02";
 
     protected RequestContext requestCtx;
@@ -67,8 +69,6 @@ public class AllocateIndexTest {
 
     private AllocateIndex action;
 
-    private MockHttpServletRequest httpRequest;
-
     @BeforeMethod
     protected void setUp() throws Exception {
         storageService = new MemoryStorageService();
@@ -85,11 +85,6 @@ public class AllocateIndexTest {
         profileRequestCtx = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
         profileRequestCtx.setOutboundMessageContext(new MessageContext());
 
-        httpRequest = new MockHttpServletRequest();
-        httpRequest.setScheme("https");
-        httpRequest.setServerName("issuer.example.org");
-        httpRequest.setServerPort(443);
-
         action = newAction(allocator, EXPIRATION, 1, null);
     }
 
@@ -107,18 +102,19 @@ public class AllocateIndexTest {
 
     private AllocateIndex newAction(final StatusListIndexAllocator statusListAllocator, final Instant expiration,
             final Integer count, final String pathPrefix) throws ComponentInitializationException {
+        return newAction(statusListAllocator, expiration, count, pathPrefix, ISSUER);
+    }
+
+    private AllocateIndex newAction(final StatusListIndexAllocator statusListAllocator, final Instant expiration,
+            final Integer count, final String pathPrefix, final String issuer) throws ComponentInitializationException {
         AllocateIndex a = new AllocateIndex();
+        a.setIssuer(issuer);
         a.setStatusListAllocator(statusListAllocator);
         a.setExpirationLookupStrategy(prc -> expiration);
         a.setIndexCountLookupStrategy(prc -> count);
         if (pathPrefix != null) {
             a.setPathPrefix(pathPrefix);
         }
-        a.setHttpServletRequestSupplier(new NonnullSupplier<>() {
-            public HttpServletRequest get() {
-                return httpRequest;
-            }
-        });
         a.initialize();
         return a;
     }
@@ -223,21 +219,65 @@ public class AllocateIndexTest {
     }
 
     @Test
-    public void testNonDefaultPortIncludedInUrl() {
-        httpRequest.setServerPort(8443);
-        ActionTestingSupport.assertProceedEvent(action.execute(requestCtx));
+    public void testIssuerPortIncludedInUrl() throws ComponentInitializationException {
+        AllocateIndex a = newAction(allocator, EXPIRATION, 1, null, "https://issuer.example.org:8443/path");
+        ActionTestingSupport.assertProceedEvent(a.execute(requestCtx));
         Assert.assertEquals(outboundStatusListContext().getStatusListUri(),
                 "https://issuer.example.org:8443/idp/profile/oauth/status-list/list?id=2027-02");
     }
 
     @Test
-    public void testNoHttpServletRequest() throws ComponentInitializationException {
+    public void testUrlNotFromRequest() throws ComponentInitializationException {
+        final MockHttpServletRequest forged = new MockHttpServletRequest();
+        forged.setScheme("https");
+        forged.setServerName("evil.example");
+        forged.addHeader("Host", "evil.example");
+        forged.addHeader("X-Forwarded-Host", "evil.example");
+        final AllocateIndex a = new AllocateIndex();
+        a.setIssuer(ISSUER);
+        a.setStatusListAllocator(allocator);
+        a.setExpirationLookupStrategy(prc -> EXPIRATION);
+        a.setIndexCountLookupStrategy(prc -> 1);
+        a.setHttpServletRequestSupplier(new NonnullSupplier<>() {
+            public HttpServletRequest get() {
+                return forged;
+            }
+        });
+        a.initialize();
+        ActionTestingSupport.assertProceedEvent(a.execute(requestCtx));
+        Assert.assertEquals(outboundStatusListContext().getStatusListUri(), EXPECTED_URI);
+    }
+
+    @Test
+    public void testIssuerTagInUrl() throws ComponentInitializationException {
+        final AllocateIndex a = new AllocateIndex();
+        a.setIssuer(ISSUER);
+        a.setStatusListAllocator(allocator);
+        a.setExpirationLookupStrategy(prc -> EXPIRATION);
+        a.setIndexCountLookupStrategy(prc -> 1);
+        a.setIssuerTagLookupStrategy(prc -> "did-jwk:abc");
+        a.initialize();
+        ActionTestingSupport.assertProceedEvent(a.execute(requestCtx));
+        Assert.assertEquals(outboundStatusListContext().getStatusListUri(), EXPECTED_URI + "~did-jwk:abc");
+    }
+
+    @Test(expectedExceptions = ComponentInitializationException.class)
+    public void testInitFailsWithoutIssuer() throws ComponentInitializationException {
         AllocateIndex a = new AllocateIndex();
         a.setStatusListAllocator(allocator);
         a.setExpirationLookupStrategy(prc -> EXPIRATION);
         a.setIndexCountLookupStrategy(prc -> 1);
         a.initialize();
-        ActionTestingSupport.assertEvent(a.execute(requestCtx), EventIds.INVALID_PROFILE_CTX);
+    }
+
+    @Test(expectedExceptions = ComponentInitializationException.class)
+    public void testInitFailsWithHttpIssuer() throws ComponentInitializationException {
+        newAction(allocator, EXPIRATION, 1, null, "http://issuer.example.org");
+    }
+
+    @Test(expectedExceptions = ComponentInitializationException.class)
+    public void testInitFailsWithIssuerWithoutHost() throws ComponentInitializationException {
+        newAction(allocator, EXPIRATION, 1, null, "did:web:issuer.example.org");
     }
 
     @Test
diff --git a/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListTokenTest.java b/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListTokenTest.java
index d1e9236..e0b5eb9 100644
--- a/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListTokenTest.java
+++ b/openid-vci-impl/src/test/java/org/geant/shibboleth/plugin/openidvci/statuslist/profile/impl/FormStatusListTokenTest.java
@@ -155,6 +155,67 @@ public class FormStatusListTokenTest {
                 .getSubcontext(StatusListTokenContext.class).getKeyThumbprint());
     }
 
+    @Test
+    public void testSubjectNotFromRequest() throws Exception {
+        httpRequest.setServerName("evil.example");
+        httpRequest.addHeader("Host", "evil.example");
+        httpRequest.addHeader("X-Forwarded-Host", "evil.example");
+        final FormStatusListToken action = newAction(list);
+        action.initialize();
+
+        ActionTestingSupport.assertProceedEvent(action.execute(requestCtx));
+
+        Assert.assertEquals(claims().getSubject(), ENDPOINT + "?id=" + list);
+    }
+
+    @Test
+    public void testSubjectFromIssuerWithPortAndPath() throws Exception {
+        final FormStatusListToken action = newAction(list);
+        action.setDeploymentIssuer("https://issuer.example.org:8443/oidc");
+        action.initialize();
+
+        ActionTestingSupport.assertProceedEvent(action.execute(requestCtx));
+
+        Assert.assertEquals(claims().getSubject(),
+                "https://issuer.example.org:8443/idp/profile/oauth/status-list/list?id=" + list);
+    }
+
+    @Test
+    public void testSubjectReferenceCanonical() throws Exception {
+        final FormStatusListToken action = newAction(list + StatusListIssuerTag.SEPARATOR);
+        action.initialize();
+
+        ActionTestingSupport.assertProceedEvent(action.execute(requestCtx));
+
+        Assert.assertEquals(claims().getSubject(), ENDPOINT + "?id=" + list);
+    }
+
+    @Test
+    public void testSubjectEqualsAllocatedUri() throws Exception {
+        final String reference = StatusListIssuerTag.reference(list, StatusListIssuerTag.DID_WEB);
+        final FormStatusListToken action = newAction(reference);
+        action.initialize();
+
+        ActionTestingSupport.assertProceedEvent(action.execute(requestCtx));
+
+        Assert.assertEquals(claims().getSubject(),
+                StatusListParameters.listUri(DEPLOYMENT, StatusListParameters.LIST_PATH, reference));
+    }
+
+    @Test(expectedExceptions = ComponentInitializationException.class)
+    public void testNoDeploymentIssuer() throws Exception {
+        final FormStatusListToken action = newAction(list);
+        action.setDeploymentIssuer(null);
+        action.initialize();
+    }
+
+    @Test(expectedExceptions = ComponentInitializationException.class)
+    public void testHttpDeploymentIssuer() throws Exception {
+        final FormStatusListToken action = newAction(list);
+        action.setDeploymentIssuer("http://issuer.example.org");
+        action.initialize();
+    }
+
     @Test
     public void testTtl() throws Exception {
         final FormStatusListToken action = newAction(list);

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


More information about the commits mailing list