-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Read users from auth0 export * feat: Read passwords form json file * feat: migration tool auth0 * feat: remove unused code * feat: remove unused file * feat: add migration tool and readme * feat: readme * feat: readme * feat: clean up migration file * fix: remove unused file * refactor: move commands into single binary * merge main and update dependencies --------- Co-authored-by: Livio Spring <[email protected]>
- Loading branch information
1 parent
419bfa0
commit 3a07a3c
Showing
14 changed files
with
435 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
project_name: key2jwt | ||
project_name: zitadel-tools | ||
|
||
builds: | ||
- env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,43 @@ | ||
package main | ||
package basicauth | ||
|
||
import ( | ||
b64 "encoding/base64" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"net/url" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// Cmd represents the basicauth command | ||
var Cmd = &cobra.Command{ | ||
Use: "basicauth", | ||
Short: "Convert <client ID> and <client secret> to be used in Authorization header for Client Secret Basic", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
basicAuth(cmd) | ||
}, | ||
} | ||
|
||
var ( | ||
clientId = flag.String("id", "", "Client ID as string") | ||
clientSecret = flag.String("secret", "", "Client secret as string") | ||
clientId string | ||
clientSecret string | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
func init() { | ||
Cmd.Flags().StringVar(&clientId, "id", "", "Client ID as string") | ||
Cmd.Flags().StringVar(&clientSecret, "secret", "", "Client secret as string") | ||
} | ||
|
||
if *clientId == "" || *clientSecret == "" { | ||
flag.PrintDefaults() | ||
panic("please provide a client ID and secret") | ||
func basicAuth(cmd *cobra.Command) { | ||
if clientId == "" || clientSecret == "" { | ||
log.Println("please provide a client ID and secret") | ||
fmt.Println(cmd.Flags().FlagUsages()) | ||
return | ||
} | ||
|
||
sEscaped := url.QueryEscape(*clientId) + ":" + url.QueryEscape(*clientSecret) | ||
sEscaped := url.QueryEscape(clientId) + ":" + url.QueryEscape(clientSecret) | ||
|
||
sEnc := b64.StdEncoding.EncodeToString([]byte(sEscaped)) | ||
|
||
fmt.Print(sEnc) | ||
fmt.Println(sEnc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"_ID":{"$oid":"60425dc43519d90068f82973"},"email_verified":false,"email":"[email protected]","passwordHash":"$2b$10$Z6hUTEEeoJXN5/AmSm/4.eZ75RYgFVriQM9LPhNEC7kbAbS/VAaJ2","password_set_date":{"$date":"2021-03-05T16:35:16.775Z"},"tenant":"dev-rwsbs6ym","connection":"Username-Password-Authentication","_tmp_is_unique":true} | ||
{"_ID":{"$oid":"60425da93519d90068f82966"},"email_verified":false,"email":"[email protected]","passwordHash":"$2b$10$CSZ2JarG4XYbGa.JkfpqnO2wrlbfp5eb5LScHSGo9XGeZ.a.Ic54S","password_set_date":{"$date":"2021-03-05T16:34:49.502Z"},"tenant":"dev-rwsbs6ym","connection":"Username-Password-Authentication","_tmp_is_unique":true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"user_id":"auth0|6437e9c2b7add15a89b4915b","email":"[email protected]","name":"Test Example2"} | ||
{"user_id":"auth0|6437fa205c7266dc77f88a6c","email":"[email protected]","name":"Test User"} |
Oops, something went wrong.