comparison src/ur/openid.ur @ 5:443f27cd1572

Detecting cancellation
author Adam Chlipala <adam@chlipala.net>
date Sun, 26 Dec 2010 17:36:07 -0500
parents 2d409aff8800
children 99496175078b
comparison
equal deleted inserted replaced
4:2d409aff8800 5:443f27cd1572
50 | Some qs => 50 | Some qs =>
51 os <- OpenidFfi.indirect qs; 51 os <- OpenidFfi.indirect qs;
52 case OpenidFfi.getOutput os "openid.error" of 52 case OpenidFfi.getOutput os "openid.error" of
53 Some v => error <xml>Authentication failed: {[v]}</xml> 53 Some v => error <xml>Authentication failed: {[v]}</xml>
54 | None => 54 | None =>
55 case OpenidFfi.getOutput os "openid.identity" of 55 case OpenidFfi.getOutput os "openid.mode" of
56 None => error <xml>Missing identity in OP response</xml> 56 None => error <xml>No <tt>openid.mode</tt> in response</xml>
57 | Some v => return <xml>Identity: {[v]}</xml> 57 | Some mode =>
58 case mode of
59 "cancel" => error <xml>You canceled the authentication!</xml>
60 | "id_res" =>
61 (case OpenidFfi.getOutput os "openid.identity" of
62 None => error <xml>Missing identity in OP response</xml>
63 | Some v => return <xml>Identity: {[v]}</xml>)
64 | _ => error <xml>Unexpected <tt>openid.mode</tt>: <tt>{[mode]}</tt></xml>
58 65
59 fun authenticate id = 66 fun authenticate id =
60 dy <- discover id; 67 dy <- discover id;
61 case dy of 68 case dy of
62 None => return "Discovery failed" 69 None => return "Discovery failed"