Skip to content

Commit

Permalink
Write REAME.go + main.go: cd with args
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesGuilleus committed Jun 30, 2020
1 parent 143c1e6 commit 540fedc
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
# Arveto Auth

A auth center server.
(public package) [![GoDoc](https://godoc.org/github.com/Arveto/arvetoAuth/pkg/public?status.svg)](https://godoc.org/github.com/Arveto/arvetoAuth/pkg/public)

**This packages are not stable.**
## Start

Start this programme with the name of the working directory.

## Config

```ini
; URL of the server
url = "http://localhost:8000/"
; Listen address
listen = ":8000"

; Enable develpment mode
; ! NO USE IT IN PRODUCTION !
dev = true

[github]
; The GitHub Oauth tocken
client = ""
secret = ""

[google]
; The Google Oauth tocken
client = ""
secret = ""

[mail]
; Mail configuration
login = "auth@example.com"
password = "xxx"
host = "smtp.example.com"
```

## JWT

You can get the RSA public key from `/publickey` URI.

The JWT claims:

- `id` (string): an string id.
- `pseudo` (string)
- `email` (string): email address.
- `avatar` (string): The URL of teh avatar or a default avatar.
- `level` (string): The level of the user. Values are `Ban` < `Candidate` < `Visitor` < `Std` < `Admin`.

To auth a client, redirect it to `http(s)://server/auth?app=appID&r=base64`.
The params r is an optionnal redirect URL encoding in URL base64. The client
come back on the URI: `/login?jwt=...?r=...`.
17 changes: 17 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,25 @@ import (
"gopkg.in/ini.v1"
"log"
"net/http"
"os"
)

func init() {
for _, a := range os.Args[1:] {
if a == "-h" || a == "--help" {
log.Println("(optionnal) Give the working directory")
os.Exit(0)
}
}

if len(os.Args) == 2 {
err := os.Chdir(os.Args[1])
if err != nil {
log.Fatal(err)
}
}
}

func main() {
log.Println("[START]")

Expand Down

0 comments on commit 540fedc

Please sign in to comment.