blob: 83337aae2e806ecb5938a91082e36033eeab9f6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# Cgit simple authentication
Simple authentication for [cgit](https://wiki.archlinux.org/title/Cgit) powered by [sqlite](https://wiki.archlinux.org/title/SQLite) and [redis](https://wiki.archlinux.org/title/Redis)
## Configure
Add this project as cgit [`auth-filter`](https://man.archlinux.org/man/cgitrc.5#FILTER_API)
```conf
auth-filter=/opt/cgit-simple-authentication/target/release/cgit-simple-authentication
```
Available options for this filter:
```conf
# Set cookie time to live
cgit-simple-auth-cookie-ttl=600
# Specify database location (Default is /etc/cgit/auth.db)
cgit-simple-auth-database=/etc/cgit/auth.db
# Should authenticate in repositories root view
cgit-simple-auth-bypass-root=false
# Should enable authenticate in all repository
cgit-simple-auth-full-protect=true
```
Available options for repositories:
_You should set `cgit-simple-auth-full-protect=false`_
```conf
repo.url=test
# Enable protect for this repository
repo.protect=true
```
## Usage
You should initialize your database first
```shell
cargo run -- database init
```
Then add user with
```shell
cargo run -- user add admin hunter2
```
More usage information, see `--help`.
## Program help
```plain
Simple Authentication Filter for cgit
USAGE:
cgit-simple-authentication.exe [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
database Database rated commands
repo Repository ACL rated commands
user Users rated commands
help Prints this message or the help of the given subcommand(s)
```
## Source
Most of the ideas come from: https://github.com/varphone/cgit-gogs-auth-filter
## License
[](https://www.gnu.org/licenses/agpl-3.0.txt)
Copyright (C) 2021 KunoiSayami
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|