diff tests/test.ur @ 10:194577b60771

Call user-specified function after authentication
author Adam Chlipala <adam@chlipala.net>
date Wed, 29 Dec 2010 14:38:56 -0500
parents 870d99055dd1
children de04a3fc6b72
line wrap: on
line diff
--- a/tests/test.ur	Wed Dec 29 14:17:27 2010 -0500
+++ b/tests/test.ur	Wed Dec 29 14:38:56 2010 -0500
@@ -1,5 +1,15 @@
+fun afterward r = return <xml><body>
+  {case r of
+       Openid.Canceled => <xml>You canceled that sucker.</xml>
+     | Openid.Failure s => error <xml>OpenID failure: {[s]}</xml>
+     | Openid.AuthenticatedAs id => <xml>I now know you as <tt>{[id]}</tt>.</xml>}
+</body></xml>
+
 fun auth r =
-    msg <- Openid.authenticate Openid.HMAC_SHA256 Openid.NoEncryption r.Id;
+    msg <- Openid.authenticate afterward
+                               {AssociationType = Openid.HMAC_SHA256,
+                                AssociationSessionType = Openid.NoEncryption,
+                                Identifier = r.Id};
     error <xml>{[msg]}</xml>
 
 fun main () = return <xml><body>