Mercurial > openid
annotate 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 |
rev | line source |
---|---|
adam@10 | 1 fun afterward r = return <xml><body> |
adam@10 | 2 {case r of |
adam@10 | 3 Openid.Canceled => <xml>You canceled that sucker.</xml> |
adam@10 | 4 | Openid.Failure s => error <xml>OpenID failure: {[s]}</xml> |
adam@10 | 5 | Openid.AuthenticatedAs id => <xml>I now know you as <tt>{[id]}</tt>.</xml>} |
adam@10 | 6 </body></xml> |
adam@10 | 7 |
adam@4 | 8 fun auth r = |
adam@10 | 9 msg <- Openid.authenticate afterward |
adam@10 | 10 {AssociationType = Openid.HMAC_SHA256, |
adam@10 | 11 AssociationSessionType = Openid.NoEncryption, |
adam@10 | 12 Identifier = r.Id}; |
adam@4 | 13 error <xml>{[msg]}</xml> |
adam@1 | 14 |
adam@1 | 15 fun main () = return <xml><body> |
adam@1 | 16 <form> |
adam@1 | 17 <textbox{#Id}/> |
adam@4 | 18 <submit action={auth}/> |
adam@1 | 19 </form> |
adam@1 | 20 </body></xml> |