authority_create_null(): creates an authority that successfully does
nothing, useful for concrete types that need to return an authority, but don't do any authentication.
Showing
2 changed files
with
19 additions
and
0 deletions
... | @@ -60,6 +60,8 @@ extern int authority_get_ticket __P ((authority_t, ticket_t *)); | ... | @@ -60,6 +60,8 @@ extern int authority_get_ticket __P ((authority_t, ticket_t *)); |
60 | extern int authority_authenticate __P ((authority_t)); | 60 | extern int authority_authenticate __P ((authority_t)); |
61 | extern int authority_set_authenticate __P ((authority_t, int (*_authenticate) __P ((authority_t)), void *)); | 61 | extern int authority_set_authenticate __P ((authority_t, int (*_authenticate) __P ((authority_t)), void *)); |
62 | 62 | ||
63 | extern int authority_create_null __P ((authority_t *pauthority, void *owner)); | ||
64 | |||
63 | struct _wicket; | 65 | struct _wicket; |
64 | typedef struct _wicket *wicket_t; | 66 | typedef struct _wicket *wicket_t; |
65 | 67 | ... | ... |
... | @@ -26,6 +26,23 @@ | ... | @@ -26,6 +26,23 @@ |
26 | #include <auth0.h> | 26 | #include <auth0.h> |
27 | 27 | ||
28 | 28 | ||
29 | static int | ||
30 | _authenticate_null (authority_t auth) | ||
31 | { | ||
32 | (void) auth; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | int | ||
37 | authority_create_null (authority_t *pauthority, void *owner) | ||
38 | { | ||
39 | int rc = authority_create(pauthority, NULL, owner); | ||
40 | if(rc) | ||
41 | return rc; | ||
42 | (*pauthority)->_authenticate = _authenticate_null; | ||
43 | return 0; | ||
44 | } | ||
45 | |||
29 | int | 46 | int |
30 | authority_create (authority_t *pauthority, ticket_t ticket, void *owner) | 47 | authority_create (authority_t *pauthority, ticket_t ticket, void *owner) |
31 | { | 48 | { | ... | ... |
-
Please register or sign in to post a comment