File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -698,7 +698,31 @@ export function pushedAuthorizationEndpoint(
698698 } )
699699 }
700700
701- //TODO Implement authorization_details verification
701+ // Add the authorization_details validation here:
702+ if ( req . body . authorization_details ) {
703+ const authDetails = Array . isArray ( req . body . authorization_details )
704+ ? req . body . authorization_details
705+ : JSON . parse ( req . body . authorization_details )
706+
707+ // Validate each authorization detail
708+ for ( const detail of authDetails ) {
709+ if ( detail . type !== 'openid_credential' ) {
710+ return sendErrorResponse ( res , 400 , {
711+ error : 'invalid_authorization_details' ,
712+ error_description : 'Only openid_credential type is supported'
713+ } )
714+ }
715+
716+ // Validate credential_configuration_id exists in issuer metadata
717+ if ( detail . credential_configuration_id &&
718+ ! issuer . issuerMetadata . credential_configurations_supported [ detail . credential_configuration_id ] ) {
719+ return sendErrorResponse ( res , 400 , {
720+ error : 'invalid_credential_request' ,
721+ error_description : `Unsupported credential configuration: ${ detail . credential_configuration_id } `
722+ } )
723+ }
724+ }
725+ }
702726
703727 // TODO: Both UUID and requestURI need to be configurable for the server
704728 const uuid = uuidv4 ( )
Original file line number Diff line number Diff line change @@ -252,17 +252,24 @@ export const createAccessTokenResponse = async (
252252 accessTokenProvider,
253253 } )
254254
255+ const credentialOfferSession = await credentialOfferSessions . getAsserted ( preAuthorizedCode )
256+ credentialOfferSession . status = IssueStatus . ACCESS_TOKEN_CREATED
257+ credentialOfferSession . lastUpdatedAt = + new Date ( )
258+
255259 const response : AccessTokenResponse = {
256260 access_token,
257261 token_type : dPoPJwk ? 'DPoP' : 'bearer' ,
258262 expires_in : tokenExpiresIn ,
259263 c_nonce : cNonce ,
260264 c_nonce_expires_in : cNonceExpiresIn ,
261265 interval,
266+ ...( credentialOfferSession . authorizationDetails && {
267+ authorization_details : credentialOfferSession . authorizationDetails . map ( detail => ( {
268+ ...detail ,
269+ credential_identifiers : generateCredentialIdentifiers ( detail , credentialOfferSession )
270+ } ) )
271+ } )
262272 }
263- const credentialOfferSession = await credentialOfferSessions . getAsserted ( preAuthorizedCode )
264- credentialOfferSession . status = IssueStatus . ACCESS_TOKEN_CREATED
265- credentialOfferSession . lastUpdatedAt = + new Date ( )
266273 await credentialOfferSessions . set ( preAuthorizedCode , credentialOfferSession )
267274 return response
268275}
Original file line number Diff line number Diff line change @@ -482,6 +482,7 @@ export interface AccessTokenResponse {
482482 c_nonce_expires_in ?: number // in seconds
483483 authorization_pending ?: boolean
484484 interval ?: number // in seconds
485+ authorization_details ?: AuthorizationDetails [ ]
485486}
486487
487488export enum AuthzFlowType {
Original file line number Diff line number Diff line change 11import { AssertedUniformCredentialOffer } from './CredentialIssuance.types'
22import { CredentialDataSupplierInput , NotificationRequest , StatusListOpts } from './Generic.types'
3+ import { AuthorizationDetails } from './Authorization.types'
34
45export interface StateType {
56 createdAt : number
@@ -21,6 +22,7 @@ export interface CredentialOfferSession extends StateType {
2122 authorizationCode ?: string
2223 redirectUri ?: string
2324 statusLists ?: Array < StatusListOpts >
25+ authorizationDetails ?: AuthorizationDetails [ ]
2426}
2527
2628export enum IssueStatus {
You can’t perform that action at this time.
0 commit comments