File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ local schema = {
139139 }
140140 },
141141 required = {" secret" },
142+ [" if" ] = {
143+ properties = {
144+ storage = { enum = {" redis" } },
145+ },
146+ },
147+ [" then" ] = {
148+ required = {" redis" },
149+ },
142150 additionalProperties = false ,
143151 },
144152 realm = {
Original file line number Diff line number Diff line change @@ -380,3 +380,32 @@ GET /t
380380refresh successful - request passed to upstream
381381-- - no_error_log
382382[error]
383+
384+
385+
386+ === TEST 4 : check schema with missing redis configuration when storage is redis
387+ -- - config
388+ location / t {
389+ content_by_lua_block {
390+ local plugin = require (" apisix.plugins.openid-connect" )
391+ local ok , err = plugin. check_schema({
392+ client_id = " a" ,
393+ client_secret = " b" ,
394+ discovery = " c" ,
395+ session = {
396+ secret = " jwcE5v3pM9VhqLxmxFOH9uZaLo8u7KQK" ,
397+ storage = " redis" ,
398+ -- redis object missing
399+ }
400+ })
401+ if not ok then
402+ ngx. say (err)
403+ else
404+ ngx. say (" done" )
405+ end
406+ }
407+ }
408+ -- - request
409+ GET / t
410+ -- - response_body
411+ property " session" validation failed: then clause did not match
You can’t perform that action at this time.
0 commit comments