Mercurial > openid
annotate tests/test.ur @ 19:5e03668972ea
Utest example
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 06 Jan 2011 15:25:11 -0500 |
parents | 35bc4da563dd |
children | f6b3fbf10dac |
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@15 | 10 {Association = Openid.Stateful {AssociationType = Openid.HMAC_SHA256, |
adam@15 | 11 AssociationSessionType = Openid.NoEncryption}, |
adam@15 | 12 Identifier = r.Id, |
adam@15 | 13 Realm = Some "http://localhost:8080/"}; |
adam@4 | 14 error <xml>{[msg]}</xml> |
adam@1 | 15 |
adam@1 | 16 fun main () = return <xml><body> |
adam@1 | 17 <form> |
adam@1 | 18 <textbox{#Id}/> |
adam@4 | 19 <submit action={auth}/> |
adam@1 | 20 </form> |
adam@1 | 21 </body></xml> |