Skip to content

Commit

Permalink
fix: change issuer to audience (#4)
Browse files Browse the repository at this point in the history
* Update README.md

* Update key2jwt.go

* spelling

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
  • Loading branch information
fforootd and livio-a committed Feb 4, 2021
1 parent a50b2c7 commit d536a38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
go test -v ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
# if: success() && startsWith(github.ref, 'refs/tags/')
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## Usage

key2jwt requires to flags (and will print result in stdout):
- issuer: where the assertion is going to be used (e.g. https://issuer.zitadel.ch)
key2jwt requires two flags (and will print result in stdout):
- audience: where the assertion is going to be used (e.g. https://issuer.zitadel.ch)
- key: the path to the key.json

```
./key2jwt -issuer=https://issuer.zitadel.ch -key=key.json
./key2jwt -audience=https://issuer.zitadel.ch -key=key.json
```

Optinally you can pass an `output` flag. This will save the jwt in the provided file path:
Optionally you can pass an `output` flag. This will save the jwt in the provided file path:

```
./key2jwt -issuer=https://issuer.zitadel.ch -key=key.json -output=jwt.txt
./key2jwt -audience=https://issuer.zitadel.ch -key=key.json -output=jwt.txt
```
8 changes: 4 additions & 4 deletions cmd/jwt/key2jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (

var (
keyPath = flag.String("key", "", "path to the key.json")
issuer = flag.String("issuer", "", "issuer where the token will be used (e.g. https://issuer.zitadel.ch)")
audience = flag.String("audience", "", "audience where the token will be used (e.g. the issuer of zitadel.ch - https://issuer.zitadel.ch)")
outputPath = flag.String("output", "", "path where the generated jwt will be saved; will print to stdout if empty")
)

func main() {
flag.Parse()

if *keyPath == "" || *issuer == "" {
fmt.Println("Please provide at least an issuer and key param:")
if *keyPath == "" || *audience == "" {
fmt.Println("Please provide at least an audience and key param:")
flag.PrintDefaults()
return
}
Expand All @@ -30,7 +30,7 @@ func main() {
fmt.Printf("error reading key file: %v", err.Error())
return
}
assertion, err := oidc.NewJWTProfileAssertionFromFileData(key, []string{*issuer})
assertion, err := oidc.NewJWTProfileAssertionFromFileData(key, []string{*audience})
if err != nil {
fmt.Printf("error generating assertion: %v", err.Error())
return
Expand Down

0 comments on commit d536a38

Please sign in to comment.