Mercurial > openid
comparison src/ur/openidUser.urs @ 35:a5574ec3991f
Generalize the formatting options a bit.
author | Karn Kallio <kkallio@eka> |
---|---|
date | Wed, 20 Apr 2011 15:45:27 -0430 |
parents | 1be573ac8e2b |
children | df258dbf4739 |
comparison
equal
deleted
inserted
replaced
34:c0731afcb0c7 | 35:a5574ec3991f |
---|---|
6 * | 6 * |
7 * Module author: Adam Chlipala | 7 * Module author: Adam Chlipala |
8 *) | 8 *) |
9 | 9 |
10 datatype choose_result a = Success of a | Failure of string | 10 datatype choose_result a = Success of a | Failure of string |
11 | |
12 (* Formatting options for the gui elements and controls. *) | |
13 signature CTLDISPLAY = sig | |
14 | |
15 val formatUser : xbody -> xbody | |
16 (* Format the display of the logged on user *) | |
17 | |
18 val formatLogout : url -> xbody | |
19 (* Format the logout link *) | |
20 | |
21 val formatSignup : url -> xbody | |
22 (* Format the signup link *) | |
23 | |
24 val formatLogon : ({User : string} -> transaction page) -> xbody | |
25 (* Format the login form *) | |
26 end | |
27 | |
28 (* Some reasonable default gui control formats for programmers in a hurry. *) | |
29 structure DefaultDisplay : CTLDISPLAY | |
30 | |
11 | 31 |
12 (* Instantiate this functor to create your customized authentication scheme. *) | 32 (* Instantiate this functor to create your customized authentication scheme. *) |
13 functor Make(M: sig | 33 functor Make(M: sig |
14 con cols :: {Type} | 34 con cols :: {Type} |
15 constraint [Id] ~ cols | 35 constraint [Id] ~ cols |
64 | 84 |
65 val fakeId : option string | 85 val fakeId : option string |
66 (* If set, this string is always accepted as a verified | 86 (* If set, this string is always accepted as a verified |
67 * identifier, which can be useful during development (say, | 87 * identifier, which can be useful during development (say, |
68 * when you're off-network). *) | 88 * when you're off-network). *) |
69 | 89 |
70 val ctlDisplay : {User : {Status : xbody, Other : xbody}, | 90 structure CtlDisplay : CTLDISPLAY |
71 Guest : {Status : xbody, Other : xbody}} | 91 (* Tells how to format the GUI elements. *) |
72 (* These help formatting the user status controls *) | |
73 end) : sig | 92 end) : sig |
74 | 93 |
75 type user | 94 type user |
76 val eq_user : eq user | 95 val eq_user : eq user |
77 val show_user : show user | 96 val show_user : show user |
84 PRIMARY KEY Id | 103 PRIMARY KEY Id |
85 | 104 |
86 val current : transaction (option user) | 105 val current : transaction (option user) |
87 (* Figure out which, if any, user is logged in on this connection. *) | 106 (* Figure out which, if any, user is logged in on this connection. *) |
88 | 107 |
108 | |
89 val main : (string -> xbody -> transaction page) -> transaction {Status : xbody, | 109 val main : (string -> xbody -> transaction page) -> transaction {Status : xbody, |
90 Other : xbody} | 110 Other : {Url : url, Xml : xbody}} |
111 | |
91 (* Pass in your generic page template; get out the HTML snippet for user | 112 (* Pass in your generic page template; get out the HTML snippet for user |
92 * management, suitable for, e.g., inclusion in your standard page | 113 * management, suitable for, e.g., inclusion in your standard page |
93 * header. The output gives a "status" chunk, which will either be a login | 114 * header. The output gives a "status" chunk, which will either be a login |
94 * form or a message about which user is logged in; and an "other" chunk, | 115 * form or a message about which user is logged in; and an "other" chunk, |
95 * which will be a log out or sign up link. *) | 116 * which will be a log out or sign up link. *) |
96 | 117 |
97 end | 118 end |
98 | 119 |
99 (* Functor outputs will contain buttons specialized to particular well-known | 120 (* Functor outputs will contain buttons specialized to particular well-known |
100 * OpenID providers. Use these CSS classes to style those buttons. *) | 121 * OpenID providers. Use these CSS classes to style those buttons. *) |
101 style aol | 122 style aol |