comparison src/ur/openid.ur @ 15:35bc4da563dd

Realms; documentation and license
author Adam Chlipala <adam@chlipala.net>
date Sun, 02 Jan 2011 11:22:30 -0500
parents 6b2a44da71b0
children df2eb629f21a
comparison
equal deleted inserted replaced
14:6b2a44da71b0 15:35bc4da563dd
374 | Some rt => 374 | Some rt =>
375 if rt <> show (effectfulUrl returnTo) then 375 if rt <> show (effectfulUrl returnTo) then
376 return (Some "Wrong return_to in OP response") 376 return (Some "Wrong return_to in OP response")
377 else 377 else
378 return None 378 return None
379
380 val realmString = case r.Realm of
381 None => ""
382 | Some realm => "&openid.realm=" ^ realm
379 in 383 in
380 dy <- discover r.Identifier; 384 dy <- discover r.Identifier;
381 case dy of 385 case dy of
382 None => return "Discovery failed" 386 None => return "Discovery failed"
383 | Some dy => 387 | Some dy =>
384 case r.Association of 388 case r.Association of
385 Stateless => 389 Stateless =>
386 redirect (bless (dy ^ "?openid.ns=http://specs.openid.net/auth/2.0&openid.mode=checkid_setup&openid.claimed_id=" 390 redirect (bless (dy ^ "?openid.ns=http://specs.openid.net/auth/2.0&openid.mode=checkid_setup&openid.claimed_id="
387 ^ r.Identifier ^ "&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.return_to=" 391 ^ r.Identifier ^ "&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.return_to="
388 ^ show (effectfulUrl returnTo))) 392 ^ show (effectfulUrl returnTo) ^ realmString))
389 | Stateful ar => 393 | Stateful ar =>
390 assoc <- association ar.AssociationType ar.AssociationSessionType dy; 394 assoc <- association ar.AssociationType ar.AssociationSessionType dy;
391 case assoc of 395 case assoc of
392 AssError msg => return ("Association failure: " ^ msg) 396 AssError msg => return ("Association failure: " ^ msg)
393 | AssAlternate _ => return "Association failure: server didn't accept its own alternate association modes" 397 | AssAlternate _ => return "Association failure: server didn't accept its own alternate association modes"
394 | Association assoc => 398 | Association assoc =>
395 redirect (bless (dy ^ "?openid.ns=http://specs.openid.net/auth/2.0&openid.mode=checkid_setup&openid.claimed_id=" 399 redirect (bless (dy ^ "?openid.ns=http://specs.openid.net/auth/2.0&openid.mode=checkid_setup&openid.claimed_id="
396 ^ r.Identifier ^ "&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.assoc_handle=" 400 ^ r.Identifier ^ "&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.assoc_handle="
397 ^ assoc.Handle ^ "&openid.return_to=" ^ show (effectfulUrl returnTo))) 401 ^ assoc.Handle ^ "&openid.return_to=" ^ show (effectfulUrl returnTo) ^ realmString))
398 end 402 end
399 403
400 task periodic 1 = fn () => 404 task periodic 1 = fn () =>
401 dml (DELETE FROM discoveries WHERE Expires < CURRENT_TIMESTAMP); 405 dml (DELETE FROM discoveries WHERE Expires < CURRENT_TIMESTAMP);
402 dml (DELETE FROM associations WHERE Expires < CURRENT_TIMESTAMP); 406 dml (DELETE FROM associations WHERE Expires < CURRENT_TIMESTAMP);