ns_crypto::JWT method select_jwk_from_jwks (protected)

 <instance of ns_crypto::JWT[i]> select_jwk_from_jwks [ -jwks jwks ] \
    [ -alg alg ] [ -kid kid ]

Defined in

Switches:
-jwks (optional)
-alg (optional)
-kid (optional)

Testcases:
No testcase defined.
Source code:
if {![dict exists $jwks keys]} {
    error "invalid JWKS: missing \"keys\""
}

set matches {}
foreach jwk [dict get $jwks keys] {
    if {$kid ne "" && [dict exists $jwk kid] && [dict get $jwk kid] ne $kid} {
        continue
    }
    if {$kid ne "" && ![dict exists $jwk kid]} {
        continue
    }
    if {[:jwk_supports_alg $jwk $alg]} {
        lappend matches $jwk
    }
}

if {[llength $matches] == 0} {
    error "no matching JWK found in JWKS"
}
if {[llength $matches] > 1} {
    error "JWKS lookup is ambiguous; multiple keys match"
}
return [lindex $matches 0]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: