Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ language: go
go:
- 1.13.x

go_import_path: github.com/leeif/pluto
go_import_path: github.com/MuShare/pluto

# Skip the install step. Don't `go get` dependencies. Only build with the code
# in vendor/
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<a name="v1.0.0"></a>
## [v1.0.0](https://github.com/leeif/pluto/compare/v0.5.3...v1.0.0)
## [v1.0.0](https://github.com/MuShare/pluto/compare/v0.5.3...v1.0.0)

> 2020-04-22

Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM golang:1.13 as build

ARG VERSION

ADD . /go/src/github.com/leeif/pluto
ADD . /go/src/github.com/MuShare/pluto

WORKDIR /go/src/github.com/leeif/pluto
WORKDIR /go/src/github.com/MuShare/pluto

RUN export GO111MODULE=on GOPROXY=https://proxy.golang.org && \
go build -ldflags="-X 'main.VERSION=${VERSION}'" -o pluto-server cmd/pluto-server/main.go && \
Expand All @@ -19,10 +19,10 @@ RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSI
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

COPY --from=build /go/src/github.com/leeif/pluto/pluto-server /usr/bin/
COPY --from=build /go/src/github.com/MuShare/pluto/pluto-server /usr/bin/

COPY --from=build /go/src/github.com/leeif/pluto/pluto-migrate /usr/bin/
COPY --from=build /go/src/github.com/MuShare/pluto/pluto-migrate /usr/bin/

COPY --from=build /go/src/github.com/leeif/pluto/views views/
COPY --from=build /go/src/github.com/MuShare/pluto/views views/

ENTRYPOINT ["/usr/bin/pluto-server"]
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
VERSION=$(shell cat VERSION)

docker-build:
docker build --build-arg VERSION=$(VERSION) -t leeif/pluto:latest .
docker tag leeif/pluto:latest leeif/pluto:$(VERSION)
docker build --build-arg VERSION=$(VERSION) -t mushare/pluto:latest .
docker tag mushare/pluto:latest mushare/pluto:$(VERSION)

docker-build-staging:
docker build --build-arg VERSION=staging -t leeif/pluto:staging .
docker build --build-arg VERSION=staging -t mushare/pluto:staging .

docker-push:
docker push leeif/pluto:latest
docker push leeif/pluto:$(VERSION)
docker push mushare/pluto:latest
docker push mushare/pluto:$(VERSION)

docker-push-staging:
docker push leeif/pluto:staging
docker push mushare/pluto:staging

docker-clean:
docker rmi leeif/pluto:latest || true
docker rmi leeif/pluto:$(VERSION) || true
docker rmi mushare/pluto:latest || true
docker rmi mushare/pluto:$(VERSION) || true
docker rm -v $(shell docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null || true
docker rmi $(shell docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null || true

docker-clean-staging:
docker rmi leeif/pluto:staging || true
docker rmi mushare/pluto:staging || true
docker rm -v $(shell docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null || true
docker rmi $(shell docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null || true

Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Pluto

[![Build Status](https://travis-ci.org/leeif/pluto.svg?branch=master)](https://travis-ci.org/leeif/pluto)
[![Go Report Card](https://goreportcard.com/badge/github.com/leeif/pluto)](https://goreportcard.com/report/github.com/leeif/pluto)
[![Build Status](https://travis-ci.org/mushare/pluto.svg?branch=master)](https://travis-ci.org/mushare/pluto)
[![Go Report Card](https://goreportcard.com/badge/github.com/MuShare/pluto)](https://goreportcard.com/report/github.com/MuShare/pluto)
[![Gitter](https://badges.gitter.im/pluto-discuss/community.svg)](https://gitter.im/pluto-discuss/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Pluto is a JWT based authorization/authentication service. Besides providing a basic user registration and login feature, Pluto also provides a RBAC management to control the user's permission. Pluto implements the OAuth2 specified APIs for authorization.
Expand All @@ -12,28 +12,28 @@ Pluto is a JWT based authorization/authentication service. Besides providing a b
* Oauth2 APIs
* JWT-based authorization
* Role-based access control (RBAC)
* Admin page [link](https://github.com/leeif/pluto-admin)
* Admin page [link](https://github.com/MuShare/pluto-admin)

## Getting started

The [Installation doc](https://github.com/leeif/pluto/blob/master/docs/installation.md) have a guide on how to setup the Pluto server via Docker images, Kubernetes or from source.
The [Installation doc](https://github.com/MuShare/pluto/blob/master/docs/installation.md) have a guide on how to setup the Pluto server via Docker images, Kubernetes or from source.

### Documents

All documents can be found in [/docs](https://github.com/leeif/pluto/blob/master/docs)
All documents can be found in [/docs](https://github.com/MuShare/pluto/blob/master/docs)

Here are some helpful documents for reading.

* [API Document](https://github.com/leeif/pluto/blob/master/docs/api.md)
* [Oauth2](https://github.com/leeif/pluto/blob/master/docs/oauth.md)
* [Configuration](https://github.com/leeif/pluto/blob/master/docs/configuration.md)
* [Replace Views](https://github.com/leeif/pluto/blob/master/docs/view.md) is a guide for replacing the default html pages with your own custom files
* [JWT Token](https://github.com/leeif/pluto/blob/master/docs/jwt.md) gives an introduction of the JWT design in Pluto.
* [API Document](https://github.com/MuShare/pluto/blob/master/docs/api.md)
* [Oauth2](https://github.com/MuShare/pluto/blob/master/docs/oauth.md)
* [Configuration](https://github.com/MuShare/pluto/blob/master/docs/configuration.md)
* [Replace Views](https://github.com/MuShare/pluto/blob/master/docs/view.md) is a guide for replacing the default html pages with your own custom files
* [JWT Token](https://github.com/MuShare/pluto/blob/master/docs/jwt.md) gives an introduction of the JWT design in Pluto.

## Contribute

Feel free to fire an issue or send a pull request.

## License

MIT License, see [LICENSE](https://github.com/leeif/pluto/blob/master/LICENSE)
MIT License, see [LICENSE](https://github.com/MuShare/pluto/blob/master/LICENSE)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.3.3
v1.4
6 changes: 3 additions & 3 deletions cmd/pluto-migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"log"
"os"

"github.com/leeif/pluto/config"
"github.com/MuShare/pluto/config"

"github.com/leeif/pluto/database"
"github.com/MuShare/pluto/database"

_ "github.com/go-sql-driver/mysql"
"github.com/leeif/pluto/utils/migrate"
"github.com/MuShare/pluto/utils/migrate"
)

func main() {
Expand Down
20 changes: 10 additions & 10 deletions cmd/pluto-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ import (
"os/signal"
"time"

"github.com/leeif/pluto/manage"
"github.com/leeif/pluto/utils/admin"
"github.com/MuShare/pluto/manage"
"github.com/MuShare/pluto/utils/admin"

"github.com/leeif/pluto/server"
"github.com/MuShare/pluto/server"

plog "github.com/leeif/pluto/log"
"github.com/leeif/pluto/route"
plog "github.com/MuShare/pluto/log"
"github.com/MuShare/pluto/route"

"github.com/leeif/pluto/config"
"github.com/MuShare/pluto/config"
"go.uber.org/fx"

"github.com/leeif/pluto/database"
"github.com/MuShare/pluto/database"

_ "github.com/go-sql-driver/mysql"
perror "github.com/leeif/pluto/datatype/pluto_error"
"github.com/leeif/pluto/utils/rsa"
"github.com/leeif/pluto/utils/view"
perror "github.com/MuShare/pluto/datatype/pluto_error"
"github.com/MuShare/pluto/utils/rsa"
"github.com/MuShare/pluto/utils/view"
)

// VERSION is the pluto build version
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

"github.com/leeif/pluto/config"
"github.com/MuShare/pluto/config"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"database/sql"
"fmt"

"github.com/leeif/pluto/config"
"github.com/MuShare/pluto/config"
)

func NewDatabase(config *config.Config) (*sql.DB, error) {
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Expiration time of JWT can be configured.

View template location which Pluto used like register verfication mail or reset password page.

You can also replace the default pages with your own pages, see [docs/view.md](https://github.com/leeif/pluto/blob/master/docs/view.md) for more information.
You can also replace the default pages with your own pages, see [docs/view.md](https://github.com/MuShare/pluto/blob/master/docs/view.md) for more information.

| Command line flag | Description | Type | Default |
| ---- | ---- | ---- | ---- |
Expand Down
12 changes: 6 additions & 6 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Pluto provides a database migration tool to create database tables.

```
git clone https://github.com/leeif/pluto.git
git clone https://github.com/MuShare/pluto.git
cd pluto/
make migrate-binary-build

Expand All @@ -19,24 +19,24 @@ Requirement: Go (> 1.13)

Download the source file.
```
git clone https://github.com/leeif/pluto.git
git clone https://github.com/MuShare/pluto.git
cd pluto/
make server-binary-build
./bin/pluto-server --config.file=config.yaml
```

## Run Pluto with Docker image
```
docker run -v ${PWD}/config.json:/etc/pluto/config.json --name pluto -d leeif/pluto:latest
docker run -v ${PWD}/config.json:/etc/pluto/config.json --name pluto -d mushare/pluto:latest
docker logs pluto
```
The default config file location in Pluto container is /etc/pluto/config.json.
Here we mount a local config file into container. About config, please see here [Configuration](https://github.com/leeif/pluto/blob/master/docs/configuration.md) for more information.
Here we mount a local config file into container. About config, please see here [Configuration](https://github.com/MuShare/pluto/blob/master/docs/configuration.md) for more information.

Pluto also support several other formats of config file like YAML, TOML.
To use these kinds , you need to pass an env variable like this,
```
docker run --env ConfigFile=/etc/pluto/config.yaml -v ${PWD}/config.yaml:/etc/pluto/config.yaml --name pluto -d leeif/pluto:latest
docker run --env ConfigFile=/etc/pluto/config.yaml -v ${PWD}/config.yaml:/etc/pluto/config.yaml --name pluto -d mushare/pluto:latest
```

## Run Pluto in Kubernetes
Expand All @@ -63,7 +63,7 @@ spec:
spec:
containers:
- name: pluto
image: leeif/pluto:latest
image: mushare/pluto:latest
volumeMounts:
- name: config-volume
mountPath: /etc/pluto/config.json
Expand Down
6 changes: 3 additions & 3 deletions docs/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ Pluto assign a JWT for each user and you can use this JWT to authenticate users
[signature]
```

Here is the example of an access JWT token. You can customize the expiration time through [Configuration](https://github.com/leeif/pluto/blob/master/README.md).
Here is the example of an access JWT token. You can customize the expiration time through [Configuration](https://github.com/MuShare/pluto/blob/master/README.md).

## Signature

### rsa algorithm

The third part of the JWT token is a signature signed with the rsa private key which provided through [rsa config](https://github.com/leeif/pluto/blob/master/docs/configuration.md#rsa)
The third part of the JWT token is a signature signed with the rsa private key which provided through [rsa config](https://github.com/MuShare/pluto/blob/master/docs/configuration.md#rsa)

The sign text is a concat of head and payload of a JWT.
```
sign(string(head)+string(payload), <private key>)
```

Verify a signature need the rsa public key, which you can get through the [public key api](https://github.com/leeif/pluto/blob/master/docs/api.md#apiauthpublickey)
Verify a signature need the rsa public key, which you can get through the [public key api](https://github.com/MuShare/pluto/blob/master/docs/api.md#apiauthpublickey)

```
verify(string(head)+string(payload), <public key>)
Expand Down
6 changes: 3 additions & 3 deletions docs/view.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# view
Pluto is using the golang [template](https://golang.org/pkg/text/template/) engine to parse the template HTML files.
Pluto default uses the templates in [views](https://github.com/leeif/pluto/blob/master/views).
Pluto default uses the templates in [views](https://github.com/MuShare/pluto/blob/master/views).


## template/
Expand Down Expand Up @@ -54,6 +54,6 @@ Error <pluto_error>
# Replace the default views
Docker
```
docker run -v ./config.json:/etc/pluto/config.json -v ./views:/views --name pluto -d leeif/pluto:latest
docker run -v ./config.json:/etc/pluto/config.json -v ./views:/views --name pluto -d mushare/pluto:latest
```
Replace the default views in container, remember the name of your files should be the same as above except the files under the [views/template/](https://github.com/leeif/pluto/blob/master/views/template/).
Replace the default views in container, remember the name of your files should be the same as above except the files under the [views/template/](https://github.com/MuShare/pluto/blob/master/views/template/).
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/leeif/pluto
module github.com/MuShare/pluto

go 1.12

Expand All @@ -10,19 +10,15 @@ require (
github.com/aliyun/aliyun-oss-go-sdk v2.0.2+incompatible
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/friendsofgo/errors v0.9.2
github.com/go-acme/lego/v3 v3.1.0
github.com/go-kit/kit v0.9.0
github.com/go-sql-driver/mysql v1.4.1
github.com/gorilla/context v1.1.1
github.com/gorilla/mux v1.7.3
github.com/gorilla/schema v1.1.0
github.com/gorilla/sessions v1.2.0
github.com/leeif/kiper v0.3.0
github.com/micro/go-micro v1.18.0
github.com/micro/go-plugins/registry/consul v0.0.0-20200119172437-4fe21aa238fd
github.com/micro/go-plugins/server/http v0.0.0-20200119172437-4fe21aa238fd
github.com/pelletier/go-toml v1.2.0
github.com/prometheus/common v0.6.0
github.com/rs/cors v1.7.0
github.com/stretchr/testify v1.4.0
github.com/urfave/negroni v1.0.0
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@ github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/schema v1.1.0 h1:CamqUDOFUBqzrvxuz2vEwo8+SUdwsluFh7IlzJh30LY=
github.com/gorilla/schema v1.1.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ=
github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
Expand Down
2 changes: 1 addition & 1 deletion log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/leeif/pluto/config"
"github.com/MuShare/pluto/config"
)

type PlutoLog struct {
Expand Down
8 changes: 4 additions & 4 deletions manage/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package manage
import (
"database/sql"

"github.com/leeif/pluto/modelexts"
"github.com/MuShare/pluto/modelexts"

perror "github.com/leeif/pluto/datatype/pluto_error"
"github.com/leeif/pluto/datatype/request"
"github.com/leeif/pluto/models"
perror "github.com/MuShare/pluto/datatype/pluto_error"
"github.com/MuShare/pluto/datatype/request"
"github.com/MuShare/pluto/models"
"github.com/volatiletech/sqlboiler/boil"
"github.com/volatiletech/sqlboiler/queries/qm"
)
Expand Down
18 changes: 9 additions & 9 deletions manage/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"time"

"github.com/RichardKnop/uuid"
"github.com/leeif/pluto/datatype/pluto_error"
perror "github.com/leeif/pluto/datatype/pluto_error"
"github.com/leeif/pluto/datatype/request"
"github.com/leeif/pluto/modelexts"
"github.com/leeif/pluto/models"
"github.com/leeif/pluto/utils/general"
"github.com/leeif/pluto/utils/jwt"
"github.com/leeif/pluto/utils/refresh"
saltUtil "github.com/leeif/pluto/utils/salt"
"github.com/MuShare/pluto/datatype/pluto_error"
perror "github.com/MuShare/pluto/datatype/pluto_error"
"github.com/MuShare/pluto/datatype/request"
"github.com/MuShare/pluto/modelexts"
"github.com/MuShare/pluto/models"
"github.com/MuShare/pluto/utils/general"
"github.com/MuShare/pluto/utils/jwt"
"github.com/MuShare/pluto/utils/refresh"
saltUtil "github.com/MuShare/pluto/utils/salt"
"github.com/volatiletech/sqlboiler/boil"
"github.com/volatiletech/sqlboiler/queries/qm"
"github.com/wxnacy/wgo/arrays"
Expand Down
Loading