File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -699,6 +699,17 @@ export class WaltIdPolicyHandler extends PolicyHandler {
699699 const combinedCredentials = [
700700 ...new Set ( [ ...credentialSubjectCredentials , ...serviceCredentials ] )
701701 ]
702+ const normalizePolicies = ( arr : any [ ] ) : string [ ] =>
703+ arr
704+ . map ( ( p ) =>
705+ typeof p === 'string'
706+ ? p
707+ : p && typeof p === 'object' && typeof p . policy === 'string'
708+ ? p . policy
709+ : null
710+ )
711+ . filter ( ( p ) : p is string => ! ! p )
712+
702713 const vp_policies = new Set < string > ( )
703714 const vc_policies = new Set < string > ( )
704715
@@ -708,12 +719,8 @@ export class WaltIdPolicyHandler extends PolicyHandler {
708719 const envvc_policies = process . env . DEFAULT_VC_POLICIES
709720 ? JSON . parse ( process . env . DEFAULT_VC_POLICIES )
710721 : [ ]
711-
712- if ( Array . isArray ( envvp_policies ) )
713- envvp_policies . forEach ( ( policy : string ) => vp_policies . add ( policy ) )
714-
715- if ( Array . isArray ( envvc_policies ) )
716- envvc_policies . forEach ( ( policy : string ) => vc_policies . add ( policy ) )
722+ normalizePolicies ( envvp_policies ) . forEach ( ( pol ) => vp_policies . add ( pol ) )
723+ normalizePolicies ( envvc_policies ) . forEach ( ( pol ) => vc_policies . add ( pol ) )
717724
718725 const request_credentialsMap = new Map < string , any > ( )
719726
You can’t perform that action at this time.
0 commit comments