Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change issuer to audience #4

Merged
merged 3 commits into from
Feb 4, 2021
Merged
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 .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