Commit 52941c39 52941c39826b6fba2792d5ebc085b83d4e68d06c by Sam Roberts

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.
1 parent 430c396c
...@@ -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 {
......