Commit de714f8a193fa145735650ffcb162a5ccaa3f92f

Authored by Georg Hopp
1 parent a8e31f89

use the new application container

... ... @@ -29,6 +29,7 @@
29 29
30 30 #include "session.h"
31 31 #include "hash.h"
  32 +#include "auth.h"
32 33 #include "auth/credential.h"
33 34 #include "storage/storage.h"
34 35 #include "session.h"
... ... @@ -45,8 +46,8 @@ CLASS(Application) {
45 46 Hash * active_sessions;
46 47 time_t session_time_ofs;
47 48
48   - void ** auth;
49   - size_t nauth;
  49 + Auth auth;
  50 +
50 51 struct randval * val;
51 52
52 53 Storage users;
... ...
... ... @@ -55,12 +55,7 @@ applicationCtor(void * _this, va_list * params)
55 55
56 56 this->user_namespace = uuidParse(va_arg(*params, char *));
57 57
58   - // initialize authenticators to use.
59   - this->nauth = va_arg(*params, size_t);
60   - this->auth = memMalloc(this->nauth * sizeof(void*));
61   - for (i=0; i<this->nauth; i++) {
62   - this->auth[i] = va_arg(*params, void *);
63   - }
  58 + this->auth = va_arg(*params, void *);
64 59
65 60 this->active_sessions = memCalloc(SESSION_LIVETIME, sizeof(Hash));
66 61 for (i=0; i<SESSION_LIVETIME; i++) {
... ...
... ... @@ -162,8 +162,7 @@ main()
162 162 {
163 163 Storage users;
164 164 Storage passwords;
165   - AuthLdap authLdap;
166   - AuthStorage authStorage;
  165 + Auth auth;
167 166 Application application;
168 167 Router router;
169 168 ApplicationAdapterHttp adapterHttp;
... ... @@ -193,14 +192,17 @@ main()
193 192 shm_unlink("/fooshm");
194 193 close(shm);
195 194
196   - authLdap = new(
197   - AuthLdap,
  195 + auth = new(Auth);
  196 + authCreate(
  197 + auth,
  198 + AUTH_LDAP,
198 199 (ldap_host->value).string,
199 200 CONFSTRA(ldap_base));
200 201
201 202 users = new(Storage, user_storage);
202 203 passwords = new(Storage, password_storage);
203   - authStorage = new(AuthStorage, passwords);
  204 +
  205 + authCreate(auth, AUTH_STORAGE, passwords);
204 206
205 207 application = new(
206 208 Application,
... ... @@ -208,9 +210,7 @@ main()
208 210 users,
209 211 passwords,
210 212 "14de9e60-d497-4754-be72-f3bed52541fc",
211   - 2,
212   - authLdap,
213   - authStorage);
  213 + auth);
214 214
215 215 router = new(Router, application);
216 216 adapterHttp = new(ApplicationAdapterHttp, application, router);
... ... @@ -272,10 +272,9 @@ main()
272 272 delete(adapterHttp);
273 273 delete(router);
274 274 delete(application);
275   - delete(authStorage);
276 275 delete(passwords);
277 276 delete(users);
278   - delete(authLdap);
  277 + delete(auth);
279 278
280 279 clearMimeTypes();
281 280 assetPoolCleanup();
... ...
Please register or login to post a comment