Commit 8a8aa812 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Auth_cas: factorize URL computation

parent 312bd62a
...@@ -59,6 +59,9 @@ module Make (C : CONFIG) (N : NAME) (S : CONT_SERVICE) (T : TEMPLATES) : AUTH_IN ...@@ -59,6 +59,9 @@ module Make (C : CONFIG) (N : NAME) (S : CONT_SERVICE) (T : TEMPLATES) : AUTH_IN
let service = Eliom_service.preapply login_cas None let service = Eliom_service.preapply login_cas None
let self =
Eliom_uri.make_string_uri ~absolute:true ~service () |> rewrite_prefix
let on_success_ref = Eliom_reference.eref let on_success_ref = Eliom_reference.eref
~scope:Eliom_common.default_session_scope ~scope:Eliom_common.default_session_scope
(fun ~user_name ~user_logout -> Lwt.return ()) (fun ~user_name ~user_logout -> Lwt.return ())
...@@ -68,12 +71,8 @@ module Make (C : CONFIG) (N : NAME) (S : CONT_SERVICE) (T : TEMPLATES) : AUTH_IN ...@@ -68,12 +71,8 @@ module Make (C : CONFIG) (N : NAME) (S : CONT_SERVICE) (T : TEMPLATES) : AUTH_IN
(fun ticket () -> (fun ticket () ->
match ticket with match ticket with
| Some x -> | Some x ->
let me =
let uri = Eliom_uri.make_string_uri ~absolute:true ~service () in
rewrite_prefix uri
in
let validation = let validation =
let service = Eliom_service.preapply cas_validate (me, x) in let service = Eliom_service.preapply cas_validate (self, x) in
Eliom_uri.make_string_uri ~absolute:true ~service () Eliom_uri.make_string_uri ~absolute:true ~service ()
in in
lwt reply = Ocsigen_http_client.get_url validation in lwt reply = Ocsigen_http_client.get_url validation in
...@@ -111,10 +110,7 @@ module Make (C : CONFIG) (N : NAME) (S : CONT_SERVICE) (T : TEMPLATES) : AUTH_IN ...@@ -111,10 +110,7 @@ module Make (C : CONFIG) (N : NAME) (S : CONT_SERVICE) (T : TEMPLATES) : AUTH_IN
) )
| None -> fail_http 502 | None -> fail_http 502
) )
| None -> | None -> Lwt.return (Eliom_service.preapply cas_login self)
let uri = Eliom_uri.make_string_uri ~absolute:true ~service () in
let uri = rewrite_prefix uri in
Lwt.return (Eliom_service.preapply cas_login uri)
) )
let handler ~on_success () = let handler ~on_success () =
......
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