summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 60121775ae4d37501127ba46e545ff5f609fc1ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
SUMMARY
-------

This contains a basic OAuth2 authorization and token server:
cynagoauth-server.

It currently only implments the client credential flow, checking
the client identity using the Smack label. A tiny launcher,
cynagoauth-launch, is provided to negociate the token and run
the final client, setting CYNAGOAUTH_TOKEN environment
variable and substitute the patterns for the token of the
arguments of the launched program.

LICENSE
-------

This is released under the terms of APLv2 as explained
in file LICENSE.txt


DEPENDENCIES
------------

It depends of:

- json-c
- libmicrohttpd
- openssl
- libcurl
- cynagora

COMPILING
---------

To compile and install it:

```sh
mkdir build
cd build
cmake ..
make
```

RFCs
----

OAuth 2.0 Authorization Framework: <https://tools.ietf.org/html/rfc6749>

OAuth 2.0 Authorization Server Metadata: <https://tools.ietf.org/html/rfc8414>

OAuth 2.0 Dynamic Client Registration Protocol: <https://tools.ietf.org/html/rfc7591>

OpenID Connect Discovery 1.0: <https://openid.net/specs/openid-connect-discovery-1_0.html>

cynagoauth-server
-----------------

```text
> cynagoauth-server -h

usage: cynagoauth-server [options...] [interfaces...]

Run a basic OAuth server, currently only implementing client credential
flow based on Smack labels and Cynagora backend.

The interfaces specify ip adresses and port to listen. It must be of
the form [HOST][:SERVICE]. Default host: *, default port: 7777.
Examples:

  localhost:5555        listen on loopback on port 5555
  *:1234                listen any interface on port 1234
  localhost             listen on default port of localhost

Default interface if none is given: *:7777

Options:

 -h, --help        this help
 -s, --secure      serves https
 -u, --unsecure    serves http
```

cynagoauth-launcher
-------------------

```text
usage: cynagoauth-launch [options...] program [args...]

Ask an OAuth2 server for an access token and launches the given program
with this retrieved token. The URL of the token end point to be queried
can be set by option (see below) or environment variable CYNAGOAUTH_URL.
The default value is http://localhost:7777/tok

When launched the program has the following environment variables defined:

  - the access token   CYNAGOAUTH_TOKEN

The arguments of the program to launch are scanned and patterns for the token
are substituted by the effective value of the token. The default pattern is @t

Options:

 -h, --help             this help
 -n, --name NAME        name of the environement variable to set
 -r, --replace PATTERN  redefine the pattern to be replaced
 -t, --token TOKEN      the token to use, token end point is not queried
 -u, --url URL          URL of the token end point
```