Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
myproxy_authorization.h
1 #ifndef __MYPROXY_AUTHORIZATION_H
2 #define __MYPROXY_AUTHORIZATION_H
3 
4 #include "myproxy_creds.h"
5 #include "myproxy_server.h"
6 
7 typedef enum {
8  AUTHORIZETYPE_NULL = 0,
9  AUTHORIZETYPE_PASSWD,
10  AUTHORIZETYPE_CERT,
11  AUTHORIZETYPE_SASL,
12  AUTHORIZETYPE_NUMMETHODS
13 } author_method_t;
14 
15 typedef enum {
16  AUTHORIZEMETHOD_DISABLED,
17  AUTHORIZEMETHOD_REQUIRED,
18  AUTHORIZEMETHOD_SUFFICIENT
19 } author_status_t;
20 
21 /* client/server authorization data */
22 typedef struct
23 {
24  char *server_data; /* data sent from the server. It can be arbitrary ASCII
25  string ending with '\0'. */
26  char *client_data; /* data created by the client according to server_data */
27  size_t client_data_len;
28  author_method_t method;
29 } authorization_data_t;
30 
31 /* The methods argument should be an array of methods to prompt for,
32  terminated by AUTHORIZETPYE_NULL. */
33 int authorization_init_server (authorization_data_t ***data,
34  author_method_t methods[]);
35 void authorization_data_free (authorization_data_t **data);
36 void authorization_data_free_contents (authorization_data_t *data);
37 
38 char * authorization_get_name(author_method_t method);
39 author_method_t authorization_get_method(char *name);
40 author_status_t authorization_get_status(author_method_t method,
41  struct myproxy_creds *creds,
42  char *client_name,
43  myproxy_server_context_t* config);
44 
45 /*
46  * Fill in author_data with client's response and return pointer into
47  * author_data to data choosen by the client. No new space is allocated for
48  * the returned pointer. This function is called by the server.
49  * authorization_data_t is supposed to be allocated and (partly) filled in by
50  * the server.
51  */
52 authorization_data_t *
53 authorization_store_response(char *,
54  size_t,
55  author_method_t,
56  authorization_data_t **);
57 
58 /*
59  * Search a data for the supplied method in the supplied list. Using the extra
60  * data fill in the response and return a pointer into the list to the data
61  * choosen. No special space is allocated for the return value.
62  * Called by the client.
63  */
64 authorization_data_t *
65 authorization_create_response(authorization_data_t **,
66  author_method_t,
67  void *extra_data,
68  size_t extra_data_len);
69 /*
70  * Verifies that data sent by the client matches the expecting value for the
71  * server's challenge. Returns 1 on success, 0 on failure.
72  */
73 int authorization_check(authorization_data_t *client_auth_data,
74  struct myproxy_creds *creds,
75  char *client_name);
76 
77 int authorization_check_ex(authorization_data_t *client_auth_data,
78  struct myproxy_creds *creds,
79  char *client_name,
80  myproxy_server_context_t *config);
81 
82 #endif /* __MYPROXY_AUTHORIZATION_H */