File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,14 @@ component singleton {
3
3
property name = " clientCredentialRepository" inject = " ClientCredentialRepository@cbsecurity-passkeys" ;
4
4
property name = " log" inject = " logbox:logger:{this}" ;
5
5
6
+ variables .PUBLIC_KEY_TYPE = createObject ( " java" , " com.yubico.webauthn.data.PublicKeyCredentialType" ).PUBLIC_KEY ;
7
+
6
8
function getCredentialIdsForUsername ( required string username ) {
7
9
if ( log .canDebug () ) {
8
10
log .debug ( " Retrieving all credential ids for username [#arguments .username #]." );
9
11
}
10
12
11
- var credentialIds = createObject ( " java" , " java.util.HashSet" ).init (
12
- variables .clientCredentialRepository .getCredentialIdsForUsername ( arguments .username )
13
- );
13
+ var credentialIds = variables .clientCredentialRepository .getCredentialIdsForUsername ( arguments .username );
14
14
15
15
if ( log .canDebug () ) {
16
16
log .debug (
@@ -19,7 +19,15 @@ component singleton {
19
19
);
20
20
}
21
21
22
- return credentialIds ;
22
+ return createObject ( " java" , " java.util.HashSet" ).init (
23
+ credentialIds .map ( ( credentialId ) = > {
24
+ return createObject ( " java" , " com.yubico.webauthn.data.PublicKeyCredentialDescriptor" )
25
+ .builder ()
26
+ .id ( toByteArray ( credentialId ) )
27
+ .type ( variables .PUBLIC_KEY_TYPE )
28
+ .build ();
29
+ } )
30
+ );;
23
31
}
24
32
25
33
function getUserHandleForUsername ( required string username ) {
@@ -139,4 +147,8 @@ component singleton {
139
147
);
140
148
}
141
149
150
+ private any function toByteArray ( required any value ) {
151
+ return createObject ( " java" , " com.yubico.webauthn.data.ByteArray" ).init ( arguments .value );
152
+ }
153
+
142
154
}
You can’t perform that action at this time.
0 commit comments