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 302a3c9a authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Many renamings in auth-related interfaces

parent 4b24fdb5
...@@ -33,7 +33,7 @@ module type CONFIG = sig ...@@ -33,7 +33,7 @@ module type CONFIG = sig
val server : string val server : string
end end
module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) : AUTH_INSTANCE_HANDLERS = struct
let scope = Eliom_common.default_session_scope let scope = Eliom_common.default_session_scope
...@@ -142,7 +142,7 @@ let parse_config ~attributes = ...@@ -142,7 +142,7 @@ let parse_config ~attributes =
let make {server} = let make {server} =
let module C = struct let server = server end in let module C = struct let server = server end in
(module Make (C) : AUTH_SERVICE) (module Make (C) : AUTH_MAKE_INSTANCE)
type c = config type c = config
......
...@@ -32,7 +32,7 @@ let parse_config ~attributes = ...@@ -32,7 +32,7 @@ let parse_config ~attributes =
| [] -> Some () | [] -> Some ()
| _ -> None | _ -> None
module Make (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct module Make (N : NAME) (S : AUTH_SERVICES) : AUTH_INSTANCE_HANDLERS = struct
module L = Web_auth.MakeLinks (N) module L = Web_auth.MakeLinks (N)
...@@ -73,7 +73,7 @@ module Make (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct ...@@ -73,7 +73,7 @@ module Make (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct
end end
let make () = (module Make : AUTH_SERVICE) let make () = (module Make : AUTH_MAKE_INSTANCE)
module A : AUTH_SYSTEM = struct module A : AUTH_SYSTEM = struct
type config = unit type config = unit
......
...@@ -49,7 +49,7 @@ let load_db name file = ...@@ -49,7 +49,7 @@ let load_db name file =
let ( / ) = Filename.concat let ( / ) = Filename.concat
module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) : AUTH_HANDLERS = struct module Make (C : CONFIG) (N : NAME) (S : AUTH_SERVICES) : AUTH_INSTANCE_HANDLERS = struct
module L = Web_auth.MakeLinks (N) module L = Web_auth.MakeLinks (N)
...@@ -147,7 +147,7 @@ end ...@@ -147,7 +147,7 @@ end
let make {db} = let make {db} =
let module C = struct let db = db end in let module C = struct let db = db end in
(module Make (C) : AUTH_SERVICE) (module Make (C) : AUTH_MAKE_INSTANCE)
type c = config type c = config
......
...@@ -41,7 +41,7 @@ let register_auth_system auth_system = ...@@ -41,7 +41,7 @@ let register_auth_system auth_system =
type logged_user = { type logged_user = {
user_user : user; user_user : user;
user_handlers : (module AUTH_HANDLERS); user_handlers : (module AUTH_INSTANCE_HANDLERS);
} }
module MakeLinks (N : NAME) = struct module MakeLinks (N : NAME) = struct
...@@ -85,7 +85,7 @@ module Make (N : NAME) = struct ...@@ -85,7 +85,7 @@ module Make (N : NAME) = struct
Eliom_reference.set user (Some logged_user) >> Eliom_reference.set user (Some logged_user) >>
cont () () cont () ()
in in
let module A = (val user_handlers : AUTH_HANDLERS) in let module A = (val user_handlers : AUTH_INSTANCE_HANDLERS) in
A.login cont () A.login cont ()
with Not_found -> fail_http 404 with Not_found -> fail_http 404
...@@ -135,16 +135,16 @@ module Make (N : NAME) = struct ...@@ -135,16 +135,16 @@ module Make (N : NAME) = struct
let path = N.path @ ["auth"; instance] let path = N.path @ ["auth"; instance]
let kind = N.kind let kind = N.kind
end in end in
let module A = (val auth : AUTH_SERVICE) (N) (Services) in let module A = (val auth : AUTH_MAKE_INSTANCE) (N) (Services) in
let i = (module A : AUTH_HANDLERS) in let i = (module A : AUTH_INSTANCE_HANDLERS) in
Hashtbl.add auth_instances instance i; Hashtbl.add auth_instances instance i;
auth_instance_names := instance :: !auth_instance_names auth_instance_names := instance :: !auth_instance_names
) )
) xs ) xs
module Handlers : AUTH_HANDLERS_PUBLIC = struct module Handlers : AUTH_HANDLERS = struct
let do_login service cont () = let login service cont () =
let cont () () = let cont () () =
match service with match service with
| Some name -> do_login_using name cont | Some name -> do_login_using name cont
...@@ -161,7 +161,7 @@ module Make (N : NAME) = struct ...@@ -161,7 +161,7 @@ module Make (N : NAME) = struct
A.logout cont () A.logout cont ()
| None -> cont () () | None -> cont () ()
let do_logout cont () = let logout cont () =
match_lwt Eliom_reference.get user with match_lwt Eliom_reference.get user with
| Some u -> | Some u ->
security_log (fun () -> security_log (fun () ->
......
...@@ -31,5 +31,5 @@ module MakeLinks (N : NAME) : AUTH_LINKS ...@@ -31,5 +31,5 @@ module MakeLinks (N : NAME) : AUTH_LINKS
module Make (C : NAME) : sig module Make (C : NAME) : sig
val configure : auth_config list -> unit val configure : auth_config list -> unit
module Services : AUTH_SERVICES module Services : AUTH_SERVICES
module Handlers : AUTH_HANDLERS_PUBLIC module Handlers : AUTH_HANDLERS
end end
...@@ -282,11 +282,11 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct ...@@ -282,11 +282,11 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
let login service () = let login service () =
lwt cont = Eliom_reference.get Web_services.cont in lwt cont = Eliom_reference.get Web_services.cont in
Auth.Handlers.do_login service cont () Auth.Handlers.login service cont ()
let logout () () = let logout () () =
lwt cont = Eliom_reference.get Web_services.cont in lwt cont = Eliom_reference.get Web_services.cont in
Auth.Handlers.do_logout cont () Auth.Handlers.logout cont ()
module T = Web_templates module T = Web_templates
......
...@@ -91,14 +91,14 @@ type service_handler = unit -> ...@@ -91,14 +91,14 @@ type service_handler = unit ->
type 'a service_cont = ('a -> service_handler) -> service_handler type 'a service_cont = ('a -> service_handler) -> service_handler
module type AUTH_HANDLERS = sig module type AUTH_INSTANCE_HANDLERS = sig
val login : string service_cont val login : string service_cont
val logout : unit service_cont val logout : unit service_cont
end end
module type AUTH_HANDLERS_PUBLIC = sig module type AUTH_HANDLERS = sig
val do_login : string option -> unit service_cont val login : string option -> unit service_cont
val do_logout : unit service_cont val logout : unit service_cont
end end
module type WEB_BALLOT_BOX = sig module type WEB_BALLOT_BOX = sig
...@@ -153,10 +153,10 @@ module type NAME = sig ...@@ -153,10 +153,10 @@ module type NAME = sig
val kind : [ `Site | `Election of Uuidm.t * string ] val kind : [ `Site | `Election of Uuidm.t * string ]
end end
module type AUTH_SERVICE = module type AUTH_MAKE_INSTANCE =
functor (N : NAME) -> functor (N : NAME) ->
functor (S : AUTH_SERVICES) -> functor (S : AUTH_SERVICES) ->
AUTH_HANDLERS AUTH_INSTANCE_HANDLERS
module type AUTH_SYSTEM = sig module type AUTH_SYSTEM = sig
type config type config
...@@ -167,5 +167,5 @@ module type AUTH_SYSTEM = sig ...@@ -167,5 +167,5 @@ module type AUTH_SYSTEM = sig
attributes:(string * string) list -> attributes:(string * string) list ->
config option config option
val make : config -> (module AUTH_SERVICE) val make : config -> (module AUTH_MAKE_INSTANCE)
end end
...@@ -34,11 +34,11 @@ open Web_services ...@@ -34,11 +34,11 @@ open Web_services
let login service () = let login service () =
lwt cont = Eliom_reference.get Web_services.cont in lwt cont = Eliom_reference.get Web_services.cont in
A.Handlers.do_login service cont () A.Handlers.login service cont ()
let logout () () = let logout () () =
lwt cont = Eliom_reference.get Web_services.cont in lwt cont = Eliom_reference.get Web_services.cont in
A.Handlers.do_logout cont () A.Handlers.logout cont ()
let () = Any.register ~service:site_login login let () = Any.register ~service:site_login login
let () = Any.register ~service:site_logout logout let () = Any.register ~service:site_logout logout
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