aboutsummaryrefslogtreecommitdiff
path: root/cmd/origin-login-test
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-25 07:04:40 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-25 07:04:40 -0400
commitc56dff0a9701218cc5bb0658c732c7c4ea5e5b21 (patch)
tree1bdb7706322608c58eeee6211898b4a1047908ec /cmd/origin-login-test
parentb88653083bc6fcb8031548dbf4b4c4261de2873a (diff)
downloadAtlas-c56dff0a9701218cc5bb0658c732c7c4ea5e5b21.tar.gz
Atlas-c56dff0a9701218cc5bb0658c732c7c4ea5e5b21.zip
all: Rewrite Origin auth (#7)
* all: Rewrite juno auth, split into separate packages * pkg/juno: Implement two-factor auth * pkg/origin: Add AuthMgr option to save HAR archives * pkg/atlas: Add config option to save HAR archives
Diffstat (limited to 'cmd/origin-login-test')
-rw-r--r--cmd/origin-login-test/main.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/cmd/origin-login-test/main.go b/cmd/origin-login-test/main.go
index 8a51168..32634d7 100644
--- a/cmd/origin-login-test/main.go
+++ b/cmd/origin-login-test/main.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/cardigann/harhar"
+ "github.com/r2northstar/atlas/pkg/juno"
"github.com/r2northstar/atlas/pkg/origin"
"github.com/spf13/pflag"
)
@@ -28,8 +29,8 @@ func init() {
func main() {
pflag.Parse()
- if pflag.NArg() != 2 || opt.Help {
- fmt.Printf("usage: %s [options] email password\n\noptions:\n%s\nwarning: do not use this tool repeatedly, or you may trigger additional verification, which will break login\n", os.Args[0], pflag.CommandLine.FlagUsages())
+ if pflag.NArg() < 2 || pflag.NArg() > 3 || opt.Help {
+ fmt.Printf("usage: %s [options] email password [totp_secret]\n\noptions:\n%s\nwarning: do not use this tool repeatedly, or you may trigger additional verification, which will break login\n", os.Args[0], pflag.CommandLine.FlagUsages())
if opt.Help {
os.Exit(2)
}
@@ -68,16 +69,17 @@ func main() {
var fail bool
ctx := context.Background()
- sid, err := origin.Login(ctx, pflag.Arg(0), pflag.Arg(1))
+ r, err := juno.Login(ctx, nil, pflag.Arg(0), pflag.Arg(1), pflag.Arg(2))
if err != nil {
fmt.Fprintf(os.Stderr, "origin: error: %v\n", err)
fail = true
} else {
- fmt.Printf("SID=%s\n", sid)
+ fmt.Printf("SID=%s\n", r.SID)
+ fmt.Printf("JunoCode=%s\n", r.Code)
}
if !fail {
- token, expiry, err := origin.GetNucleusToken(ctx, sid)
+ token, expiry, err := origin.GetNucleusToken(ctx, nil, r.SID)
if err != nil {
fmt.Fprintf(os.Stderr, "origin: error: %v\n", err)
fail = true