PageSourceSearch

https://davidjackson.info/static/components/config/factories/config.js?v=20250709T184513

js davidjackson.info collected 2026-10-02 19:50:52 UTC 44,906 bytes, 1,017 lines download raw bytes

1/**
2 * http://www.privacyidea.org
3 * (c) cornelius kölbel, [email protected]
4 *
5 * 2015-01-11 Cornelius Kölbel, <[email protected]>
6 *
7 * This code is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or any later version.
11 *
12 * This code is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public
18 * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21myApp.factory("PolicyTemplateFactory", ["$http", "inform", "gettextCatalog",
22    function ($http, inform, gettextCatalog) {
23        var URL = "https://raw.githubusercontent.com/privacyidea/policy-templates/master/templates/";
24        return {
25            setUrl: function (url) {
26                URL = url;
27            },
28            getTemplates: function (callback) {
29                //debug: console.log("Going to fetch Policy Templates");
30                $http.get(URL + "index.json")
31                    .then(function (response) {
32                        callback(response.data)
33                    }, function (error) {
34                        //debug: console.log("Error fetching Policy Templates.");
35                        //debug: console.log(error);
36                        inform.add(gettextCatalog.getString("Error fetching" +
37                                " policy templates."),
38                            {type: "danger", ttl: 10000});
39                    });
40            },
41            getTemplate: function (templateName, callback) {
42                //debug: console.log("Going to fetch Policy Template " + templateName);
43                $http.get(URL + templateName + ".json")
44                    .then(function (response) {
45                        callback(response.data)
46                    }, function (error) {
47                        //debug: console.log(error);
48                        inform.add(gettextCatalog.getString("Error fetching" +
49                                " policy template ")
50                            + templateName,
51                            {type: "danger", ttl: 10000});
52                    });
53            }
54        };
55    }]);
56
57myApp.factory("ConfigFactory", ["AuthFactory", "$http", "$state", "$rootScope",
58    "resolverUrl", "realmUrl", "machineResolverUrl",
59    "policyUrl", "eventUrl", "smtpServerUrl",
60    "radiusServerUrl", "smsgatewayUrl",
61    "defaultRealmUrl", "systemUrl", "periodicTaskUrl",
62    "privacyideaServerUrl", "CAConnectorUrl", "tokengroupUrl",
63    "serviceidUrl",
64    function (AuthFactory, $http, $state, $rootScope,
65              resolverUrl, realmUrl, machineResolverUrl,
66              policyUrl, eventUrl, smtpServerUrl,
67              radiusServerUrl, smsgatewayUrl,
68              defaultRealmUrl, systemUrl,
69              periodicTaskUrl, privacyideaServerUrl,
70              CAConnectorUrl, tokengroupUrl, serviceidUrl) {
71        /**
72         Each service - just like this service factory - is a singleton.
73         */
74        return {
75            getPGPKeys: function (callback) {
76                $http.get(systemUrl + "/gpgkeys", {
77                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
78                }).then(function (response) {
79                    callback(response.data)
80                }, function (error) {
81                    AuthFactory.authError(error.data)
82                });
83            },
84            getSMSProviders: function (callback) {
85                $http.get(smsgatewayUrl + "/providers", {
86                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
87                }).then(function (response) {
88                    callback(response.data)
89                }, function (error) {
90                    AuthFactory.authError(error.data)
91                });
92            },
93            getSMSGateways: function (gwid, callback) {
94                if (!gwid) {
95                    gwid = "";
96                }
97                $http.get(smsgatewayUrl + "/" + gwid, {
98                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
99                }).then(function (response) {
100                    callback(response.data)
101                }, function (error) {
102                    AuthFactory.authError(error.data)
103                });
104            },
105            setSMSGateway: function (params, callback) {
106                $http.post(smsgatewayUrl, params, {
107                    headers: {
108                        'PI-Authorization': AuthFactory.getAuthToken(),
109                        'Content-Type': 'application/json'
110                    }
111                }).then(function (response) {
112                    callback(response.data)
113                }, function (error) {
114                    AuthFactory.authError(error.data)
115                });
116            },
117            delSMSGateway: function (name, callback) {
118                $http.delete(smsgatewayUrl + "/" + name, {
119                        headers: {'PI-Authorization': AuthFactory.getAuthToken()}
120                    }
121                ).then(function (response) {
122                    callback(response.data)
123                }, function (error) {
124                    AuthFactory.authError(error.data)
125                });
126            },
127            delEvent: function (eventId, callback) {
128                $http.delete(eventUrl + "/" + eventId, {
129                        headers: {'PI-Authorization': AuthFactory.getAuthToken()}
130                    }
131                ).then(function (response) {
132                    callback(response.data)
133                }, function (error) {
134                    AuthFactory.authError(error.data)
135                });
136            },
137            enableEvent: function (eventId, callback) {
138                $http.post(eventUrl + "/enable/" + eventId, {},
139                    {
140                        headers: {'PI-Authorization': AuthFactory.getAuthToken()}
141                    }
142                ).then(function (response) {
143                    callback(response.data)
144                }, function (error) {
145                    AuthFactory.authError(error.data)
146                });
147            },
148            disableEvent: function (eventId, callback) {
149                $http.post(eventUrl + "/disable/" + eventId, {},
150                    {
151                        headers: {'PI-Authorization': AuthFactory.getAuthToken()}
152                    }
153                ).then(function (response) {
154                    callback(response.data)
155                }, function (error) {
156                    AuthFactory.authError(error.data)
157                });
158            },
159            setEvent: function (params, callback) {
160                $http.post(eventUrl, params, {
161                    headers: {
162                        'PI-Authorization': AuthFactory.getAuthToken(),
163                        'Content-Type': 'application/json'
164                    }
165                }).then(function (response) {
166                    callback(response.data)
167                }, function (error) {
168                    AuthFactory.authError(error.data)
169                });
170            },
171            getEvents: function (callback) {
172                $http.get(eventUrl + "/", {
173                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
174                }).then(function (response) {
175                    callback(response.data)
176                }, function (error) {
177                    AuthFactory.authError(error.data)
178                });
179            },
180            getEvent: function (eventid, callback) {
181                $http.get(eventUrl + "/" + eventid, {
182                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
183                }).then(function (response) {
184                    callback(response.data)
185                }, function (error) {
186                    AuthFactory.authError(error.data)
187                });
188            },
189            getHandlerActions: function (handlername, callback) {
190                $http.get(eventUrl + "/actions/" + handlername, {
191                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
192                }).then(function (response) {
193                    callback(response.data)
194                }, function (error) {
195                    AuthFactory.authError(error.data)
196                });
197            },
198            getHandlerConditions: function (handlername, callback) {
199                $http.get(eventUrl + "/conditions/" + handlername, {
200                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
201                }).then(function (response) {
202                    callback(response.data)
203                }, function (error) {
204                    AuthFactory.authError(error.data)
205                });
206            },
207            getHandlerPositions: function (handlername, callback) {
208                $http.get(eventUrl + "/positions/" + handlername, {
209                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
210                }).then(function (response) {
211                    callback(response.data)
212                }, function (error) {
213                    AuthFactory.authError(error.data)
214                });
215            },
216            delPeriodicTask: function (ptaskid, callback) {
217                $http.delete(periodicTaskUrl + "/" + ptaskid, {
218                        headers: {'PI-Authorization': AuthFactory.getAuthToken()}
219                    }
220                ).then(function (response) {
221                    callback(response.data)
222                }, function (error) {
223                    AuthFactory.authError(error.data)
224                });
225            },
226            getPeriodicTasks: function (callback) {
227                $http.get(periodicTaskUrl + "/", {
228                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
229                }).then(function (response) {
230                    callback(response.data)
231                }, function (error) {
232                    AuthFactory.authError(error.data)
233                });
234            },
235            getPeriodicTaskmodules: function (callback) {
236                $http.get(periodicTaskUrl + "/taskmodules/", {
237                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
238                }).then(function (response) {
239                    callback(response.data)
240                }, function (error) {
241                    AuthFactory.authError(error.data)
242                });
243            },
244            getPeriodicTaskmoduleOptions: function (taskmodule, callback) {
245                $http.get(periodicTaskUrl + "/options/" + taskmodule, {
246                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
247                }).then(function (response) {
248                    callback(response.data)
249                }, function (error) {
250                    AuthFactory.authError(error.data)
251                });
252            },
253            getPeriodicTask: function (ptaskid, callback) {
254                $http.get(periodicTaskUrl + "/" + ptaskid, {
255                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
256                }).then(function (response) {
257                    callback(response.data)
258                }, function (error) {
259                    AuthFactory.authError(error.data)
260                });
261            },
262            setPeriodicTask: function (params, callback) {
263                $http.post(periodicTaskUrl + "/", params, {
264                    headers: {
265                        'PI-Authorization': AuthFactory.getAuthToken(),
266                        'Content-Type': 'application/json'
267                    }
268                }).then(function (response) {
269                    callback(response.data)
270                }, function (error) {
271                    AuthFactory.authError(error.data)
272                });
273            },
274            enablePeriodicTask: function (ptaskid, callback) {
275                $http.post(periodicTaskUrl + "/enable/" + ptaskid, {},
276                    {headers: {'PI-Authorization': AuthFactory.getAuthToken()}}
277                ).then(function (response) {
278                    callback(response.data)
279                }, function (error) {
280                    AuthFactory.authError(error.data)
281                });
282            },
283            disablePeriodicTask: function (ptaskid, callback) {
284                $http.post(periodicTaskUrl + "/disable/" + ptaskid, {},
285                    {headers: {'PI-Authorization': AuthFactory.getAuthToken()}}
286                ).then(function (response) {
287                    callback(response.data)
288                }, function (error) {
289                    AuthFactory.authError(error.data)
290                });
291            },
292            getNodes: function (callback) {
293                $http.get(systemUrl + "/nodes", {
294                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
295                }).then(function (response) {
296                    callback(response.data)
297                }, function (error) {
298                    AuthFactory.authError(error.data)
299                });
300            },
301            delPolicy: function (policyName, callback) {
302                $http.delete(policyUrl + "/" + policyName, {
303                        headers: {'PI-Authorization': AuthFactory.getAuthToken()}
304                    }
305                ).then(function (response) {
306                    callback(response.data)
307                }, function (error) {
308                    AuthFactory.authError(error.data)
309                });
310            },
311            setPolicy: function (policyName, params, callback) {
312                $http.post(policyUrl + "/" + policyName, params, {
313                    headers: {
314                        'PI-Authorization': AuthFactory.getAuthToken(),
315                        'Content-Type': 'application/json'
316                    }
317                }).then(function (response) {
318                    callback(response.data)
319                }, function (error) {
320                    AuthFactory.authError(error.data)
321                });
322            },
323            getPolicies: function (callback) {
324                $http.get(policyUrl + "/", {
325                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
326                }).then(function (response) {
327                    callback(response.data)
328                }, function (error) {
329                    AuthFactory.authError(error.data)
330                });
331            },
332            getPolicy: function (policyname, callback) {
333                $http.get(policyUrl + "/" + policyname, {
334                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
335                }).then(function (response) {
336                    callback(response.data)
337                }, function (error) {
338                    AuthFactory.authError(error.data)
339                });
340            },
341            renamePolicy: function (old_name, new_name, callback) {
342                $http.patch(policyUrl + "/" + old_name, {name: new_name}, {
343                    headers: {
344                        'PI-Authorization': AuthFactory.getAuthToken(),
345                        'Content-Type': 'application/json'
346                    }
347                }).then(function (response) {
348                    callback(response.data)
349                }, function (error) {
350                    AuthFactory.authError(error.data)
351                });
352            },
353            enablePolicy: function (policyname, callback) {
354                $http.post(policyUrl + "/enable/" + policyname, {}, {
355                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
356                }).then(function (response) {
357                    callback(response.data)
358                }, function (error) {
359                    AuthFactory.authError(error.data)
360                });
361            },
362            disablePolicy: function (policyname, callback) {
363                $http.post(policyUrl + "/disable/" + policyname, {}, {
364                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
365                }).then(function (response) {
366                    callback(response.data)
367                }, function (error) {
368                    AuthFactory.authError(error.data)
369                });
370            },
371            getPolicyDefs: function (callback) {
372                // Return the policy definitions
373                $http.get(policyUrl + "/defs", {
374                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
375                }).then(function (response) {
376                    callback(response.data)
377                }, function (error) {
378                    AuthFactory.authError(error.data)
379                });
380            },
381            getPolicyConditionDefs: function (callback) {
382                // Return the definitions for policy conditions
383                $http.get(policyUrl + "/defs/conditions", {
384                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
385                }).then(function (response) {
386                    callback(response.data)
387                }, function (error) {
388                    AuthFactory.authError(error.data)
389                });
390            },
391            getPINodes: function (callback) {
392                // Return the definitions for policy conditions
393                $http.get(systemUrl + "/nodes", {
394                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
395                }).then(function (response) {
396                    callback(response.data)
397                }, function (error) {
398                    AuthFactory.authError(error.data)
399                });
400            },
401            getResolvers: function (callback) {
402                $http.get(resolverUrl + "/", {
403                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
404                }).then(function (response) {
405                    callback(response.data)
406                }, function (error) {
407                    AuthFactory.authError(error.data)
408                });
409            },
410            getEditableResolvers: function (callback) {
411                $http.get(resolverUrl + "/?editable=1", {
412                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
413                }).then(function (response) {
414                    callback(response.data)
415                }, function (error) {
416                    AuthFactory.authError(error.data)
417                });
418            },
419            getResolver: function (resolvername, callback) {
420                $http.get(resolverUrl + "/" + resolvername, {
421                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
422                }).then(function (response) {
423                    callback(response.data)
424                }, function (error) {
425                    AuthFactory.authError(error.data)
426                });
427            },
428            getDefaultResolverConfig: function (resolvertype, callback) {
429                $http.get(resolverUrl + "/" + resolvertype + "/default", {
430                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
431                }).then(function (response) {
432                    callback(response.data)
433                }, function (error) {
434                    AuthFactory.authError(error.data)
435                });
436            },
437            getMachineResolver: function (resolvername, callback) {
438                $http.get(machineResolverUrl + "/" + resolvername, {
439                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
440                }).then(function (response) {
441                    callback(response.data)
442                }, function (error) {
443                    AuthFactory.authError(error.data)
444                });
445            },
446            getMachineResolvers: function (callback) {
447                $http.get(machineResolverUrl + "/", {
448                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
449                }).then(function (response) {
450                    callback(response.data)
451                }, function (error) {
452                    AuthFactory.authError(error.data)
453                });
454            },
455            getCAConnectors: function (callback) {
456                $http.get(CAConnectorUrl + "/", {
457                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
458                }).then(function (response) {
459                    callback(response.data)
460                }, function (error) {
461                    AuthFactory.authError(error.data)
462                });
463            },
464            getCAConnectorNames: function (callback) {
465                $http.get(systemUrl + "/names/caconnector", {
466                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
467                }).then(function (response) {
468                    callback(response.data)
469                }, function (error) {
470                    AuthFactory.authError(error.data)
471                });
472            },
473            getCAConnector: function (connectorname, callback) {
474                $http.get(CAConnectorUrl + "/" + connectorname, {
475                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
476                }).then(function (response) {
477                    callback(response.data)
478                }, function (error) {
479                    AuthFactory.authError(error.data)
480                });
481            },
482            getRealms: function (callback) {
483                $http.get(realmUrl + "/", {
484                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
485                }).then(function (response) {
486                    callback(response.data)
487                }, function (error) {
488                    AuthFactory.authError(error.data)
489                });
490            },
491            getAdminRealms: function (callback) {
492                $http.get(realmUrl + "/superuser", {
493                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
494                }).then(function (response) {
495                    callback(response.data)
496                }, function (error) {
497                    AuthFactory.authError(error.data)
498                });
499            },
500            setResolver: function (name, params, callback) {
501                $http.post(resolverUrl + "/" + name, params,
502                    {
503                        headers: {
504                            'PI-Authorization': AuthFactory.getAuthToken(),
505                            'Content-Type': 'application/json'
506                        }
507                    }).then(function (response) {
508                    callback(response.data)
509                }, function (error) {
510                    AuthFactory.authError(error.data)
511                });
512            },
513            setMachineResolver: function (name, params, callback) {
514                $http.post(machineResolverUrl + "/" + name, params,
515                    {
516                        headers: {
517                            'PI-Authorization': AuthFactory.getAuthToken(),
518                            'Content-Type': 'application/json'
519                        }
520                    }).then(function (response) {
521                    callback(response.data)
522                }, function (error) {
523                    AuthFactory.authError(error.data)
524                });
525            },
526            setCAConnector: function (name, params, callback) {
527                $http.post(CAConnectorUrl + "/" + name, params,
528                    {
529                        headers: {
530                            'PI-Authorization': AuthFactory.getAuthToken(),
531                            'Content-Type': 'application/json'
532                        }
533                    }).then(function (response) {
534                    callback(response.data)
535                }, function (error) {
536                    AuthFactory.authError(error.data)
537                });
538            },
539            getCASpecificOptions: function (catype, params, callback) {
540                //encodeURI("/random?len=" + len + "&encode=" + encode)
541                var pstring = new URLSearchParams(params).toString()
542                $http.get(CAConnectorUrl + "/specific/" + catype + "?" + pstring,
543                    {
544                        headers: {'PI-Authorization': AuthFactory.getAuthToken()}
545                    }).then(function (response) {
546                    callback(response.data)
547                }, function (error) {
548                    AuthFactory.authError(error.data)
549                });
550            },
551            testResolver: function (params, callback) {
552                $http.post(resolverUrl + "/test", params,
553                    {
554                        headers: {
555                            'PI-Authorization': AuthFactory.getAuthToken(),
556                            'Content-Type': 'application/json'
557                        }
558                    }).then(function (response) {
559                    callback(response.data)
560                }, function (error) {
561                    AuthFactory.authError(error.data)
562                });
563            },
564            testMachineResolver: function (params, callback) {
565                $http.post(machineResolverUrl + "/test", params,
566                    {
567                        headers: {
568                            'PI-Authorization': AuthFactory.getAuthToken(),
569                            'Content-Type': 'application/json'
570                        }
571                    }).then(function (response) {
572                    callback(response.data)
573                }, function (error) {
574                    AuthFactory.authError(error.data)
575                });
576            },
577            delResolver: function (name, callback) {
578                $http.delete(resolverUrl + "/" + name, {
579                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
580                }).then(function (response) {
581                    callback(response.data)
582                }, function (error) {
583                    AuthFactory.authError(error.data)
584                });
585            },
586            delMachineResolver: function (name, callback) {
587                $http.delete(machineResolverUrl + "/" + name, {
588                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
589                }).then(function (response) {
590                    callback(response.data)
591                }, function (error) {
592                    AuthFactory.authError(error.data)
593                });
594            },
595            delCAConnector: function (name, callback) {
596                $http.delete(CAConnectorUrl + "/" + name, {
597                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
598                }).then(function (response) {
599                    callback(response.data)
600                }, function (error) {
601                    AuthFactory.authError(error.data)
602                });
603            },
604            setRealm: function (name, params, callback) {
605                $http.post(realmUrl + "/" + name, params, {
606                    headers: {
607                        'PI-Authorization': AuthFactory.getAuthToken(),
608                        'Content-Type': 'application/json'
609                    }
610                }).then(function (response) {
611                    callback(response.data)
612                }, function (error) {
613                    AuthFactory.authError(error.data)
614                });
615            },
616            setRealmNode: function (name, nodeid, params, callback) {
617                $http.post(realmUrl + "/" + name + "/node/" + nodeid, params, {
618                    headers: {
619                        'PI-Authorization': AuthFactory.getAuthToken(),
620                        'Content-Type': 'application/json'
621                    }
622                }).then(function (response) {
623                    callback(response.data)
624                }, function (error) {
625                    AuthFactory.authError(error.data)
626                });
627            },
628            delRealm: function (name, callback) {
629                $http.delete(realmUrl + "/" + name, {
630                    headers: {
631                        'PI-Authorization': AuthFactory.getAuthToken(),
632                        'Content-Type': 'application/json'
633                    }
634                }).then(function (response) {
635                    callback(response.data)
636                }, function (error) {
637                    AuthFactory.authError(error.data)
638                });
639            },
640            setDefaultRealm: function (name, callback) {
641                $http.post(defaultRealmUrl + "/" + name, {},
642                    {
643                        headers: {
644                            'PI-Authorization': AuthFactory.getAuthToken(),
645                            'Content-Type': 'application/json'
646                        }
647                    }).then(function (response) {
648                    callback(response.data)
649                }, function (error) {
650                    AuthFactory.authError(error.data)
651                })
652            },
653            clearDefaultRealm: function (callback) {
654                $http.delete(defaultRealmUrl, {
655                    headers: {
656                        'PI-Authorization': AuthFactory.getAuthToken(),
657                        'Content-Type': 'application/json'
658                    }
659                }).then(function (response) {
660                    callback(response.data)
661                }, function (error) {
662                    AuthFactory.authError(error.data)
663                });
664            },
665            getDocumentation: function (callback) {
666                $http.get(systemUrl + "/documentation", {
667                    headers: {
668                        'PI-Authorization': AuthFactory.getAuthToken(),
669                        'Content-Type': 'application/json'
670                    }
671                }).then(function (response) {
672                    callback(response.data)
673                }, function (error) {
674                    AuthFactory.authError(error.data)
675                });
676            },
677            saveSystemConfig: function (params, callback) {
678                $http.post(systemUrl + "/setConfig", params, {
679                    headers: {
680                        'PI-Authorization': AuthFactory.getAuthToken(),
681                        'Content-Type': 'application/json'
682                    }
683                }).then(function (response) {
684                    callback(response.data)
685                }, function (error) {
686                    AuthFactory.authError(error.data)
687                });
688            },
689            delSystemConfig: function (key, callback) {
690                $http.delete(systemUrl + "/" + key, {
691                    headers: {
692                        'PI-Authorization': AuthFactory.getAuthToken(),
693                        'Content-Type': 'application/json'
694                    }
695                }).then(function (response) {
696                    callback(response.data)
697                }, function (error) {
698                    AuthFactory.authError(error.data)
699                });
700            },
701            deleteUserCache: function (callback) {
702                $http.delete(systemUrl + "/user-cache", {
703                    headers: {
704                        'PI-Authorization': AuthFactory.getAuthToken(),
705                        'Content-Type': 'application/json'
706                    }
707                }).then(function (response) {
708                    callback(response.data)
709                }, function (error) {
710                    AuthFactory.authError(error.data)
711                });
712            },
713            getRandom: function (len, encode, callback) {
714                $http.get(systemUrl +
715                    encodeURI("/random?len=" + len + "&encode=" + encode), {
716                    headers: {
717                        'PI-Authorization': AuthFactory.getAuthToken(),
718                        'Content-Type': 'application/json'
719                    }
720                }).then(function (response) {
721                    callback(response.data)
722                }, function (error) {
723                    AuthFactory.authError(error.data)
724                });
725            },
726            testTokenConfig: function (tokentype, params, callback) {
727                $http.post(systemUrl + "/test/" + tokentype, params, {
728                    headers: {
729                        'PI-Authorization': AuthFactory.getAuthToken(),
730                        'Content-Type': 'application/json'
731                    }
732                }).then(function (response) {
733                    callback(response.data)
734                }, function (error) {
735                    AuthFactory.authError(error.data)
736                });
737            },
738            loadSystemConfig: function (callback, key) {
739                if (!key) {
740                    key = "";
741                }
742                $http.get(systemUrl + "/" + key, {
743                    headers: {
744                        'PI-Authorization': AuthFactory.getAuthToken(),
745                        'Content-Type': 'application/json'
746                    }
747                }).then(function (response) {
748                    callback(response.data)
749                }, function (error) {
750                    AuthFactory.authError(error.data)
751                });
752            },
753            getSystemConfig: function (callback) {
754                $http.get(systemUrl + "/", {
755                    headers: {
756                        'PI-Authorization': AuthFactory.getAuthToken(),
757                        'Content-Type': 'application/json'
758                    }
759                }).then(function (response) {
760                    callback(response.data)
761                }, function (error) {
762                    AuthFactory.authError(error.data)
763                });
764            },
765            getNodes: function (callback) {
766                $http.get(systemUrl + "/nodes", {
767                    headers: {'PI-Authorization': AuthFactory.getAuthToken()}
768                }).then(
769                    function (response) {
770                        callback(response.data)
771                    },
772                    function (error) {
773                        AuthFactory.authError(error.data)
774                    });
775            },
776            getSmtp: function (callback, identifier) {
777                if (!identifier) {
778                    identifier = "";
779                }
780                $http.get(smtpServerUrl + "/" + identifier, {
781                    headers: {
782                        'PI-Authorization': AuthFactory.getAuthToken(),
783                        'Content-Type': 'application/json'
784                    }
785                }).then(function (response) {
786                    callback(response.data)
787                }, function (error) {
788                    AuthFactory.authError(error.data)
789                });
790            },
791            delSmtp: function (identifier, callback) {
792                $http.delete(smtpServerUrl + "/" + identifier, {
793                    headers: {
794                        'PI-Authorization': AuthFactory.getAuthToken(),
795                        'Content-Type': 'application/json'
796                    }
797                }).then(function (response) {
798                    callback(response.data)
799                }, function (error) {
800                    AuthFactory.authError(error.data)
801                });
802            },
803            addSmtp: function (params, callback) {
804                var identifier = params["identifier"];
805                $http.post(smtpServerUrl + "/" + identifier, params, {
806                    headers: {
807                        'PI-Authorization': AuthFactory.getAuthToken(),
808                        'Content-Type': 'application/json'
809                    }
810                }).then(function (response) {
811                    callback(response.data)
812                }, function (error) {
813                    AuthFactory.authError(error.data)
814                });
815            },
816            testSmtp: function (params, callback) {
817                $http.post(smtpServerUrl + "/send_test_email", params, {
818                    headers: {
819                        'PI-Authorization': AuthFactory.getAuthToken(),
820                        'Content-Type': 'application/json'
821                    }
822                }).then(function (response) {
823                    callback(response.data)
824                }, function (error) {
825                    AuthFactory.authError(error.data)
826                });
827            },
828            getRadius: function (callback, identifier) {
829                if (!identifier) {
830                    identifier = "";
831                }
832                $http.get(radiusServerUrl + "/" + identifier, {
833                    headers: {
834                        'PI-Authorization': AuthFactory.getAuthToken(),
835                        'Content-Type': 'application/json'
836                    }
837                }).then(function (response) {
838                    callback(response.data)
839                }, function (error) {
840                    AuthFactory.authError(error.data)
841                });
842            },
843            getRadiusNames: function (callback) {
844                $http.get(systemUrl + "/names/radius", {
845                    headers: {
846                        'PI-Authorization': AuthFactory.getAuthToken(),
847                        'Content-Type': 'application/json'
848                    }
849                }).then(function (response) {
850                    callback(response.data)
851                }, function (error) {
852                    AuthFactory.authError(error.data)
853                });
854            },
855            delRadius: function (identifier, callback) {
856                $http.delete(radiusServerUrl + "/" + identifier, {
857                    headers: {
858                        'PI-Authorization': AuthFactory.getAuthToken(),
859                        'Content-Type': 'application/json'
860                    }
861                }).then(function (response) {
862                    callback(response.data)
863                }, function (error) {
864                    AuthFactory.authError(error.data)
865                });
866            },
867            addRadius: function (params, callback) {
868                var identifier = params["identifier"];
869                $http.post(radiusServerUrl + "/" + identifier, params, {
870                    headers: {
871                        'PI-Authorization': AuthFactory.getAuthToken(),
872                        'Content-Type': 'application/json'
873                    }
874                }).then(function (response) {
875                    callback(response.data)
876                }, function (error) {
877                    AuthFactory.authError(error.data)
878                });
879            },
880            testRadius: function (params, callback) {
881                $http.post(radiusServerUrl + "/test_request", params, {
882                    headers: {
883                        'PI-Authorization': AuthFactory.getAuthToken(),
884                        'Content-Type': 'application/json'
885                    }
886                }).then(function (response) {
887                    callback(response.data)
888                }, function (error) {
889                    AuthFactory.authError(error.data)
890                });
891            },
892            getTokengroup: function (groupname, callback) {
893                $http.get(tokengroupUrl + "/" + groupname, {
894                    headers: {
895                        'PI-Authorization': AuthFactory.getAuthToken(),
896                        'Content-Type': 'application/json'
897                    }
898                }).then(function (response) {
899                    callback(response.data)
900                }, function (error) {
901                    AuthFactory.authError(error.data)
902                });
903            },
904            addTokengroup: function (params, callback) {
905                $http.post(tokengroupUrl + "/" + params["groupname"], params, {
906                    headers: {
907                        'PI-Authorization': AuthFactory.getAuthToken(),
908                        'Content-Type': 'application/json'
909                    }
910                }).then(function (response) {
911                    callback(response.data)
912                }, function (error) {
913                    AuthFactory.authError(error.data)
914                });
915            },
916            delTokengroup: function (groupname, callback) {
917                $http.delete(tokengroupUrl + "/" + groupname, {
918                    headers: {
919                        'PI-Authorization': AuthFactory.getAuthToken(),
920                        'Content-Type': 'application/json'
921                    }
922                }).then(function (response) {
923                    callback(response.data)
924                }, function (error) {
925                    AuthFactory.authError(error.data)
926                });
927            },
928            getServiceid: function (sname, callback) {
929                $http.get(serviceidUrl + "/" + sname, {
930                    headers: {
931                        'PI-Authorization': AuthFactory.getAuthToken(),
932                        'Content-Type': 'application/json'
933                    }
934                }).then(function (response) {
935                    callback(response.data)
936                }, function (error) {
937                    AuthFactory.authError(error.data)
938                });
939            },
940            addServiceid: function (params, callback) {
941                $http.post(serviceidUrl + "/" + params["servicename"], params, {
942                    headers: {
943                        'PI-Authorization': AuthFactory.getAuthToken(),
944                        'Content-Type': 'application/json'
945                    }
946                }).then(function (response) {
947                    callback(response.data)
948                }, function (error) {
949                    AuthFactory.authError(error.data)
950                });
951            },
952            delServiceid: function (sname, callback) {
953                $http.delete(serviceidUrl + "/" + sname, {
954                    headers: {
955                        'PI-Authorization': AuthFactory.getAuthToken(),
956                        'Content-Type': 'application/json'
957                    }
958                }).then(function (response) {
959                    callback(response.data)
960                }, function (error) {
961                    AuthFactory.authError(error.data)
962                });
963            },
964            getPrivacyidea: function (callback, identifier) {
965                if (!identifier) {
966                    identifier = "";
967                }
968                $http.get(privacyideaServerUrl + "/" + identifier, {
969                    headers: {
970                        'PI-Authorization': AuthFactory.getAuthToken(),
971                        'Content-Type': 'application/json'
972                    }
973                }).then(function (response) {
974                    callback(response.data)
975                }, function (error) {
976                    AuthFactory.authError(error.data)
977                });
978            },
979            delPrivacyidea: function (identifier, callback) {
980                $http.delete(privacyideaServerUrl + "/" + identifier, {
981                    headers: {
982                        'PI-Authorization': AuthFactory.getAuthToken(),
983                        'Content-Type': 'application/json'
984                    }
985                }).then(function (response) {
986                    callback(response.data)
987                }, function (error) {
988                    AuthFactory.authError(error.data)
989                });
990            },
991            addPrivacyidea: function (params, callback) {
992                var identifier = params["identifier"];
993                $http.post(privacyideaServerUrl + "/" + identifier, params, {
994                    headers: {
995                        'PI-Authorization': AuthFactory.getAuthToken(),
996                        'Content-Type': 'application/json'
997                    }
998                }).then(function (response) {
999                    callback(response.data)
1000                }, function (error) {
1001                    AuthFactory.authError(error.data)
1002                });
1003            },
1004            testPrivacyidea: function (params, callback) {
1005                $http.post(privacyideaServerUrl + "/test_request", params, {
1006                    headers: {
1007                        'PI-Authorization': AuthFactory.getAuthToken(),
1008                        'Content-Type': 'application/json'
1009                    }
1010                }).then(function (response) {
1011                    callback(response.data)
1012                }, function (error) {
1013                    AuthFactory.authError(error.data)
1014                });
1015            }
1016        };
1017    }]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.