* Added Clixon Restconf library

* Builds and installs a new restconf library: libclixon_restconf.so and clixon_restconf.h
  * The restconf library can be included by a restconf plugin.
  * Example code in example/Makefile.in and example/restconf_lib.c
* Authorization
  * Example extended with authorization
  * Test added with http basic authorization (test/test_auth.sh)
  * Documentation in FAQ.md
* README.md extended with new yang, netconf, restconf, datastore, and auth sections.
This commit is contained in:
Olof hagsand 2018-03-25 15:47:27 +02:00
parent cce76faa79
commit bfce20c760
17 changed files with 773 additions and 157 deletions

View file

@ -303,4 +303,22 @@ fib_route(clicon_handle h, /* Clicon handle */
return 0;
}
```
Here, the callback is over-simplified.
Here, the callback is over-simplified.
## How do I write an authentication callback?
A restconf call may need to be authenticated.
You can specify an authentication callback for restconf as follows:
```
int
plugin_credentials(clicon_handle h,
FCGX_Request *r,
char **username)
```
If a plugin is provided, it needs to supply a username. If not, the
request is unauthorized. the function mallocs a username and returns
it.
See [../apps/example/routing_restconf.c] plugin_credentials() for
an example of HTTP basic auth.