blib/lib/Lemonldap/NG/Manager/Build/OpenApi.pm untested

filter: Statementstmt 0.0% 0 / 852 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 872 CC 6 SCAR 30.9
CC
6
Cov
0%
getOptions
42.0
handleSelect
2.0
openapi
2.0
CRAP 22.0
1 # This file contains the OpenAPI specification for the Manager API
2  
3 package Lemonldap::NG::Manager::Build::OpenApi;
4  
5 our $VERSION = '2.23.0';
6  
7 use Lemonldap::NG::Manager::Attributes;
8 use Lemonldap::NG::Manager::Api::Common;
9 use Lemonldap::NG::Common;
10 use JSON;
11  
12 my %TYPEMAP = (
13 "bool" => sub { { type => "boolean" } },
14 "text" => sub { { type => "string" } },
15 "longtext" => sub { { type => "string" } },
16 "int" => sub { { type => "integer" } },
17 "intOrNull" => sub { { type => "integer" } },
18 "trool" => sub { { type => "integer", maximum => 1, minimum => -1 } },
19 "select" => \&handleSelect,
20 "password" => sub { { type => "string", format => "password" } },
21 "file" => sub { { type => "string" } },
22 "url" => sub { { type => "string", format => "url" } },
23 );
24  
25 sub handleSelect {
26 my ($attribute_desc) = @_;
27 return {
28 type => "string",
29 enum => [ map { $_->{k} } @{ $attribute_desc->{select} } ],
30 },
31 ;
32 }
33  
34 my @exceptions = qw(
35 oidcRPMetaDataOptionsExtraClaims
36 );
37  
38 sub getOptions {
39 my ( $attributes, $prefix ) = @_;
40 my $options = {};
41 for my $option ( grep /^$prefix./, keys %$attributes ) {
42 next if grep { $_ eq $option } @exceptions;
43 my $attribute_desc = $attributes->{$option};
44 my $api_option_name =
45 Lemonldap::NG::Manager::Api->_translateOptionConfToApi($option);
46 if ($api_option_name) {
47 $options->{$api_option_name} = {};
48  
49 my $type = $attribute_desc->{type};
50 my $api_type_func = $TYPEMAP{$type};
51  
52 if ($api_type_func) {
53 my $desc = $api_type_func->($attribute_desc);
54  
55 if ( Lemonldap::NG::Manager::Api->_mustArrayizeOption($option) )
56 {
57 $options->{$api_option_name} = {
58 type => "array",
59 items => $desc,
60 };
61 }
62 else {
63 $options->{$api_option_name} = $desc;
64 }
65 }
66 else {
67 warn("Could not translate API type $type for $option");
68 }
69  
70 my $default = $attribute_desc->{default};
71 if ($default) {
72 $options->{$api_option_name}->{default} = $default;
73 }
74 }
75 else {
76 warn("Could not translate option name $option");
77 }
78 }
79 return $options;
80 }
81  
82 my $attributes = Lemonldap::NG::Manager::Attributes->attributes();
83  
84 #getOptions( $attributes, "samlSPMetaDataOptions" );
85  
86 sub openapi {
87 return {
88 'openapi' => '3.0.1',
89 'info' => {
90 'title' => 'LemonLDAP::NG Manager API',
91 'description' =>
92 'The Manager API allows an administrator to modify the LemonLDAP::NG configuration programmatically. It is not meant to be accessed by end users. The client libraries mentionned in examples can be generated from doc/sources/manager-api/openapi-spec.yaml',
93 'version' => $Lemonldap::NG::Common::VERSION,
94 },
95 'servers' => [ {
96 'url' => 'https://manager-api.example.com'
97 }
98 ],
99 'tags' => [ {
100 'name' => 'samlsp',
101 'description' => 'SAML Service Providers'
102 },
103 {
104 'name' => 'oidcrp',
105 'description' => 'OpenID Connect Relying Parties'
106 },
107 {
108 'name' => '2fa',
109 'description' => 'negistered Second Factors'
110 },
111 {
112 'name' => 'history',
113 'description' => 'Login history'
114 }
115 ],
116 'paths' => {
117 '/api/v1/status' => {
118 'get' => {
119 'summary' => 'Check the status of the API',
120 'operationId' => 'status',
121 'responses' => {
122 '200' => {
123 '$ref' => '#/components/responses/StatusResponse'
124 },
125 '503' => {
126 '$ref' => '#/components/responses/StatusResponse'
127 }
128 }
129 }
130 },
131 '/api/v1/history/{uid}' => {
132 'get' => {
133 'summary' => 'Get the login history for a user',
134 'operationId' => 'getHistory',
135 'tags' => ['history'],
136 'parameters' => [ {
137 'name' => 'uid',
138 'in' => 'path',
139 'required' => JSON::true,
140 'schema' => {
141 'type' => 'string'
142 }
143 },
144 {
145 'name' => 'result',
146 'in' => 'query',
147 'required' => JSON::false,
148 'schema' => {
149 'type' => 'string',
150 'enum' => [ 'success', 'failed', 'any' ]
151 }
152 }
153 ],
154 'responses' => {
155 '200' => {
156 '$ref' => '#/components/responses/HistoryList'
157 },
158 '400' => {
159 '$ref' => '#/components/responses/Error'
160 },
161 '404' => {
162 '$ref' => '#/components/responses/NotFound'
163 }
164 }
165 }
166 },
167 '/api/v1/history/{uid}/last' => {
168 'get' => {
169 'summary' => 'Get the last history event for a user',
170 'operationId' => 'getHistoryLast',
171 'tags' => ['history'],
172 'parameters' => [ {
173 'name' => 'uid',
174 'in' => 'path',
175 'required' => JSON::true,
176 'schema' => {
177 'type' => 'string'
178 }
179 },
180 {
181 'name' => 'result',
182 'in' => 'query',
183 'required' => JSON::false,
184 'schema' => {
185 'type' => 'string',
186 'enum' => [ 'success', 'failed', 'any' ]
187 }
188 }
189 ],
190 'responses' => {
191 '200' => {
192 '$ref' => '#/components/responses/HistoryItem'
193 },
194 '400' => {
195 '$ref' => '#/components/responses/Error'
196 },
197 '404' => {
198 '$ref' => '#/components/responses/NotFound'
199 }
200 }
201 }
202 },
203 '/api/v1/providers/saml/sp' => {
204 'post' => {
205 'tags' => ['samlsp'],
206 'summary' => 'Create a new SAML Service provider',
207 'operationId' => 'addsamlsp',
208 'requestBody' => {
209 'description' => 'SAML Service provider to add',
210 'content' => {
211 'application/json' => {
212 'schema' => {
213 '$ref' => '#/components/schemas/SamlSp'
214 }
215 }
216 },
217 'required' => JSON::true
218 },
219 'responses' => {
220 '201' => {
221 '$ref' => '#/components/responses/Created'
222 },
223 '400' => {
224 '$ref' => '#/components/responses/Error'
225 },
226 '409' => {
227 '$ref' => '#/components/responses/Conflict'
228 }
229 }
230 }
231 },
232 '/api/v1/providers/saml/sp/findByConfKey' => {
233 'get' => {
234 'tags' => ['samlsp'],
235 'summary' =>
236 'Finds SAML Service providers by configuration key',
237 'description' =>
238 'Takes a search pattern to be tested against existing service providers',
239 'operationId' => 'findSamlSpByConfKey',
240 'parameters' => [ {
241 'name' => 'pattern',
242 'in' => 'query',
243 'description' => 'Search pattern',
244 'required' => JSON::true,
245 'schema' => {
246 'type' => 'string'
247 },
248 'examples' => {
249 'any' => {
250 'summary' => 'Any value',
251 'value' => '*'
252 },
253 'prefix' => {
254 'summary' => 'Given prefix',
255 'value' => 'zone1-*'
256 },
257 'anywhere' => {
258 'summary' => 'Substring',
259 'value' => 'something'
260 }
261 }
262 }
263 ],
264 'responses' => {
265 '200' => {
266 '$ref' => '#/components/responses/ManySamlSp'
267 },
268 '400' => {
269 '$ref' => '#/components/responses/Error'
270 }
271 }
272 }
273 },
274 '/api/v1/providers/saml/sp/findByEntityId' => {
275 'get' => {
276 'tags' => ['samlsp'],
277 'summary' => 'Finds SAML Service Provider by Entity ID',
278 'operationId' => 'findSamlSpByEntityId',
279 'parameters' => [ {
280 'name' => 'entityId',
281 'in' => 'query',
282 'description' => 'Entity ID to search',
283 'required' => JSON::true,
284 'schema' => {
285 'type' => 'string'
286 },
287 'example' => 'http://mysp.example.com/saml/metadata'
288 }
289 ],
290 'responses' => {
291 '200' => {
292 '$ref' => '#/components/responses/OneSamlSp'
293 },
294 '400' => {
295 '$ref' => '#/components/responses/Error'
296 },
297 '404' => {
298 '$ref' => '#/components/responses/NotFound'
299 }
300 }
301 }
302 },
303 '/api/v1/providers/saml/sp/{confKey}' => {
304 'get' => {
305 'tags' => ['samlsp'],
306 'summary' =>
307 'Get SAML Service Provider by configuration key',
308 'description' => 'Returns a single Service Provider',
309 'operationId' => 'getSamlSpByConfKey',
310 'parameters' => [ {
311 'name' => 'confKey',
312 'in' => 'path',
313 'description' =>
314 'Configuration key of SAML Service Provider',
315 'required' => JSON::true,
316 'schema' => {
317 '$ref' => '#/components/schemas/confKey'
318 }
319 }
320 ],
321 'responses' => {
322 '200' => {
323 '$ref' => '#/components/responses/OneSamlSp'
324 },
325 '400' => {
326 '$ref' => '#/components/responses/Error'
327 },
328 '404' => {
329 '$ref' => '#/components/responses/NotFound'
330 }
331 }
332 },
333 'put' => {
334 'tags' => ['samlsp'],
335 'summary' => 'Replaces a SAML Service',
336 'operationId' => 'replaceSamlSp',
337 'parameters' => [ {
338 'name' => 'confKey',
339 'in' => 'path',
340 'description' =>
341 'Configuration key of SAML Service Provider that needs to be replaced',
342 'required' => JSON::true,
343 'schema' => {
344 '$ref' => '#/components/schemas/confKey'
345 }
346 }
347 ],
348 'requestBody' => {
349 'content' => {
350 'application/json' => {
351 'schema' => {
352 '$ref' =>
353 '#/components/schemas/SamlSpReplace'
354 }
355 }
356 }
357 },
358 'responses' => {
359 '204' => {
360 '$ref' => '#/components/responses/NoContent'
361 },
362 '400' => {
363 '$ref' => '#/components/responses/Error'
364 },
365 '404' => {
366 '$ref' => '#/components/responses/NotFound'
367 },
368 '409' => {
369 '$ref' => '#/components/responses/Conflict'
370 }
371 }
372 },
373 'patch' => {
374 'tags' => ['samlsp'],
375 'summary' => 'Updates a SAML Service.',
376 'operationId' => 'updateSamlSp',
377 'description' => <<'EOF'
378 This method merges the supplied JSON object with existing configuration. You
379 can delete a subkey from a top-level key by setting its value to `null`. For
380 example:
381 ```
382 {
383 "macros": {
384 "addme": "newval",
385 "deleteme": null
386 }
387 }
388 ```
389 EOF
390 ,
391 'parameters' => [ {
392 'name' => 'confKey',
393 'in' => 'path',
394 'description' =>
395 'Configuration key of SAML Service Provider that needs to be updated',
396 'required' => JSON::true,
397 'schema' => {
398 '$ref' => '#/components/schemas/confKey'
399 }
400 }
401 ],
402 'requestBody' => {
403 'content' => {
404 'application/json' => {
405 'schema' => {
406 '$ref' =>
407 '#/components/schemas/SamlSpUpdate'
408 }
409 }
410 }
411 },
412 'responses' => {
413 '204' => {
414 '$ref' => '#/components/responses/NoContent'
415 },
416 '400' => {
417 '$ref' => '#/components/responses/Error'
418 },
419 '404' => {
420 '$ref' => '#/components/responses/NotFound'
421 },
422 '409' => {
423 '$ref' => '#/components/responses/Conflict'
424 }
425 }
426 },
427 'delete' => {
428 'tags' => ['samlsp'],
429 'summary' => 'Deletes a SAML Service Provider',
430 'operationId' => 'deleteSamlSp',
431 'parameters' => [ {
432 'name' => 'confKey',
433 'in' => 'path',
434 'description' =>
435 'Configuration key of SAML Service Provider to delete',
436 'required' => JSON::true,
437 'schema' => {
438 '$ref' => '#/components/schemas/confKey'
439 }
440 }
441 ],
442 'responses' => {
443 '204' => {
444 '$ref' => '#/components/responses/NoContent'
445 },
446 '400' => {
447 '$ref' => '#/components/responses/Error'
448 },
449 '404' => {
450 '$ref' => '#/components/responses/NotFound'
451 }
452 }
453 }
454 },
455 '/api/v1/providers/oidc/rp' => {
456 'post' => {
457 'tags' => ['oidcrp'],
458 'summary' => 'Create a new OpenID Connect Relying Party',
459 'operationId' => 'addoidcrp',
460 'requestBody' => {
461 'description' => 'OpenID Connect Relying Party to add',
462 'content' => {
463 'application/json' => {
464 'schema' => {
465 '$ref' => '#/components/schemas/OidcRp'
466 }
467 }
468 },
469 'required' => JSON::true
470 },
471 'responses' => {
472 '201' => {
473 '$ref' => '#/components/responses/Created'
474 },
475 '400' => {
476 '$ref' => '#/components/responses/Error'
477 },
478 '409' => {
479 '$ref' => '#/components/responses/Conflict'
480 }
481 }
482 }
483 },
484 '/api/v1/providers/oidc/rp/findByConfKey' => {
485 'get' => {
486 'tags' => ['oidcrp'],
487 'summary' =>
488 'Finds OpenID Connect Relying Partys by configuration key',
489 'description' =>
490 'Takes a search pattern to be tested against existing service providers',
491 'operationId' => 'findOidcRpByConfKey',
492 'parameters' => [ {
493 'name' => 'pattern',
494 'in' => 'query',
495 'description' => 'Search pattern',
496 'required' => JSON::true,
497 'schema' => {
498 '$ref' => '#/components/schemas/confKey'
499 },
500 'examples' => {
501 'any' => {
502 'summary' => 'Any value',
503 'value' => '*'
504 },
505 'prefix' => {
506 'summary' => 'Given prefix',
507 'value' => 'zone1-*'
508 },
509 'anywhere' => {
510 'summary' => 'Substring',
511 'value' => 'something'
512 }
513 }
514 }
515 ],
516 'responses' => {
517 '200' => {
518 '$ref' => '#/components/responses/ManyOidcRp'
519 },
520 '400' => {
521 '$ref' => '#/components/responses/Error'
522 }
523 }
524 }
525 },
526 '/api/v1/providers/oidc/rp/findByClientId' => {
527 'get' => {
528 'tags' => ['oidcrp'],
529 'summary' =>
530 'Finds OpenID Connect Relying Party by Client ID',
531 'operationId' => 'findOidcRpByClientId',
532 'parameters' => [ {
533 'name' => 'clientId',
534 'in' => 'query',
535 'description' => 'Client ID to search',
536 'required' => JSON::true,
537 'schema' => {
538 'type' => 'string'
539 },
540 'example' => 'my_client_id'
541 }
542 ],
543 'responses' => {
544 '200' => {
545 '$ref' => '#/components/responses/OneOidcRp'
546 },
547 '400' => {
548 '$ref' => '#/components/responses/Error'
549 },
550 '404' => {
551 '$ref' => '#/components/responses/NotFound'
552 }
553 }
554 }
555 },
556 '/api/v1/providers/oidc/rp/{confKey}' => {
557 'get' => {
558 'tags' => ['oidcrp'],
559 'summary' =>
560 'Get OpenID Connect Relying Party by configuration key',
561 'description' => 'Returns a single Service Provider',
562 'operationId' => 'getOidcRpByConfKey',
563 'parameters' => [ {
564 'name' => 'confKey',
565 'in' => 'path',
566 'description' =>
567 'Configuration key of OpenID Connect Relying Party',
568 'required' => JSON::true,
569 'schema' => {
570 '$ref' => '#/components/schemas/confKey'
571 }
572 }
573 ],
574 'responses' => {
575 '200' => {
576 '$ref' => '#/components/responses/OneOidcRp'
577 },
578 '400' => {
579 '$ref' => '#/components/responses/Error'
580 },
581 '404' => {
582 '$ref' => '#/components/responses/NotFound'
583 }
584 }
585 },
586 'patch' => {
587 'tags' => ['oidcrp'],
588 'summary' => 'Updates an OpenID Connect Relying Party',
589 'description' => <<'EOF'
590 This method merges the supplied JSON object with existing configuration. You
591 can delete a subkey from a top-level key by setting its value to `null`. For
592 example:
593 ```
594 {
595 "macros": {
596 "addme": "newval",
597 "deleteme": null
598 }
599 }
600 ```
601 EOF
602 ,
603 'operationId' => 'updateOidcRp',
604 'parameters' => [ {
605 'name' => 'confKey',
606 'in' => 'path',
607 'description' =>
608 'Configuration key of OpenID Connect Relying Party that needs to be updated',
609 'required' => JSON::true,
610 'schema' => {
611 '$ref' => '#/components/schemas/confKey'
612 }
613 }
614 ],
615 'requestBody' => {
616 'content' => {
617 'application/json' => {
618 'schema' => {
619 '$ref' =>
620 '#/components/schemas/OidcRpUpdate'
621 }
622 }
623 }
624 },
625 'responses' => {
626 '204' => {
627 '$ref' => '#/components/responses/NoContent'
628 },
629 '400' => {
630 '$ref' => '#/components/responses/Error'
631 },
632 '404' => {
633 '$ref' => '#/components/responses/NotFound'
634 },
635 '409' => {
636 '$ref' => '#/components/responses/Conflict'
637 }
638 }
639 },
640 'put' => {
641 'tags' => ['oidcrp'],
642 'summary' => 'Replaces an OpenID Connect Relying Party',
643 'operationId' => 'replaceOidcRp',
644 'parameters' => [ {
645 'name' => 'confKey',
646 'in' => 'path',
647 'description' =>
648 'Configuration key of OpenID Connect Relying Party that needs to be replaced',
649 'required' => JSON::true,
650 'schema' => {
651 '$ref' => '#/components/schemas/confKey'
652 }
653 }
654 ],
655 'requestBody' => {
656 'content' => {
657 'application/json' => {
658 'schema' => {
659 '$ref' =>
660 '#/components/schemas/OidcRpReplace'
661 }
662 }
663 }
664 },
665 'responses' => {
666 '204' => {
667 '$ref' => '#/components/responses/NoContent'
668 },
669 '400' => {
670 '$ref' => '#/components/responses/Error'
671 },
672 '404' => {
673 '$ref' => '#/components/responses/NotFound'
674 },
675 '409' => {
676 '$ref' => '#/components/responses/Conflict'
677 }
678 }
679 },
680 'delete' => {
681 'tags' => ['oidcrp'],
682 'summary' => 'Deletes a OpenID Connect Relying Party',
683 'operationId' => 'deleteOidcRp',
684 'parameters' => [ {
685 'name' => 'confKey',
686 'in' => 'path',
687 'description' =>
688 'Configuration key of OpenID Connect Relying Party to delete',
689 'required' => JSON::true,
690 'schema' => {
691 '$ref' => '#/components/schemas/confKey'
692 }
693 }
694 ],
695 'responses' => {
696 '204' => {
697 '$ref' => '#/components/responses/NoContent'
698 },
699 '400' => {
700 '$ref' => '#/components/responses/Error'
701 },
702 '404' => {
703 '$ref' => '#/components/responses/NotFound'
704 }
705 }
706 }
707 },
708 '/api/v1/providers/cas/app' => {
709 'post' => {
710 'tags' => ['casapp'],
711 'summary' => 'Create a new CAS Application',
712 'operationId' => 'addcasapp',
713 'requestBody' => {
714 'description' => 'CAS Application to add',
715 'content' => {
716 'application/json' => {
717 'schema' => {
718 '$ref' => '#/components/schemas/CasApp'
719 }
720 }
721 },
722 'required' => JSON::true
723 },
724 'responses' => {
725 '201' => {
726 '$ref' => '#/components/responses/Created'
727 },
728 '400' => {
729 '$ref' => '#/components/responses/Error'
730 },
731 '409' => {
732 '$ref' => '#/components/responses/Conflict'
733 }
734 }
735 }
736 },
737 '/api/v1/providers/cas/app/findByConfKey' => {
738 'get' => {
739 'tags' => ['casapp'],
740 'summary' => 'Finds CAS applications by configuration key',
741 'description' =>
742 'Takes a search pattern to be tested against existing applications',
743 'operationId' => 'findCasAppByConfKey',
744 'parameters' => [ {
745 'name' => 'pattern',
746 'in' => 'query',
747 'description' => 'Search pattern',
748 'required' => JSON::true,
749 'schema' => {
750 'type' => 'string'
751 },
752 'examples' => {
753 'any' => {
754 'summary' => 'Any value',
755 'value' => '*'
756 },
757 'prefix' => {
758 'summary' => 'Given prefix',
759 'value' => 'zone1-*'
760 },
761 'anywhere' => {
762 'summary' => 'Substring',
763 'value' => 'something'
764 }
765 }
766 }
767 ],
768 'responses' => {
769 '200' => {
770 '$ref' => '#/components/responses/ManyCasApp'
771 },
772 '400' => {
773 '$ref' => '#/components/responses/Error'
774 }
775 }
776 }
777 },
778 '/api/v1/providers/cas/app/findByServiceUrl' => {
779 'get' => {
780 'tags' => ['casapp'],
781 'summary' => 'Get CAS Application by Service URL',
782 'operationId' => 'findCasAppByServiceUrl',
783 'parameters' => [ {
784 'name' => 'serviceUrl',
785 'in' => 'query',
786 'description' => 'Service URL to search',
787 'required' => JSON::true,
788 'schema' => {
789 'type' => 'string'
790 },
791 'example' => 'http://mycasapp.example.com/'
792 }
793 ],
794 'responses' => {
795 '200' => {
796 '$ref' => '#/components/responses/OneCasApp'
797 },
798 '400' => {
799 '$ref' => '#/components/responses/Error'
800 },
801 '404' => {
802 '$ref' => '#/components/responses/NotFound'
803 }
804 }
805 }
806 },
807 '/api/v1/providers/cas/app/{confKey}' => {
808 'get' => {
809 'tags' => ['casapp'],
810 'summary' => 'Get CAS Application by configuration key',
811 'description' => 'Returns a single Application',
812 'operationId' => 'getCasAppByConfKey',
813 'parameters' => [ {
814 'name' => 'confKey',
815 'in' => 'path',
816 'description' =>
817 'Configuration key of CAS Application',
818 'required' => JSON::true,
819 'schema' => {
820 '$ref' => '#/components/schemas/confKey'
821 }
822 }
823 ],
824 'responses' => {
825 '200' => {
826 '$ref' => '#/components/responses/OneCasApp'
827 },
828 '400' => {
829 '$ref' => '#/components/responses/Error'
830 },
831 '404' => {
832 '$ref' => '#/components/responses/NotFound'
833 }
834 }
835 },
836 'put' => {
837 'tags' => ['casapp'],
838 'summary' => 'Replaces a CAS Application',
839 'operationId' => 'replaceCasApp',
840 'parameters' => [ {
841 'name' => 'confKey',
842 'in' => 'path',
843 'description' =>
844 'Configuration key of CAS Application that needs to be replaced',
845 'required' => JSON::true,
846 'schema' => {
847 '$ref' => '#/components/schemas/confKey'
848 }
849 }
850 ],
851 'requestBody' => {
852 'content' => {
853 'application/json' => {
854 'schema' => {
855 '$ref' =>
856 '#/components/schemas/CasAppReplace'
857 }
858 }
859 }
860 },
861 'responses' => {
862 '204' => {
863 '$ref' => '#/components/responses/NoContent'
864 },
865 '400' => {
866 '$ref' => '#/components/responses/Error'
867 },
868 '404' => {
869 '$ref' => '#/components/responses/NotFound'
870 },
871 '409' => {
872 '$ref' => '#/components/responses/Conflict'
873 }
874 }
875 },
876 'patch' => {
877 'tags' => ['casapp'],
878 'summary' => 'Updates a CAS Application.',
879 'operationId' => 'updateCasApp',
880 'description' => <<'EOF'
881 This method merges the supplied JSON object with existing configuration. You
882 can delete a subkey from a top-level key by setting its value to `null`. For
883 example:
884 ```
885 {
886 "macros": {
887 "addme": "newval",
888 "deleteme": null
889 }
890 }
891 ```
892 EOF
893 ,
894 'parameters' => [ {
895 'name' => 'confKey',
896 'in' => 'path',
897 'description' =>
898 'Configuration key of CAS Application that needs to be updated',
899 'required' => JSON::true,
900 'schema' => {
901 '$ref' => '#/components/schemas/confKey'
902 }
903 }
904 ],
905 'requestBody' => {
906 'content' => {
907 'application/json' => {
908 'schema' => {
909 '$ref' =>
910 '#/components/schemas/CasAppUpdate'
911 }
912 }
913 }
914 },
915 'responses' => {
916 '204' => {
917 '$ref' => '#/components/responses/NoContent'
918 },
919 '400' => {
920 '$ref' => '#/components/responses/Error'
921 },
922 '404' => {
923 '$ref' => '#/components/responses/NotFound'
924 },
925 '409' => {
926 '$ref' => '#/components/responses/Conflict'
927 }
928 }
929 },
930 'delete' => {
931 'tags' => ['casapp'],
932 'summary' => 'Deletes a CAS Application',
933 'operationId' => 'deleteCasApp',
934 'parameters' => [ {
935 'name' => 'confKey',
936 'in' => 'path',
937 'description' =>
938 'Configuration key of CAS Application to delete',
939 'required' => JSON::true,
940 'schema' => {
941 '$ref' => '#/components/schemas/confKey'
942 }
943 }
944 ],
945 'responses' => {
946 '204' => {
947 '$ref' => '#/components/responses/NoContent'
948 },
949 '400' => {
950 '$ref' => '#/components/responses/Error'
951 },
952 '404' => {
953 '$ref' => '#/components/responses/NotFound'
954 }
955 }
956 }
957 },
958  
959 '/api/v1/secondFactor/' => {
960 description => "Registered second factors",
961 get => {
962 summary => "Search for second factors",
963 parameters => [ {
964 name => "uid",
965 in => "query",
966 description =>
967 "The user id to filter on. Can contain wildcards.",
968 example => "dw*",
969 required => "false",
970 schema => {
971 type => "string",
972 },
973 },
974 {
975 name => "type",
976 in => "query",
977 description =>
978 "The second factor type to filter on. Can be specified multiple times.",
979 example => "TOTP",
980 required => "false",
981 schema => {
982 type => "string",
983 },
984 },
985 ],
986 tags => ['2fa'],
987 operationId => "searchSecondFactors",
988 responses => {
989 200 => {
990 '$ref' =>
991 '#/components/responses/SecondFactorSearch'
992 },
993 }
994 },
995 },
996 '/api/v1/secondFactor/{uid}' => {
997 'description' => 'Second factors for a particular user',
998 'parameters' => [ {
999 'name' => 'uid',
1000 'in' => 'path',
1001 'required' => JSON::true,
1002 'schema' => {
1003 'type' => 'string'
1004 }
1005 }
1006 ],
1007 'get' => {
1008 'summary' => 'List second factors for a user',
1009 'description' => '',
1010 'tags' => ['2fa'],
1011 'operationId' => 'getSecondFactors',
1012 'responses' => {
1013 '200' => {
1014 '$ref' => '#/components/responses/SecondFactors'
1015 },
1016 '404' => {
1017 '$ref' => '#/components/responses/NotFound'
1018 }
1019 }
1020 },
1021 'delete' => {
1022 'summary' => 'Delete all second factors for a user',
1023 'description' => '',
1024 'tags' => ['2fa'],
1025 'operationId' => 'deleteSecondFactors',
1026 'responses' => {
1027 '204' => {
1028 '$ref' => '#/components/responses/NoContent'
1029 },
1030 '404' => {
1031 '$ref' => '#/components/responses/NotFound'
1032 }
1033 }
1034 },
1035 'post' => {
1036 'summary' => 'Register a new second factor for a user',
1037 'description' => '',
1038 'tags' => ['2fa'],
1039 'operationId' => 'addSecondFactor',
1040 'parameters' => [ {
1041 'name' => 'create',
1042 'in' => 'query',
1043 'required' => JSON::false,
1044 'description' =>
1045 "Should the persistent session be created if it does not exist yet",
1046 'schema' => {
1047 'type' => 'bool',
1048 'default' => JSON::false
1049 }
1050 }
1051 ],
1052 'requestBody' => {
1053 'description' =>
1054 'Second factor to add, additional properties depend on the 2FA type',
1055 'content' => {
1056 'application/json' => {
1057 'schema' => {
1058 '$ref' =>
1059 '#/components/schemas/NewSecondFactor'
1060 }
1061 }
1062 },
1063 'required' => JSON::true
1064 },
1065 'responses' => {
1066 '201' => {
1067 '$ref' => '#/components/responses/Created'
1068 },
1069 '400' => {
1070 '$ref' => '#/components/responses/Error'
1071 },
1072 '404' => {
1073 '$ref' => '#/components/responses/NotFound'
1074 }
1075 }
1076 }
1077 },
1078 '/api/v1/secondFactor/{uid}/type/{type}' => {
1079 'description' =>
1080 'Second factors of a given type for a particular user',
1081 'parameters' => [ {
1082 'name' => 'uid',
1083 'in' => 'path',
1084 'required' => JSON::true,
1085 'schema' => {
1086 'type' => 'string'
1087 }
1088 },
1089 {
1090 'name' => 'type',
1091 'in' => 'path',
1092 'required' => JSON::true,
1093 'schema' => {
1094 'type' => 'string'
1095 }
1096 }
1097 ],
1098 'get' => {
1099 'summary' =>
1100 'List second factors for a user given its type',
1101 'description' => '',
1102 'tags' => ['2fa'],
1103 'operationId' => 'getSecondFactorsByType',
1104 'responses' => {
1105 '200' => {
1106 '$ref' => '#/components/responses/SecondFactors'
1107 },
1108 '404' => {
1109 '$ref' => '#/components/responses/NotFound'
1110 }
1111 }
1112 },
1113 'delete' => {
1114 'summary' =>
1115 'Delete all second factors of a given type for a user',
1116 'description' => '',
1117 'tags' => ['2fa'],
1118 'operationId' => 'deleteSecondFactorsByType',
1119 'responses' => {
1120 '204' => {
1121 '$ref' => '#/components/responses/NoContent'
1122 },
1123 '404' => {
1124 '$ref' => '#/components/responses/NotFound'
1125 }
1126 }
1127 }
1128 },
1129 '/api/v1/secondFactor/{uid}/type/TOTP' => {
1130 'description' => 'Specialized API for TOTP',
1131 'parameters' => [ {
1132 'name' => 'uid',
1133 'in' => 'path',
1134 'required' => JSON::true,
1135 'schema' => {
1136 'type' => 'string'
1137 }
1138 }
1139 ],
1140 'post' => {
1141 'summary' => 'Register a new TOTP device factor for a user',
1142 'description' =>
1143 'The secret must be passed as cleartext and will be encrypted by the server if needed',
1144 'tags' => ['2fa'],
1145 'operationId' => 'addSecondFactorTotp',
1146 'parameters' => [ {
1147 'name' => 'create',
1148 'in' => 'query',
1149 'required' => JSON::false,
1150 'description' =>
1151 "Should the persistent session be created if it does not exist yet",
1152 'schema' => {
1153 'type' => 'bool',
1154 'default' => JSON::false
1155 }
1156 }
1157 ],
1158 'requestBody' => {
1159 'description' => 'Second factor to add',
1160 'content' => {
1161 'application/json' => {
1162 'schema' => {
1163 '$ref' =>
1164 '#/components/schemas/NewSecondFactorTotp'
1165 }
1166 }
1167 },
1168 'required' => JSON::true
1169 },
1170 'responses' => {
1171 '201' => {
1172 '$ref' => '#/components/responses/Created'
1173 },
1174 '400' => {
1175 '$ref' => '#/components/responses/Error'
1176 },
1177 '404' => {
1178 '$ref' => '#/components/responses/NotFound'
1179 }
1180 }
1181 }
1182 },
1183 '/api/v1/secondFactor/{uid}/id/{id}' => {
1184 'description' =>
1185 'Second factors of a given id for a particular user',
1186 'parameters' => [ {
1187 'name' => 'uid',
1188 'in' => 'path',
1189 'required' => JSON::true,
1190 'schema' => {
1191 'type' => 'string'
1192 }
1193 },
1194 {
1195 'name' => 'id',
1196 'in' => 'path',
1197 'required' => JSON::true,
1198 'schema' => {
1199 'type' => 'string'
1200 }
1201 }
1202 ],
1203 'get' => {
1204 'summary' => 'Get second factors for a user given its ID',
1205 'description' => '',
1206 'tags' => ['2fa'],
1207 'operationId' => 'getSecondFactorsById',
1208 'responses' => {
1209 '200' => {
1210 '$ref' => '#/components/responses/SecondFactors'
1211 },
1212 '404' => {
1213 '$ref' => '#/components/responses/NotFound'
1214 }
1215 }
1216 },
1217 'delete' => {
1218 'summary' => 'Delete a second factors for a user',
1219 'description' => '',
1220 'tags' => ['2fa'],
1221 'operationId' => 'deleteSecondFactorsById',
1222 'responses' => {
1223 '204' => {
1224 '$ref' => '#/components/responses/NoContent'
1225 },
1226 '404' => {
1227 '$ref' => '#/components/responses/NotFound'
1228 }
1229 }
1230 }
1231 },
1232 '/api/v1/menu/cat' => {
1233 'post' => {
1234 'tags' => ['menucat'],
1235 'summary' => 'Create a new Menu Category',
1236 'operationId' => 'addMenuCat',
1237 'requestBody' => {
1238 'description' => 'Menu Category to add',
1239 'content' => {
1240 'application/json' => {
1241 'schema' => {
1242 '$ref' => '#/components/schemas/MenuCat'
1243 }
1244 }
1245 },
1246 'required' => JSON::true
1247 },
1248 'responses' => {
1249 '201' => {
1250 '$ref' => '#/components/responses/Created'
1251 },
1252 '400' => {
1253 '$ref' => '#/components/responses/Error'
1254 },
1255 '409' => {
1256 '$ref' => '#/components/responses/Conflict'
1257 }
1258 }
1259 }
1260 },
1261 '/api/v1/menu/cat/findByConfKey' => {
1262 'get' => {
1263 'tags' => ['menucat'],
1264 'summary' => 'Finds Menu Categories by configuration key',
1265 'description' =>
1266 'Takes a search pattern to be tested against existing categories',
1267 'operationId' => 'findMenuCatByConfKey',
1268 'parameters' => [ {
1269 'name' => 'pattern',
1270 'in' => 'query',
1271 'description' => 'Search pattern',
1272 'required' => JSON::true,
1273 'schema' => {
1274 'type' => 'string'
1275 },
1276 'examples' => {
1277 'any' => {
1278 'summary' => 'Any value',
1279 'value' => '*'
1280 },
1281 'prefix' => {
1282 'summary' => 'Given prefix',
1283 'value' => 'zone1-*'
1284 },
1285 'anywhere' => {
1286 'summary' => 'Substring',
1287 'value' => 'something'
1288 }
1289 }
1290 }
1291 ],
1292 'responses' => {
1293 '200' => {
1294 '$ref' => '#/components/responses/ManyMenuCat'
1295 },
1296 '400' => {
1297 '$ref' => '#/components/responses/Error'
1298 }
1299 }
1300 }
1301 },
1302 '/api/v1/menu/cat/{confKey}' => {
1303 'get' => {
1304 'tags' => ['menucat'],
1305 'summary' => 'Get Menu Category by configuration key',
1306 'description' => 'Returns a single Category',
1307 'operationId' => 'getMenuCatByConfKey',
1308 'parameters' => [ {
1309 'name' => 'confKey',
1310 'in' => 'path',
1311 'description' =>
1312 'Configuration key of Menu Category',
1313 'required' => JSON::true,
1314 'schema' => {
1315 '$ref' => '#/components/schemas/confKey'
1316 }
1317 }
1318 ],
1319 'responses' => {
1320 '200' => {
1321 '$ref' => '#/components/responses/OneMenuCat'
1322 },
1323 '400' => {
1324 '$ref' => '#/components/responses/Error'
1325 },
1326 '404' => {
1327 '$ref' => '#/components/responses/NotFound'
1328 }
1329 }
1330 },
1331 'put' => {
1332 'tags' => ['menucat'],
1333 'summary' => 'Replaces a Menu Category',
1334 'operationId' => 'replaceMenuCat',
1335 'parameters' => [ {
1336 'name' => 'confKey',
1337 'in' => 'path',
1338 'description' =>
1339 'Configuration key of Menu Category that needs to be replaced',
1340 'required' => JSON::true,
1341 'schema' => {
1342 '$ref' => '#/components/schemas/confKey'
1343 }
1344 }
1345 ],
1346 'requestBody' => {
1347 'content' => {
1348 'application/json' => {
1349 'schema' => {
1350 '$ref' => '#/components/schemas/MenuCat'
1351 }
1352 }
1353 }
1354 },
1355 'responses' => {
1356 '204' => {
1357 '$ref' => '#/components/responses/NoContent'
1358 },
1359 '400' => {
1360 '$ref' => '#/components/responses/Error'
1361 },
1362 '404' => {
1363 '$ref' => '#/components/responses/NotFound'
1364 },
1365 '409' => {
1366 '$ref' => '#/components/responses/Conflict'
1367 }
1368 }
1369 },
1370 'patch' => {
1371 'tags' => ['menucat'],
1372 'summary' => 'Updates a Menu Category',
1373 'operationId' => 'updateMenuCat',
1374 'parameters' => [ {
1375 'name' => 'confKey',
1376 'in' => 'path',
1377 'description' =>
1378 'Configuration key of Menu Category that needs to be updated',
1379 'required' => JSON::true,
1380 'schema' => {
1381 '$ref' => '#/components/schemas/confKey'
1382 }
1383 }
1384 ],
1385 'requestBody' => {
1386 'content' => {
1387 'application/json' => {
1388 'schema' => {
1389 '$ref' =>
1390 '#/components/schemas/MenuCatUpdate'
1391 }
1392 }
1393 }
1394 },
1395 'responses' => {
1396 '204' => {
1397 '$ref' => '#/components/responses/NoContent'
1398 },
1399 '400' => {
1400 '$ref' => '#/components/responses/Error'
1401 },
1402 '404' => {
1403 '$ref' => '#/components/responses/NotFound'
1404 },
1405 '409' => {
1406 '$ref' => '#/components/responses/Conflict'
1407 }
1408 }
1409 },
1410 'delete' => {
1411 'tags' => ['menucat'],
1412 'summary' => 'Deletes a Menu Category',
1413 'operationId' => 'deleteMenuCat',
1414 'parameters' => [ {
1415 'name' => 'confKey',
1416 'in' => 'path',
1417 'description' =>
1418 'Configuration key of Menu Category to delete',
1419 'required' => JSON::true,
1420 'schema' => {
1421 '$ref' => '#/components/schemas/confKey'
1422 }
1423 }
1424 ],
1425 'responses' => {
1426 '204' => {
1427 '$ref' => '#/components/responses/NoContent'
1428 },
1429 '400' => {
1430 '$ref' => '#/components/responses/Error'
1431 },
1432 '404' => {
1433 '$ref' => '#/components/responses/NotFound'
1434 }
1435 }
1436 }
1437 },
1438 '/api/v1/menu/app/{cat}' => {
1439 'get' => {
1440 'tags' => ['menuapp'],
1441 'summary' => 'Get Menu Applications within a Menu Category',
1442 'description' =>
1443 'Return existing applications within a menu category',
1444 'operationId' => 'getMenuApps',
1445 'parameters' => [ {
1446 'name' => 'cat',
1447 'in' => 'path',
1448 'description' =>
1449 'Configuration key of Menu Category to work with',
1450 'required' => JSON::true,
1451 'schema' => {
1452 '$ref' => '#/components/schemas/menuCatConfKey'
1453 }
1454 }
1455 ],
1456 'responses' => {
1457 '200' => {
1458 '$ref' => '#/components/responses/ManyMenuApp'
1459 },
1460 '400' => {
1461 '$ref' => '#/components/responses/Error'
1462 },
1463 '404' => {
1464 '$ref' => '#/components/responses/NotFound'
1465 }
1466 }
1467 },
1468 'post' => {
1469 'tags' => ['menuapp'],
1470 'summary' =>
1471 'Create a new Menu Application within a Menu Category',
1472 'operationId' => 'addMenuApp',
1473 'parameters' => [ {
1474 'name' => 'cat',
1475 'in' => 'path',
1476 'description' =>
1477 'Configuration key of Menu Category to work with',
1478 'required' => JSON::true,
1479 'schema' => {
1480 '$ref' => '#/components/schemas/menuCatConfKey'
1481 }
1482 }
1483 ],
1484 'requestBody' => {
1485 'description' => 'Menu Application to add',
1486 'content' => {
1487 'application/json' => {
1488 'schema' => {
1489 '$ref' => '#/components/schemas/MenuApp'
1490 }
1491 }
1492 },
1493 'required' => JSON::true
1494 },
1495 'responses' => {
1496 '201' => {
1497 '$ref' => '#/components/responses/Created'
1498 },
1499 '400' => {
1500 '$ref' => '#/components/responses/Error'
1501 },
1502 '404' => {
1503 '$ref' => '#/components/responses/NotFound'
1504 },
1505 '409' => {
1506 '$ref' => '#/components/responses/Conflict'
1507 }
1508 }
1509 }
1510 },
1511 '/api/v1/menu/app/{cat}/findByConfKey' => {
1512 'get' => {
1513 'tags' => ['menuapp'],
1514 'summary' =>
1515 'Finds Menu Applications by configuration key within a Menu Category',
1516 'description' =>
1517 'Takes a search pattern to be tested against existing applications within a menu category',
1518 'operationId' => 'findMenuAppByConfKey',
1519 'parameters' => [ {
1520 'name' => 'cat',
1521 'in' => 'path',
1522 'description' =>
1523 'Configuration key of Menu Category to work with',
1524 'required' => JSON::true,
1525 'schema' => {
1526 '$ref' => '#/components/schemas/menuCatConfKey'
1527 }
1528 },
1529 {
1530 'name' => 'pattern',
1531 'in' => 'query',
1532 'description' => 'Search pattern',
1533 'required' => JSON::true,
1534 'schema' => {
1535 'type' => 'string'
1536 },
1537 'examples' => {
1538 'any' => {
1539 'summary' => 'Any value',
1540 'value' => '*'
1541 },
1542 'prefix' => {
1543 'summary' => 'Given prefix',
1544 'value' => 'zone1-*'
1545 },
1546 'anywhere' => {
1547 'summary' => 'Substring',
1548 'value' => 'something'
1549 }
1550 }
1551 }
1552 ],
1553 'responses' => {
1554 '200' => {
1555 '$ref' => '#/components/responses/ManyMenuApp'
1556 },
1557 '400' => {
1558 '$ref' => '#/components/responses/Error'
1559 }
1560 }
1561 }
1562 },
1563 '/api/v1/menu/app/{cat}/{confKey}' => {
1564 'get' => {
1565 'tags' => ['menuapp'],
1566 'summary' =>
1567 'Get Menu Application within a Menu Category by configuration key',
1568 'description' => 'Returns a single application',
1569 'operationId' => 'getMenuAppByConfKey',
1570 'parameters' => [ {
1571 'name' => 'cat',
1572 'in' => 'path',
1573 'description' =>
1574 'Configuration key of Menu Category to work with',
1575 'required' => JSON::true,
1576 'schema' => {
1577 '$ref' => '#/components/schemas/menuCatConfKey'
1578 }
1579 },
1580 {
1581 'name' => 'confKey',
1582 'in' => 'path',
1583 'description' =>
1584 'Configuration key of Menu Application',
1585 'required' => JSON::true,
1586 'schema' => {
1587 '$ref' => '#/components/schemas/confKey'
1588 }
1589 }
1590 ],
1591 'responses' => {
1592 '200' => {
1593 '$ref' => '#/components/responses/OneMenuApp'
1594 },
1595 '400' => {
1596 '$ref' => '#/components/responses/Error'
1597 },
1598 '404' => {
1599 '$ref' => '#/components/responses/NotFound'
1600 }
1601 }
1602 },
1603 'put' => {
1604 'tags' => ['menuapp'],
1605 'summary' => 'Replaces a Menu Application',
1606 'operationId' => 'replaceMenuApp',
1607 'parameters' => [ {
1608 'name' => 'cat',
1609 'in' => 'path',
1610 'description' =>
1611 'Configuration key of Menu Category to work with',
1612 'required' => JSON::true,
1613 'schema' => {
1614 '$ref' => '#/components/schemas/menuCatConfKey'
1615 }
1616 },
1617 {
1618 'name' => 'confKey',
1619 'in' => 'path',
1620 'description' =>
1621 'Configuration key of Menu Application that needs to be replaced',
1622 'required' => JSON::true,
1623 'schema' => {
1624 '$ref' => '#/components/schemas/confKey'
1625 }
1626 }
1627 ],
1628 'requestBody' => {
1629 'content' => {
1630 'application/json' => {
1631 'schema' => {
1632 '$ref' => '#/components/schemas/MenuApp'
1633 }
1634 }
1635 }
1636 },
1637 'responses' => {
1638 '204' => {
1639 '$ref' => '#/components/responses/NoContent'
1640 },
1641 '400' => {
1642 '$ref' => '#/components/responses/Error'
1643 },
1644 '404' => {
1645 '$ref' => '#/components/responses/NotFound'
1646 },
1647 '409' => {
1648 '$ref' => '#/components/responses/Conflict'
1649 }
1650 }
1651 },
1652 'patch' => {
1653 'tags' => ['menuapp'],
1654 'summary' => 'Updates a Menu Application',
1655 'operationId' => 'updateMenuApp',
1656 'parameters' => [ {
1657 'name' => 'cat',
1658 'in' => 'path',
1659 'description' =>
1660 'Configuration key of Menu Category to work with',
1661 'required' => JSON::true,
1662 'schema' => {
1663 '$ref' => '#/components/schemas/menuCatConfKey'
1664 }
1665 },
1666 {
1667 'name' => 'confKey',
1668 'in' => 'path',
1669 'description' =>
1670 'Configuration key of Menu Application that needs to be updated',
1671 'required' => JSON::true,
1672 'schema' => {
1673 '$ref' => '#/components/schemas/confKey'
1674 }
1675 }
1676 ],
1677 'requestBody' => {
1678 'content' => {
1679 'application/json' => {
1680 'schema' => {
1681 '$ref' =>
1682 '#/components/schemas/MenuAppUpdate'
1683 }
1684 }
1685 }
1686 },
1687 'responses' => {
1688 '204' => {
1689 '$ref' => '#/components/responses/NoContent'
1690 },
1691 '400' => {
1692 '$ref' => '#/components/responses/Error'
1693 },
1694 '404' => {
1695 '$ref' => '#/components/responses/NotFound'
1696 },
1697 '409' => {
1698 '$ref' => '#/components/responses/Conflict'
1699 }
1700 }
1701 },
1702 'delete' => {
1703 'tags' => ['menuapp'],
1704 'summary' => 'Deletes a Menu Application',
1705 'operationId' => 'deleteMenuApp',
1706 'parameters' => [ {
1707 'name' => 'cat',
1708 'in' => 'path',
1709 'description' =>
1710 'Configuration key of Menu Category to work with',
1711 'required' => JSON::true,
1712 'schema' => {
1713 '$ref' => '#/components/schemas/menuCatConfKey'
1714 }
1715 },
1716 {
1717 'name' => 'confKey',
1718 'in' => 'path',
1719 'description' =>
1720 'Configuration key of Menu Application to delete',
1721 'required' => JSON::true,
1722 'schema' => {
1723 '$ref' => '#/components/schemas/confKey'
1724 }
1725 }
1726 ],
1727 'responses' => {
1728 '204' => {
1729 '$ref' => '#/components/responses/NoContent'
1730 },
1731 '400' => {
1732 '$ref' => '#/components/responses/Error'
1733 },
1734 '404' => {
1735 '$ref' => '#/components/responses/NotFound'
1736 }
1737 }
1738 }
1739 }
1740 },
1741 'components' => {
1742 'schemas' => {
1743 'Status' => {
1744 'type' => 'object',
1745 'properties' => {
1746 'name' => {
1747 'type' => 'string',
1748 'description' => 'Descriptive name of the software'
1749 },
1750 'version' => {
1751 'type' => 'string',
1752 'description' =>
1753 'Version of the LemonLDAP::NG software'
1754 },
1755 'status_sessions' => {
1756 'type' => 'string',
1757 'description' => 'Status of the sessions database',
1758 'enum' => [ 'ok', 'ko', 'unknown' ]
1759 },
1760 'status_psessions' => {
1761 'type' => 'string',
1762 'description' => 'Status of the psessions database',
1763 'enum' => [ 'ok', 'ko', 'unknown' ]
1764 },
1765 'status_config' => {
1766 'type' => 'string',
1767 'description' =>
1768 'Status of the configuration database',
1769 'enum' => [ 'ok', 'ko' ]
1770 },
1771 'status' => {
1772 'type' => 'string',
1773 'description' => 'Global status',
1774 'enum' => [ 'ok', 'ko' ]
1775 }
1776 }
1777 },
1778 'HistoryItem' => {
1779 'type' => 'object',
1780 'required' => [ 'date', 'result' ],
1781 'properties' => {
1782 'date' => {
1783 'type' => 'string',
1784 'description' => 'Unix timestamp of the event'
1785 },
1786 'ipAddr' => {
1787 'type' => 'string',
1788 'description' =>
1789 'String representation of the IP address'
1790 },
1791 'result' => {
1792 'type' => 'string',
1793 'description' => 'Result of authentication attempt',
1794 'enum' => [ 'success', 'failed' ]
1795 },
1796 'error' => {
1797 'type' => 'integer',
1798 'description' => 'LemonLDAP::NG error code'
1799 }
1800 }
1801 },
1802 'confKey' => {
1803 'type' => 'string',
1804 'pattern' => '^\\w[\\w\\.\\-]*$'
1805 },
1806 'Error' => {
1807 'type' => 'object',
1808 'properties' => {
1809 'error' => {
1810 'type' => 'string'
1811 }
1812 },
1813 'required' => ['error']
1814 },
1815 'SamlSp' => {
1816 'required' => [ 'confKey', 'metadata' ],
1817 'type' => 'object',
1818 'properties' => {
1819 'confKey' => {
1820 '$ref' => '#/components/schemas/confKey'
1821 },
1822 'metadata' => {
1823 'type' => 'string',
1824 'example' =>
1825 '<?xml version="1.0"?><EntityDescriptor...'
1826 },
1827 'exportedAttributes' => {
1828 'type' => 'object',
1829 'items' => {
1830 '$ref' => '#/components/schemas/samlAttribute'
1831 }
1832 },
1833 'macros' => {
1834 'type' => 'object',
1835 'example' => {
1836 'myMacroName' => '$macro(rule)'
1837 }
1838 },
1839 'options' => {
1840 '$ref' => '#/components/schemas/samlOptions'
1841 }
1842 }
1843 },
1844 'SamlSpUpdate' => {
1845 'type' => 'object',
1846 'properties' => {
1847 'metadata' => {
1848 'type' => 'string',
1849 'example' =>
1850 '<?xml version="1.0"?><EntityDescriptor...'
1851 },
1852 'macros' => {
1853 'type' => 'object',
1854 'example' => {
1855 'myMacroName' => '$macro(rule)'
1856 }
1857 },
1858 'exportedAttributes' => {
1859 'type' => 'object',
1860 'items' => {
1861 '$ref' => '#/components/schemas/samlAttribute'
1862 }
1863 },
1864 'options' => {
1865 '$ref' => '#/components/schemas/samlOptions'
1866 }
1867 }
1868 },
1869 'SamlSpReplace' => {
1870 'type' => 'object',
1871 'required' => ['metadata'],
1872 'properties' => {
1873 'metadata' => {
1874 'type' => 'string',
1875 'example' =>
1876 '<?xml version="1.0"?><EntityDescriptor...'
1877 },
1878 'macros' => {
1879 'type' => 'object',
1880 'example' => {
1881 'myMacroName' => '$macro(rule)'
1882 }
1883 },
1884 'exportedAttributes' => {
1885 'type' => 'object',
1886 'items' => {
1887 '$ref' => '#/components/schemas/samlAttribute'
1888 }
1889 },
1890 'options' => {
1891 '$ref' => '#/components/schemas/samlOptions'
1892 }
1893 }
1894 },
1895 'samlOptions' => {
1896 'type' => 'object',
1897 'properties' =>
1898 getOptions( $attributes, 'samlSPMetaDataOptions' ),
1899 },
1900 'samlAttribute' => {
1901 'type' => 'object',
1902 'properties' => {
1903 'name' => {
1904 'type' => 'string'
1905 },
1906 'mandatory' => {
1907 'type' => 'boolean'
1908 },
1909 'friendlyName' => {
1910 'type' => 'string'
1911 },
1912 'format' => {
1913 'type' => 'string',
1914 'example' =>
1915 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic'
1916 }
1917 }
1918 },
1919 'OidcRp' => {
1920 'required' => [ 'confKey', 'clientId', 'redirectUris' ],
1921 'type' => 'object',
1922 'properties' => {
1923 'confKey' => {
1924 '$ref' => '#/components/schemas/confKey'
1925 },
1926 'clientId' => {
1927 'type' => 'string'
1928 },
1929 'redirectUris' => {
1930 'type' => 'array',
1931 'items' => {
1932 'type' => 'string',
1933 'minItems' => '1',
1934 'format' => 'uri'
1935 }
1936 },
1937 'exportedVars' => {
1938 'type' => 'object',
1939 'example' => {
1940 'email' => 'mail',
1941 'family_name' => 'sn',
1942 'name' => 'cn'
1943 }
1944 },
1945 'extraClaims' => {
1946 'type' => 'object',
1947 'example' => {
1948 'myscope' => 'myattr1 myattr2 myattr3'
1949 }
1950 },
1951 'macros' => {
1952 'type' => 'object',
1953 'example' => {
1954 'myMacroName' => '$macro(rule)'
1955 }
1956 },
1957 'options' => {
1958 '$ref' => '#/components/schemas/OidcOptions'
1959 },
1960 'scopeRules' => {
1961 'type' => 'object',
1962 'example' => {
1963 'write' => 'requested and inGroup(\'writers\')'
1964 }
1965 }
1966 }
1967 },
1968 'OidcOptions' => {
1969 'type' => 'object',
1970 'properties' =>
1971 getOptions( $attributes, 'oidcRPMetaDataOptions' ),
1972 },
1973 'OidcRpUpdate' => {
1974 'type' => 'object',
1975 'properties' => {
1976 'clientId' => {
1977 'type' => 'string'
1978 },
1979 'exportedVars' => {
1980 'type' => 'object',
1981 'example' => {
1982 'email' => 'mail',
1983 'family_name' => 'sn',
1984 'name' => 'cn'
1985 }
1986 },
1987 'extraClaims' => {
1988 'type' => 'object',
1989 'example' => {
1990 'myscope' => 'myattr1 myattr2 myattr3'
1991 }
1992 },
1993 'macros' => {
1994 'type' => 'object',
1995 'example' => {
1996 'myMacroName' => '$macro(rule)'
1997 }
1998 },
1999 'options' => {
2000 '$ref' => '#/components/schemas/OidcOptions'
2001 },
2002 'scopeRules' => {
2003 'type' => 'object',
2004 'example' => {
2005 'write' => 'requested and inGroup(\'writers\')'
2006 }
2007 }
2008 }
2009 },
2010 'OidcRpReplace' => {
2011 'type' => 'object',
2012 'required' => [ 'clientId', 'redirectUris' ],
2013 'properties' => {
2014 'clientId' => {
2015 'type' => 'string'
2016 },
2017 'exportedVars' => {
2018 'type' => 'object',
2019 'example' => {
2020 'email' => 'mail',
2021 'family_name' => 'sn',
2022 'name' => 'cn'
2023 }
2024 },
2025 'extraClaims' => {
2026 'type' => 'object',
2027 'example' => {
2028 'myscope' => 'myattr1 myattr2 myattr3'
2029 }
2030 },
2031 'macros' => {
2032 'type' => 'object',
2033 'example' => {
2034 'myMacroName' => '$macro(rule)'
2035 }
2036 },
2037 'options' => {
2038 '$ref' => '#/components/schemas/OidcOptions'
2039 },
2040 'scopeRules' => {
2041 'type' => 'object',
2042 'example' => {
2043 'write' => 'requested and inGroup(\'writers\')'
2044 }
2045 }
2046 }
2047 },
2048 'CasApp' => {
2049 'required' => ['confKey'],
2050 'type' => 'object',
2051 'properties' => {
2052 'confKey' => {
2053 '$ref' => '#/components/schemas/confKey'
2054 },
2055 'exportedVars' => {
2056 'type' => 'object',
2057 'default' => {
2058 'cn' => 'cn',
2059 'mail' => 'mail',
2060 'uid' => 'uid'
2061 }
2062 },
2063 'macros' => {
2064 'type' => 'object',
2065 'example' => {
2066 'myMacroName' => '$macro(rule)'
2067 }
2068 },
2069 'options' => {
2070 '$ref' => '#/components/schemas/casOptions'
2071 }
2072 }
2073 },
2074 'CasAppUpdate' => {
2075 'type' => 'object',
2076 'properties' => {
2077 'macros' => {
2078 'type' => 'object',
2079 'example' => {
2080 'myMacroName' => '$macro(rule)'
2081 }
2082 },
2083 'exportedVars' => {
2084 'type' => 'object',
2085 'default' => {
2086 'cn' => 'cn',
2087 'mail' => 'mail',
2088 'uid' => 'uid'
2089 }
2090 },
2091 'options' => {
2092 '$ref' => '#/components/schemas/casOptions'
2093 }
2094 }
2095 },
2096 'CasAppReplace' => {
2097 'type' => 'object',
2098 'properties' => {
2099 'macros' => {
2100 'type' => 'object',
2101 'example' => {
2102 'myMacroName' => '$macro(rule)'
2103 }
2104 },
2105 'exportedVars' => {
2106 'type' => 'object',
2107 'default' => {
2108 'cn' => 'cn',
2109 'mail' => 'mail',
2110 'uid' => 'uid'
2111 }
2112 },
2113 'options' => {
2114 '$ref' => '#/components/schemas/casOptions'
2115 }
2116 }
2117 },
2118 'casOptions' => {
2119 'required' => ['service'],
2120 'type' => 'object',
2121 'properties' =>
2122 getOptions( $attributes, 'casAppMetaDataOptions' ),
2123 },
2124 'NewSecondFactor' => {
2125 'type' => 'object',
2126 'required' => ['type'],
2127 'properties' => {
2128 'type' => {
2129 'type' => 'string',
2130 'description' =>
2131 'The type of second factor to create',
2132 'example' => 'TOTP, UBK (Yubikey), WebAuthn'
2133 },
2134 'name' => {
2135 'type' => 'string',
2136 'description' => 'A description of the device'
2137 },
2138 },
2139 'additionalProperties' => {
2140 'type' => 'string'
2141 }
2142 },
2143 'NewSecondFactorTotp' => {
2144 'type' => 'object',
2145 'required' => ['key'],
2146 'properties' => {
2147 'key' => {
2148 'type' => 'string',
2149 'description' => 'The BASE32 encoded shared secret',
2150 },
2151 'name' => {
2152 'type' => 'string',
2153 'description' => 'A description of the device'
2154 }
2155 },
2156 },
2157 'SecondFactor' => {
2158 'type' => 'object',
2159 'required' => [ 'type', 'id' ],
2160 'properties' => {
2161 'id' => {
2162 'type' => 'string',
2163 'description' =>
2164 'An opaque idenfifier for this particular device'
2165 },
2166 'type' => {
2167 'type' => 'string',
2168 'description' => 'The type of device in use',
2169 'example' => 'TOTP, UBK (Yubikey), WebAuthn'
2170 },
2171 'name' => {
2172 'type' => 'string',
2173 'description' =>
2174 'A user-set description of the device'
2175 },
2176 },
2177 'additionalProperties' => {
2178 'type' => 'string'
2179 }
2180 },
2181 'SecondFactors' => {
2182 'type' => 'array',
2183 'items' => {
2184 '$ref' => '#/components/schemas/SecondFactor'
2185 }
2186 },
2187 'SecondFactorSearchResult' => {
2188 'type' => 'object',
2189 'required' => [ 'uid', 'secondFactors' ],
2190 'properties' => {
2191 'uid' => {
2192 'type' => 'string',
2193 'description' => 'The user identifier',
2194 },
2195 'secondFactors' => {
2196 description =>
2197 "The list of second factors matching the request's type",
2198 '$ref' => '#/components/schemas/SecondFactors'
2199 },
2200 }
2201 },
2202 'menuCatConfKey' => {
2203 'type' => 'string',
2204 'pattern' => '^\\w[\\w\\.\\-]*$'
2205 },
2206 'MenuCat' => {
2207 'required' => [ 'confKey', 'catname' ],
2208 'type' => 'object',
2209 'properties' => {
2210 'confKey' => {
2211 '$ref' => '#/components/schemas/confKey'
2212 },
2213 'catname' => {
2214 'type' => 'string'
2215 },
2216 'order' => {
2217 'type' => 'integer'
2218 }
2219 }
2220 },
2221 'MenuCatUpdate' => {
2222 'type' => 'object',
2223 'properties' => {
2224 'catname' => {
2225 'type' => 'string'
2226 },
2227 'order' => {
2228 'type' => 'integer'
2229 }
2230 }
2231 },
2232 'MenuApp' => {
2233 'required' => ['confKey'],
2234 'type' => 'object',
2235 'properties' => {
2236 'confKey' => {
2237 '$ref' => '#/components/schemas/confKey'
2238 },
2239 'order' => {
2240 'type' => 'integer'
2241 },
2242 'options' => {
2243 '$ref' => '#/components/schemas/MenuAppOptions'
2244 }
2245 }
2246 },
2247 'MenuAppOptions' => {
2248 'required' => ['name'],
2249 'type' => 'object',
2250 'properties' => {
2251 'name' => {
2252 'type' => 'string'
2253 },
2254 'tooltip' => {
2255 'type' => 'string'
2256 },
2257 'description' => {
2258 'type' => 'string'
2259 },
2260 'uri' => {
2261 'type' => 'string'
2262 },
2263 'logo' => {
2264 'type' => 'string',
2265 'default' => 'network.png',
2266 'enum' => [
2267 'attach.png',
2268 'bell.png',
2269 'bookmark.png',
2270 'configure.png',
2271 'database.png',
2272 'demo.png',
2273 'folder.png',
2274 'gear.png',
2275 'help.png',
2276 'llng.png',
2277 'mailappt.png',
2278 'money.png',
2279 'network.png',
2280 'terminal.png',
2281 'thumbnail.png',
2282 'tux.png',
2283 'web.png',
2284 '(Any reference to an available image in app logo folder)'
2285 ]
2286 },
2287 'display' => {
2288 'type' => 'string',
2289 'default' => 'auto',
2290 'enum' => [
2291 'on',
2292 'off',
2293 'auto',
2294 '(Any special rule to apply for example "$uid eq \'dwho\'")'
2295 ]
2296 }
2297 }
2298 },
2299 'MenuAppUpdate' => {
2300 'type' => 'object',
2301 'properties' => {
2302 'order' => {
2303 'type' => 'integer'
2304 },
2305 'options' => {
2306 '$ref' => '#/components/schemas/MenuAppOptions'
2307 }
2308 }
2309 }
2310 },
2311 'responses' => {
2312 'StatusResponse' => {
2313 'description' => 'Response to API health check',
2314 'content' => {
2315 'application/json' => {
2316 'schema' => {
2317 '$ref' => '#/components/schemas/Status'
2318 }
2319 }
2320 }
2321 },
2322 'HistoryList' => {
2323 'description' =>
2324 'List of history entries, sorted by date, from most recent to least recent',
2325 'content' => {
2326 'application/json' => {
2327 'schema' => {
2328 'type' => 'array',
2329 'items' => {
2330 '$ref' => '#/components/schemas/HistoryItem'
2331 }
2332 }
2333 }
2334 }
2335 },
2336 'HistoryItem' => {
2337 'description' => 'History entry',
2338 'content' => {
2339 'application/json' => {
2340 'schema' => {
2341 '$ref' => '#/components/schemas/HistoryItem'
2342 }
2343 }
2344 }
2345 },
2346 'NoContent' => {
2347 'description' => 'Successful modification'
2348 },
2349 'Created' => {
2350 'description' => 'Successful creation'
2351 },
2352 'OneOidcRp' => {
2353 'description' => 'Return an OpenID Connect Provider',
2354 'content' => {
2355 'application/json' => {
2356 'schema' => {
2357 '$ref' => '#/components/schemas/OidcRp'
2358 }
2359 }
2360 }
2361 },
2362 'OneSamlSp' => {
2363 'description' => 'Return a SAML Provider',
2364 'content' => {
2365 'application/json' => {
2366 'schema' => {
2367 '$ref' => '#/components/schemas/SamlSp'
2368 }
2369 }
2370 }
2371 },
2372 'OneCasApp' => {
2373 'description' => 'Return a CAS Provider',
2374 'content' => {
2375 'application/json' => {
2376 'schema' => {
2377 '$ref' => '#/components/schemas/CasApp'
2378 }
2379 }
2380 }
2381 },
2382 'ManyOidcRp' => {
2383 'description' =>
2384 'Return a list of OpenID Connect Providers',
2385 'content' => {
2386 'application/json' => {
2387 'schema' => {
2388 'type' => 'array',
2389 'items' => {
2390 '$ref' => '#/components/schemas/OidcRp'
2391 }
2392 }
2393 }
2394 }
2395 },
2396 'ManySamlSp' => {
2397 'description' => 'Return a list of SAML Providers',
2398 'content' => {
2399 'application/json' => {
2400 'schema' => {
2401 'type' => 'array',
2402 'items' => {
2403 '$ref' => '#/components/schemas/SamlSp'
2404 }
2405 }
2406 }
2407 }
2408 },
2409 'ManyCasApp' => {
2410 'description' => 'Return a list of CAS Providers',
2411 'content' => {
2412 'application/json' => {
2413 'schema' => {
2414 'type' => 'array',
2415 'items' => {
2416 '$ref' => '#/components/schemas/CasApp'
2417 }
2418 }
2419 }
2420 }
2421 },
2422 'NotFound' => {
2423 'description' => 'The specified resource was not found',
2424 'content' => {
2425 'application/json' => {
2426 'schema' => {
2427 '$ref' => '#/components/schemas/Error'
2428 }
2429 }
2430 }
2431 },
2432 'Conflict' => {
2433 'description' =>
2434 'The specified object could not be created because its configuration key, client_id or entityID already exists',
2435 'content' => {
2436 'application/json' => {
2437 'schema' => {
2438 '$ref' => '#/components/schemas/Error'
2439 }
2440 }
2441 }
2442 },
2443 'Error' => {
2444 'description' =>
2445 'An error was encountered when processing the request',
2446 'content' => {
2447 'application/json' => {
2448 'schema' => {
2449 '$ref' => '#/components/schemas/Error'
2450 }
2451 }
2452 }
2453 },
2454 'SecondFactor' => {
2455 'description' => 'Return a second factor',
2456 'content' => {
2457 'application/json' => {
2458 'schema' => {
2459 '$ref' => '#/components/schemas/SecondFactor'
2460 }
2461 }
2462 }
2463 },
2464 'SecondFactors' => {
2465 'description' => 'Return a list of second factors',
2466 'content' => {
2467 'application/json' => {
2468 'schema' => {
2469 '$ref' => '#/components/schemas/SecondFactors'
2470 }
2471 }
2472 }
2473 },
2474 'SecondFactorSearch' => {
2475 'description' => 'A list of search results',
2476 'content' => {
2477 'application/json' => {
2478 'schema' => {
2479 'type' => 'array',
2480 'items' => {
2481 '$ref' =>
2482 '#/components/schemas/SecondFactorSearchResult'
2483 }
2484 }
2485 }
2486 }
2487 },
2488 'OneMenuCat' => {
2489 'description' => 'Return a Menu Category',
2490 'content' => {
2491 'application/json' => {
2492 'schema' => {
2493 '$ref' => '#/components/schemas/MenuCat'
2494 }
2495 }
2496 }
2497 },
2498 'ManyMenuCat' => {
2499 'description' => 'Return a list of Menu Categories',
2500 'content' => {
2501 'application/json' => {
2502 'schema' => {
2503 'type' => 'array',
2504 'items' => {
2505 '$ref' => '#/components/schemas/MenuCat'
2506 }
2507 }
2508 }
2509 }
2510 },
2511 'OneMenuApp' => {
2512 'description' => 'Return a Menu Application',
2513 'content' => {
2514 'application/json' => {
2515 'schema' => {
2516 '$ref' => '#/components/schemas/MenuApp'
2517 }
2518 }
2519 }
2520 },
2521 'ManyMenuApp' => {
2522 'description' => 'Return a list of Menu Applications',
2523 'content' => {
2524 'application/json' => {
2525 'schema' => {
2526 'type' => 'array',
2527 'items' => {
2528 '$ref' => '#/components/schemas/MenuApp'
2529 }
2530 }
2531 }
2532 }
2533 }
2534 }
2535 }
2536 };
2537 }
2538 1;