File: oauth.h

package info (click to toggle)
rtpengine 13.5.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,676 kB
  • sloc: ansic: 86,764; perl: 59,422; python: 3,193; sh: 1,030; makefile: 693; asm: 211
file content (35 lines) | stat: -rw-r--r-- 708 bytes parent folder | download
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
#ifndef _OAUTH_H_
#define _OAUTH_H_

#include <jwt.h>
#include <stdbool.h>
#include <curl/curl.h>
#include "auxlib.h"


typedef struct {
	const char *service_account_file;
	const char *scope; // https://www.googleapis.com/auth/cloud-platform
	const char *algorithm; // RS256

	// fields below here get filled in and are private,
	// but must be initialised to zero

	jwt_alg_t _alg;
	char *_iss; // client_email
	char *_aud; // token_uri
	char *_private_key; // PEM

	mutex_t _lock;
	char *_token;
	time_t _expires;
} oauth_context_t;


char *oauth_init(oauth_context_t *);
void oauth_cleanup(oauth_context_t *);

void oauth_add_auth(struct curl_slist **headers, oauth_context_t *ctx, char **errp);


#endif