Skip to content

Commit 21bdc07

Browse files
Added a custom query parameter, deferred, to the credential endpoint
and the batch credential endpoint. This query parameter is not a standardized one. It was added only for testing the deferred issuance flow.
1 parent 6e8b6c2 commit 21bdc07

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/main/java/com/authlete/jaxrs/server/api/vci/BatchCredentialEndpoint.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2023 Authlete, Inc.
2+
* Copyright (C) 2023-2024 Authlete, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
2323
import javax.ws.rs.HeaderParam;
2424
import javax.ws.rs.POST;
2525
import javax.ws.rs.Path;
26+
import javax.ws.rs.QueryParam;
2627
import javax.ws.rs.WebApplicationException;
2728
import javax.ws.rs.core.Context;
2829
import javax.ws.rs.core.HttpHeaders;
@@ -50,6 +51,7 @@ public Response post(
5051
@Context HttpServletRequest request,
5152
@HeaderParam(HttpHeaders.AUTHORIZATION) String authorization,
5253
@HeaderParam("DPoP") String dpop,
54+
@QueryParam("deferred") String deferred,
5355
String requestContent)
5456
{
5557
final AuthleteApi api = AuthleteApiFactory.getDefaultApi();
@@ -74,6 +76,17 @@ public Response post(
7476
// Prepare credential issuance orders.
7577
CredentialIssuanceOrder[] orders = prepareOrders(introspection, infos, headers);
7678

79+
// Defer the issuance if it is explicitly requested.
80+
// Note that the 'deferred' query parameter is not a standardized one.
81+
boolean issuanceDeferred = Boolean.parseBoolean(deferred);
82+
if (issuanceDeferred)
83+
{
84+
for (CredentialIssuanceOrder order : orders)
85+
{
86+
order.setIssuanceDeferred(issuanceDeferred);
87+
}
88+
}
89+
7790
// Issue credentials and return a batch credential response.
7891
return issue(api, orders, accessToken, headers);
7992
}

src/main/java/com/authlete/jaxrs/server/api/vci/CredentialEndpoint.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2023 Authlete, Inc.
2+
* Copyright (C) 2023-2024 Authlete, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
2323
import javax.ws.rs.HeaderParam;
2424
import javax.ws.rs.POST;
2525
import javax.ws.rs.Path;
26+
import javax.ws.rs.QueryParam;
2627
import javax.ws.rs.WebApplicationException;
2728
import javax.ws.rs.core.Context;
2829
import javax.ws.rs.core.HttpHeaders;
@@ -51,6 +52,7 @@ public Response post(
5152
@Context HttpServletRequest request,
5253
@HeaderParam(HttpHeaders.AUTHORIZATION) String authorization,
5354
@HeaderParam("DPoP") String dpop,
55+
@QueryParam("deferred") String deferred,
5456
String requestContent)
5557
{
5658
final AuthleteApi api = AuthleteApiFactory.getDefaultApi();
@@ -76,6 +78,14 @@ public Response post(
7678
CredentialIssuanceOrder order =
7779
prepareOrder(OrderContext.SINGLE, introspection, info, headers);
7880

81+
// Defer the issuance if it is explicitly requested.
82+
// Note that the 'deferred' query parameter is not a standardized one.
83+
boolean issuanceDeferred = Boolean.parseBoolean(deferred);
84+
if (issuanceDeferred)
85+
{
86+
order.setIssuanceDeferred(issuanceDeferred);
87+
}
88+
7989
// Issue a credential and return a credential response.
8090
return issue(api, order, accessToken, headers);
8191
}

0 commit comments

Comments
 (0)