Mercurial > openid
comparison src/ur/openidUser.urs @ 28:fcd3a977d77b
More type class instances for user type; allow choose to fail
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 24 Feb 2011 17:29:05 -0500 |
parents | ee97bc0e08fa |
children | 1be573ac8e2b |
comparison
equal
deleted
inserted
replaced
27:f129ddee75f3 | 28:fcd3a977d77b |
---|---|
4 * to log in as that user. This module provides all the code you need to sign | 4 * to log in as that user. This module provides all the code you need to sign |
5 * users up, log them in, and check which user is logged in. | 5 * users up, log them in, and check which user is logged in. |
6 * | 6 * |
7 * Module author: Adam Chlipala | 7 * Module author: Adam Chlipala |
8 *) | 8 *) |
9 | |
10 datatype choose_result a = Success of a | Failure of string | |
9 | 11 |
10 (* Instantiate this functor to create your customized authentication scheme. *) | 12 (* Instantiate this functor to create your customized authentication scheme. *) |
11 functor Make(M: sig | 13 functor Make(M: sig |
12 con cols :: {Type} | 14 con cols :: {Type} |
13 constraint [Id] ~ cols | 15 constraint [Id] ~ cols |
33 | 35 |
34 val tabulate : creationState -> signal creationData | 36 val tabulate : creationState -> signal creationData |
35 (* Functionalize current state. *) | 37 (* Functionalize current state. *) |
36 | 38 |
37 val choose : sql_table ([Id = string] ++ cols) [Pkey = [Id]] | 39 val choose : sql_table ([Id = string] ++ cols) [Pkey = [Id]] |
38 -> creationData -> transaction $cols | 40 -> creationData -> transaction (choose_result $cols) |
39 (* Use functionalized state to choose initial column values, | 41 (* Use functionalized state to choose initial column values, |
40 * given a handle to the users table. *) | 42 * given a handle to the users table. *) |
41 | 43 |
42 val sessionLifetime : int | 44 val sessionLifetime : int |
43 (* Number of seconds a session may live *) | 45 (* Number of seconds a session may live *) |
65 * identifier, which can be useful during development (say, | 67 * identifier, which can be useful during development (say, |
66 * when you're off-network). *) | 68 * when you're off-network). *) |
67 end) : sig | 69 end) : sig |
68 | 70 |
69 type user | 71 type user |
72 val eq_user : eq user | |
70 val show_user : show user | 73 val show_user : show user |
74 val read_user : read user | |
71 val inj_user : sql_injectable_prim user | 75 val inj_user : sql_injectable_prim user |
72 (* The abstract type of user IDs. It's really [string], but this is only | 76 (* The abstract type of user IDs. It's really [string], but this is only |
73 * exposed via some standard type class instances. *) | 77 * exposed via some standard type class instances. *) |
74 | 78 |
75 table user : ([Id = user] ++ M.cols) | 79 table user : ([Id = user] ++ M.cols) |