2021-08-11 21:39:34 +08:00
< h1 align = "center" style = "border-bottom: none;" > 📦⚡️ Casdoor< / h1 >
< h3 align = "center" > A UI-first centralized authentication / Single-Sign-On (SSO) platform based on OAuth 2.0 / OIDC.< / h3 >
2021-08-12 14:42:26 +08:00
< p align = "center" >
< a href = " #badge " >
< img alt = "semantic-release" src = "https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" >
< / a >
< a href = "https://hub.docker.com/r/casbin/casdoor" >
< img alt = "docker pull casbin/casdoor" src = "https://img.shields.io/docker/pulls/casbin/casdoor.svg" >
< / a >
< a href = "https://github.com/casbin/casdoor/actions/workflows/build.yml" >
< img alt = "GitHub Workflow Status (branch)" src = "https://github.com/casbin/jcasbin/workflows/build/badge.svg?style=flat-square" >
< / a >
< a href = "https://github.com/casbin/casdoor/releases/latest" >
< img alt = "GitHub Release" src = "https://img.shields.io/github/v/release/casbin/casdoor.svg" >
< / a >
< a href = "https://hub.docker.com/repository/docker/casbin/casdoor" >
< img alt = "Docker Image Version (latest semver)" src = "https://img.shields.io/badge/Docker%20Hub-latest-brightgreen" >
< / a >
< / p >
2021-08-11 21:39:34 +08:00
< p align = "center" >
< a href = "https://goreportcard.com/report/github.com/casbin/casdoor" >
2021-08-12 14:42:26 +08:00
< img alt = "Go Report Card" src = "https://goreportcard.com/badge/github.com/casbin/casdoor?style=flat-square" >
2021-08-11 21:39:34 +08:00
< / a >
< a href = "https://github.com/casbin/casdoor/blob/master/LICENSE" >
< img src = "https://img.shields.io/github/license/casbin/casdoor?style=flat-square" alt = "license" >
< / a >
< a href = "https://github.com/casbin/casdoor/issues" >
< img alt = "GitHub issues" src = "https://img.shields.io/github/issues/casbin/casdoor?style=flat-square" >
< / a >
< a href = "#" >
< img alt = "GitHub stars" src = "https://img.shields.io/github/stars/casbin/casdoor?style=flat-square" >
< / a >
< a href = "https://github.com/casbin/casdoor/network" >
< img alt = "GitHub forks" src = "https://img.shields.io/github/forks/casbin/casdoor?style=flat-square" >
< / a >
< / p >
2021-02-16 17:58:51 +08:00
## 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-08-18 20:07:39 +08:00
*❗ A word of caution ❗: the `npm` commands above need a recommended system RAM of at least 4GB. It has a potential failure during building the files if your RAM is not sufficient.*
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-09-08 22:02:58 +08:00
That's it! Try to visit http://127.0.0.1:7001/. :small_airplane:
**But make sure you always request the backend port 8000 when you are using SDKs.**
2021-07-12 18:58:46 +08:00
2021-08-09 23:43:36 +08:00
##### Production Mode
2021-07-12 18:58:46 +08:00
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-09 23:43:36 +08:00
> Notice, you should visit back-end port, default 8000. Now try to visit **http://SERVER_IP: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-03-12 11:15:07 +08:00
2021-08-07 22:02:56 +08:00
Edit `conf/app.conf` , modify `dataSourceName` to the fixed content:
2021-03-12 11:15:07 +08:00
2021-08-07 22:02:56 +08:00
```bash
dataSourceName = root:123@tcp (db:3306)/
```
2021-03-12 11:15:07 +08:00
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-03-12 11:15:07 +08:00
2021-08-07 22:02:56 +08:00
#### Run
2021-03-12 11:15:07 +08:00
2021-08-07 22:02:56 +08:00
```bash
docker-compose up
```
2021-02-16 17:58:51 +08:00
2021-08-09 23:43:36 +08:00
That's it! Try to visit http://localhost:8000/. :small_airplane:
2021-02-16 17:58:51 +08:00
2021-08-12 14:42:26 +08:00
### Docker Hub
This method requires [docker ](https://docs.docker.com/get-docker/ ) and [docker-compose ](https://docs.docker.com/compose/install/ ) to be installed first.
```bash
docker pull casbin/casdoor
```
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-04-30 19:35:03 +08:00
2021-08-07 22:02:56 +08:00
These all use casdoor as a centralized authentication platform.
2021-04-30 19:35:03 +08:00
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-04-30 19:35:03 +08:00
2021-08-07 22:02:56 +08:00
## Contribute
2021-04-30 19:35:03 +08:00
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-09 23:43:36 +08:00
### I18n notice
2021-02-16 17:58:51 +08:00
2021-08-09 23:43:36 +08:00
If you are contributing to casdoor, please note that we use [Crowdin ](https://crowdin.com/project/casdoor-web ) as translating platform and i18next as translating tool. When you add some words using i18next in the ```web/` `` directory, please remember to add what you have added to the ` ``web/src/locales/en/data.json` `` file.
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