Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit f78a6ef7 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Drop AUTH_LINKS argument of AUTH_SERVICE functor

parent 50b6eb6b
......@@ -33,7 +33,7 @@ module type CONFIG = sig
val server : string
end
module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) (L : AUTH_LINKS) : AUTH_HANDLERS = struct
module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct
let scope = Eliom_common.default_session_scope
......
......@@ -32,7 +32,9 @@ let parse_config ~attributes =
| [] -> Some ()
| _ -> None
module Make (N : NAME) (S : AUTH_SERVICES) (L : AUTH_LINKS) : AUTH_HANDLERS = struct
module Make (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct
module L = Web_auth.MakeLinks (N)
let scope = Eliom_common.default_session_scope
......
......@@ -49,7 +49,9 @@ let load_db name file =
let ( / ) = Filename.concat
module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) (L : AUTH_LINKS) : AUTH_HANDLERS = struct
module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct
module L = Web_auth.MakeLinks (N)
let scope = Eliom_common.default_session_scope
......@@ -61,7 +63,7 @@ module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) (L : AUTH_LINKS) : AUTH_
let db =
ref @@ match N.kind with
| `Site -> `Production (load_db N.name C.db)
| `Election dir ->
| `Election (_, dir) ->
(* hash the user-input name to avoid all kinds of injection *)
let fname = dir / sha256_hex C.db in
try
......
......@@ -44,6 +44,22 @@ type logged_user = {
user_handlers : (module AUTH_HANDLERS);
}
module MakeLinks (N : NAME) = struct
let login, logout =
match N.kind with
| `Site ->
(fun x -> Eliom_service.preapply Web_services.site_login x),
(Eliom_service.preapply Web_services.site_logout ())
| `Election (uuid, _) ->
(fun x ->
Eliom_service.preapply
Web_services.election_login
((uuid, ()), x)),
(Eliom_service.preapply
Web_services.election_logout
(uuid, ()))
end
module Make (N : NAME) = struct
let scope = Eliom_common.default_session_scope
......@@ -87,8 +103,7 @@ module Make (N : NAME) = struct
let kind = N.kind
end in
let module S = (val auth_services : AUTH_SERVICES) in
let module L = (val links : AUTH_LINKS) in
let module A = (val auth : AUTH_SERVICE) (N) (S) (L) in
let module A = (val auth : AUTH_SERVICE) (N) (S) in
let i = (module A : AUTH_HANDLERS) in
Hashtbl.add auth_instances instance i;
auth_instance_names := instance :: !auth_instance_names
......
......@@ -26,6 +26,8 @@ open Web_signatures
val register_auth_system : (module AUTH_SYSTEM) -> unit
module MakeLinks (N : NAME) : AUTH_LINKS
module Make (C : NAME) : sig
val register : (module AUTH_SERVICES) -> (module AUTH_LINKS) -> auth_config list -> unit
module Services : AUTH_SERVICES
......
......@@ -79,7 +79,7 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
module N = struct
let name = uuid
let path = base_path
let kind = `Election P.dir
let kind = `Election (D.election.e_params.e_uuid, P.dir)
let auth_config =
match P.metadata.e_auth_config with
......
......@@ -150,13 +150,12 @@ end
module type NAME = sig
val name : string
val path : string list
val kind : [ `Site | `Election of string ]
val kind : [ `Site | `Election of Uuidm.t * string ]
end
module type AUTH_SERVICE =
functor (N : NAME) ->
functor (S : AUTH_SERVICES) ->
functor (L : AUTH_LINKS) ->
AUTH_HANDLERS
module type AUTH_SYSTEM = sig
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment