You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+121Lines changed: 121 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,10 @@ Supported Golang version:
33
33
-[Mac OSX](#mac-osx)
34
34
-[Windows](#windows)
35
35
-[Errors](#errors)
36
+
-[User Authentication](#user-authentication)
37
+
-[Compile](#compile)
38
+
-[Usage](#usage)
39
+
-
36
40
-[Extensions](#extensions)
37
41
-[Spatialite](#spatialite)
38
42
-[FAQ](#faq)
@@ -76,6 +80,11 @@ Boolean values can be one of:
76
80
77
81
| Name | Key | Value(s) | Description |
78
82
|------|-----|----------|-------------|
83
+
| UA - Create |`_auth`| - | Create User Authentication, for more information see [User Authentication](#user-authentication)|
84
+
| UA - Username |`_auth_user`|`string`| Username for User Authentication, for more information see [User Authentication](#user-authentication)|
85
+
| UA - Password |`_auth_pass`|`string`| Password for User Authentication, for more information see [User Authentication](#user-authentication)|
86
+
| UA - Crypt |`_auth_crypt`| <ul><li>SHA1</li><li>SSHA1</li><li>SHA256</li><li>SSHA256</li><li>SHA384</li><li>SSHA384</li><li>SHA512</li><li>SSHA512</li></ul> | Password encoder to use for User Authentication, for more information see [User Authentication](#user-authentication)|
87
+
| UA - Salt |`_auth_salt`|`string`| Salt to use if the configure password encoder requires a salt, for User Authentication, for more information see [User Authentication](#user-authentication)|
79
88
| Auto Vacuum |`_auto_vacuum`\|`_vacuum`| <ul><li>`0`\|`none`</li><li>`1`\|`full`</li><li>`2`\|`incremental`</li></ul> | For more information see [PRAGMA auto_vacuum](https://www.sqlite.org/pragma.html#pragma_auto_vacuum)|
80
89
| Busy Timeout |`_busy_timeout`\|`_timeout`|`int`| Specify value for sqlite3_busy_timeout. For more information see [PRAGMA busy_timeout](https://www.sqlite.org/pragma.html#pragma_busy_timeout)|
81
90
| Case Sensitive LIKE |`_case_sensitive_like`\|`_cslike`|`boolean`| For more information see [PRAGMA case_sensitive_like](https://www.sqlite.org/pragma.html#pragma_case_sensitive_like)|
| Secure Delete | sqlite_secure_delete | This compile-time option changes the default setting of the secure_delete pragma.<br><br>When this option is not used, secure_delete defaults to off. When this option is present, secure_delete defaults to on.<br><br>The secure_delete setting causes deleted content to be overwritten with zeros. There is a small performance penalty since additional I/O must occur.<br><br>On the other hand, secure_delete can prevent fragments of sensitive information from lingering in unused parts of the database file after it has been deleted. See the documentation on the secure_delete pragma for additional information |
145
154
| Secure Delete (FAST) | sqlite_secure_delete_fast | For more information see [PRAGMA secure_delete](https://www.sqlite.org/pragma.html#pragma_secure_delete)|
The passwords within the user authentication module of SQLite are encoded with the SQLite function `sqlite_cryp`.
350
+
This function uses a ceasar-cypher which is quite insecure.
351
+
This library provides several additional password encoders which can be configured through the connection string.
352
+
353
+
The password cypher can be configured with the key `_auth_crypt`. And if the configured password encoder also requires an
354
+
salt this can be configured with `_auth_salt`.
355
+
356
+
#### Available Encoders
357
+
358
+
- SHA1
359
+
- SSHA1 (Salted SHA1)
360
+
- SHA256
361
+
- SSHA256 (salted SHA256)
362
+
- SHA384
363
+
- SSHA384 (salted SHA384)
364
+
- SHA512
365
+
- SSHA512 (salted SHA512)
366
+
367
+
### Restrictions
368
+
369
+
Operations on the database regarding to user management can only be preformed by an administrator user.
370
+
371
+
### Support
372
+
373
+
The user authentication supports two kinds of users
374
+
375
+
- administrators
376
+
- regular users
377
+
378
+
### User Management
379
+
380
+
User management can be done by directly using the `*SQLiteConn` or by SQL.
381
+
382
+
#### SQL
383
+
384
+
The following sql functions are available for user management.
385
+
386
+
| Function | Arguments | Description |
387
+
|----------|-----------|-------------|
388
+
| `authenticate` | username `string`, password `string` | Will authenticate an user, this is done by the connection; and should not be used manually. |
389
+
| `auth_user_add` | username `string`, password `string`, admin `int` | This function will add an user to the database.<br>if the database is not protected by user authentication it will enable it. Argument `admin` is an integer identifying if the added user should be an administrator. Only Administrators can add administrators. |
390
+
| `auth_user_change` | username `string`, password `string`, admin `int` | Function to modify an user. Users can change their own password, but only an administrator can change the administrator flag. |
391
+
| `authUserDelete` | username `string` | Delete an user from the database. Can only be used by an administrator. The current logged in administrator cannot be deleted. This is to make sure their is always an administrator remaining. |
392
+
393
+
These functions will return an integer.
394
+
395
+
- 0 (SQLITE_OK)
396
+
- 23 (SQLITE_AUTH) Failed to perform due to authentication or insufficient privileges
0 commit comments