[java-idp-plugin-vci] 02/03: For code flow use now properly built access token

Codeberg noreply at shibboleth.net
Fri Dec 5 12:43:49 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/a0dda19504f01e53f8136879d47b8991ea0e9a47

commit a0dda19504f01e53f8136879d47b8991ea0e9a47
Author: jlauros <janne.lauros at csc.fi>
AuthorDate: Fri Dec 5 14:42:27 2025 +0200

    For code flow use now properly built access token
---
 .../impl/FormOutboundTokenResponseMessage.java     | 51 ++++++++++------------
 1 file changed, 24 insertions(+), 27 deletions(-)

diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundTokenResponseMessage.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundTokenResponseMessage.java
index 73c8133..f704448 100644
--- a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundTokenResponseMessage.java
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundTokenResponseMessage.java
@@ -30,7 +30,6 @@ import javax.annotation.Nullable;
 import org.geant.shibboleth.plugin.openidvci.config.OpenIDVCIConfiguration;
 import org.geant.shibboleth.plugin.openidvci.messaging.context.TokenContext;
 import org.geant.shibboleth.plugin.openidvci.messaging.context.navigate.AuthorizationDetailsLookupFunction;
-import org.geant.shibboleth.plugin.openidvci.messaging.impl.AbstractOpenIDVCITokenRequestAction;
 import org.geant.shibboleth.plugin.openidvci.messaging.impl.AbstractOpenIDVCITokenResponseAction;
 import org.geant.shibboleth.plugin.openidvci.messaging.impl.OpenIDVCIAuthorizationDetail;
 import org.geant.shibboleth.plugin.openidvci.messaging.impl.OpenIDVCITokenRequest;
@@ -51,7 +50,6 @@ import com.nimbusds.oauth2.sdk.Scope;
 import com.nimbusds.oauth2.sdk.token.Tokens;
 
 import net.shibboleth.idp.plugin.oidc.op.token.support.AccessTokenClaimsSet;
-import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.idp.profile.IdPEventIds;
 import net.shibboleth.profile.config.ProfileConfiguration;
 import net.shibboleth.profile.context.RelyingPartyContext;
@@ -227,6 +225,7 @@ public class FormOutboundTokenResponseMessage extends AbstractOpenIDVCITokenResp
         }
         try {
             CredentialOfferObject credentialOffer = tokenContext.getCredentialOfferObject();
+            AccessTokenResponse response = null;
             AccessTokenClaimsSet claimsSet = null;
             if (credentialOffer != null) {
                 // TODO: Set proper access token values!
@@ -237,32 +236,30 @@ public class FormOutboundTokenResponseMessage extends AbstractOpenIDVCITokenResp
                         .setSubject(credentialOffer.serialize()).setScope(new Scope("openid"))
                         .setDlClaimsUI(tokenContext.getPotentialCredentials())
                         .setExpiresAt(Instant.now().plus(accessTokenLifetime)).build();
+                log.info("Serialized access token {}", claimsSet.serialize());
+                AccessToken accesToken = new BearerAccessToken(claimsSet.serialize(dataSealer),
+                        accessTokenLifetime.toSeconds(), null);
+
+                if (tokenContext.getResponseAuthorizationDetails() != null) {
+                    Map<String, Object> params = new HashMap<>();
+                    params.put("authorization_details", new ObjectMapper().convertValue(
+                            tokenContext.getResponseAuthorizationDetails(), new TypeReference<List<Object>>() {
+                            }));
+                    response = new AccessTokenResponse(new Tokens(accesToken, null), params);
+                } else {
+                    response = new AccessTokenResponse(new Tokens(accesToken, null));
+                }
             } else if (getOidcResponseContext().getAuthorizationGrantClaimsSet() != null) {
-                // TODO: Set proper access token values!
-                claimsSet = new AccessTokenClaimsSet.Builder()
-                        .setIssuer(issuerLookupStrategy.apply(profileRequestContext))
-                        .setClientID(getOidcResponseContext().getAuthorizationGrantClaimsSet().getClientID()).setJWTID(idGenerator)
-                        .setIssuedAt(Instant.now()).setAuthenticationTime(Instant.now())
-                        .setPrincipal(getOidcResponseContext().getAuthorizationGrantClaimsSet().getPrincipal())
-                        .setSubject(getOidcResponseContext().getAuthorizationGrantClaimsSet().getSubject()).setScope(new Scope("openid"))
-                        .setDlClaims(getOidcResponseContext().getAuthorizationGrantClaimsSet().getDeliveryClaims())
-                        .setDlClaimsUI(getOidcResponseContext().getAuthorizationGrantClaimsSet().getUserinfoDeliveryClaims())
-                        .setExpiresAt(Instant.now().plus(accessTokenLifetime)).build();
-            }
-            // it should be one or the other!
-            assert claimsSet != null;
-            log.info("Serialized access token {}", claimsSet.serialize());
-            AccessToken accesToken = new BearerAccessToken(claimsSet.serialize(dataSealer),
-                    accessTokenLifetime.toSeconds(), null);
-            AccessTokenResponse response = null;
-            if (tokenContext.getResponseAuthorizationDetails() != null) {
-                Map<String, Object> params = new HashMap<>();
-                params.put("authorization_details", new ObjectMapper().convertValue(
-                        tokenContext.getResponseAuthorizationDetails(), new TypeReference<List<Object>>() {
-                        }));
-                response = new AccessTokenResponse(new Tokens(accesToken, null), params);
-            } else {
-                response = new AccessTokenResponse(new Tokens(accesToken, null));
+                if (tokenContext.getResponseAuthorizationDetails() != null) {
+                    Map<String, Object> params = new HashMap<>();
+                    params.put("authorization_details", new ObjectMapper().convertValue(
+                            tokenContext.getResponseAuthorizationDetails(), new TypeReference<List<Object>>() {
+                            }));
+                    response = new AccessTokenResponse(new Tokens(getOidcResponseContext().getAccessToken(), null),
+                            params);
+                } else {
+                    response = new AccessTokenResponse(new Tokens(getOidcResponseContext().getAccessToken(), null));
+                }
             }
             profileRequestContext.ensureOutboundMessageContext().setMessage(response);
             return;

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


More information about the commits mailing list