Commit de714f8a193fa145735650ffcb162a5ccaa3f92f

Authored by Georg Hopp
1 parent a8e31f89

use the new application container

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