casdoor/README.md

132 lines
3.6 KiB
Markdown
Raw Normal View History

2021-02-16 17:58:51 +08:00
Casdoor
====
2021-08-07 22:02:56 +08:00
[![Go Report Card](https://goreportcard.com/badge/github.com/casbin/casdoor)](https://goreportcard.com/report/github.com/casbin/casdoor) <img src="https://img.shields.io/github/license/casbin/casdoor?style=flat-square" alt="license"> [![GitHub issues](https://img.shields.io/github/issues/casbin/casdoor?style=flat-square)](https://github.com/casbin/casdoor/issues) [![GitHub stars](https://img.shields.io/github/stars/casbin/casdoor?style=flat-square)](https://github.com/casbin/casdoor/stargazers) [![GitHub forks](https://img.shields.io/github/forks/casbin/casdoor?style=flat-square)](https://github.com/casbin/casdoor/network)
2021-02-16 17:58:51 +08:00
Casdoor is a UI-first centralized authentication / Single-Sign-On (SSO) platform based on OAuth 2.0 / OIDC.
## Online demo
2021-08-07 22:02:56 +08:00
Deployed site: https://door.casbin.com/
## Quick Start
Run your own casdoor program in a few minutes:smiley:
### Download
There are two methods, get code via go subcommand `get`:
```shell
go get github.com/casbin/casdoor
```
or `git`:
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
```bash
git clone https://github.com/casbin/casdoor
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
Finally, change directory:
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
```bash
cd casdoor/
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
We provide two start up methods for all kinds of users.
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
### Manual
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
#### Simple configuration
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
Edit `conf/app.conf`, modify `dataSourceName` to correct database info, which follows this format:
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
```bash
username:password@tcp(database_ip:database_port)/
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
#### Run
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
Casdoor provides two run modes, the difference is binary size and user prompt.
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
##### Dev Mode
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
Edit `conf/app.conf`, set `runmode=dev`. Firstly build front-end files:
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
```bash
cd web/ && npm install && npm run start
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
Then build back-end binary file, change directory to root(Relative to casdoor):
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
```bash
go run main.go
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
That's it! Try to visit http://127.0.0.1:7001/. :small_airplane:
2021-08-07 22:02:56 +08:00
##### Prod Mode
2021-08-07 22:02:56 +08:00
Edit `conf/app.conf`, set `runmode=prod`. Firstly build front-end files:
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
```bash
cd web/ && npm install && npm run build
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
Then build back-end binary file, change directory to root(Relative to casdoor):
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
```bash
go build main.go && sudo ./main
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
> Notice, you should visit back-end port, default 8000. Now try to visit http://127.0.0.1:8000/
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
### Docker
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
This method requires [docker](https://docs.docker.com/get-docker/) and [docker-compose](https://docs.docker.com/compose/install/) to be installed first.
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
#### Simple configuration
2021-08-07 22:02:56 +08:00
Edit `conf/app.conf`, modify `dataSourceName` to the fixed content:
2021-08-07 22:02:56 +08:00
```bash
dataSourceName = root:123@tcp(db:3306)/
```
2021-08-07 22:02:56 +08:00
> If you need to modify `conf/app.conf`, you need to re-run `docker-compose up`.
2021-08-07 22:02:56 +08:00
#### Run
2021-08-07 22:02:56 +08:00
Just execute:
2021-08-07 22:02:56 +08:00
```bash
docker-compose up
```
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
That's
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
## Detailed documentation
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
We also provide a complete [document](https://casdoor.org/) as a reference.
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
## Other examples
2021-08-07 22:02:56 +08:00
These all use casdoor as a centralized authentication platform.
2021-08-07 22:02:56 +08:00
- [Casnode](https://github.com/casbin/casnode): Next-generation forum software based on React + Golang.
- [Casbin-OA](https://github.com/casbin/casbin-oa): A full-featured OA(Office Assistant) system.
- ......
2021-08-07 22:02:56 +08:00
## Contribute
2021-08-07 22:02:56 +08:00
For casdoor, if you have any questions, you can give Issues, and you can also directly Pull Requests(but we recommend give issues first to communicate with the community).
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
In addition to contributing codes to casdoor, uou can also contribute to the [internationalization of casdoor](https://crowdin.com/project/casdoor-web) by translating for casdoor in the language you are good at.
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
Both are welcome! :kissing_smiling_eyes:
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
## License
2021-02-16 17:58:51 +08:00
2021-08-07 22:02:56 +08:00
[Apache-2.0](https://github.com/casbin/casdoor/blob/master/LICENSE)
2021-02-16 17:58:51 +08:00