Skip to content

Commit 821906b

Browse files
authored
[secrets] Update envsec (#1812)
## Summary Updates envsec dependencies so that success URL can be specified. ## How was it tested? builds
1 parent 464fb9e commit 821906b

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ require (
3939
github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a
4040
github.com/wk8/go-ordered-map/v2 v2.1.8
4141
github.com/zealic/go2node v0.1.0
42-
go.jetpack.io/envsec v0.0.16-0.20240111222345-e1fd0e1204ca
43-
go.jetpack.io/pkg v0.0.0-20240108193620-a28b84329d15
42+
go.jetpack.io/envsec v0.0.16-0.20240214025624-d233cf877eec
43+
go.jetpack.io/pkg v0.0.0-20240213204231-ec96be3d78fb
4444
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
4545
golang.org/x/mod v0.15.0
4646
golang.org/x/sync v0.6.0

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,12 @@ github.com/zealic/go2node v0.1.0 h1:ofxpve08cmLJBwFdI0lPCk9jfwGWOSD+s6216x0oAaA=
363363
github.com/zealic/go2node v0.1.0/go.mod h1:GrkFr+HctXwP7vzcU9RsgtAeJjTQ6Ud0IPCQAqpTfBg=
364364
go.jetpack.io/envsec v0.0.16-0.20240111222345-e1fd0e1204ca h1:7Ocnr+mVZTCG8MHlcAdW5d8ir7eqZTmD8S/aEskjXWk=
365365
go.jetpack.io/envsec v0.0.16-0.20240111222345-e1fd0e1204ca/go.mod h1:kCgRGNSHU5AgQXQGUenohPPDoUd87SRL00uOzQsa+Q8=
366+
go.jetpack.io/envsec v0.0.16-0.20240214025624-d233cf877eec h1:IvdOF1C8tAxvKEauWBd/4IWXZfeyXh5vmcfTrcTBPvQ=
367+
go.jetpack.io/envsec v0.0.16-0.20240214025624-d233cf877eec/go.mod h1:koTmI1q2QKqtxaX4P/7r5ygODwgJQ56FKoKRfzpZ0bM=
366368
go.jetpack.io/pkg v0.0.0-20240108193620-a28b84329d15 h1:ztX3CydpNKLePPMRmWgdi4HcxE/AXY6HViOJOmmYNiA=
367369
go.jetpack.io/pkg v0.0.0-20240108193620-a28b84329d15/go.mod h1:kGUL8aZ7ddvoGro0AQxXos9GKn5Qw0J18qW7d5FP4Ws=
370+
go.jetpack.io/pkg v0.0.0-20240213204231-ec96be3d78fb h1:ELaZEV3BL+/GDfPxWPXt6ODNig/VlywWhfAC4P8EG5A=
371+
go.jetpack.io/pkg v0.0.0-20240213204231-ec96be3d78fb/go.mod h1:kGUL8aZ7ddvoGro0AQxXos9GKn5Qw0J18qW7d5FP4Ws=
368372
go.jetpack.io/typeid v1.0.0 h1:8gQ+iYGdyiQ0Pr40ydSB/PzMOIwlXX5DTojp1CBeSPQ=
369373
go.jetpack.io/typeid v1.0.0/go.mod h1:+UPEaECUgFxgAjFPn5Yf9eO/3ft/3xZ98Eahv9JW/GQ=
370374
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=

internal/boxcli/auth.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func loginCmd() *cobra.Command {
3838
Short: "Login to devbox",
3939
Args: cobra.ExactArgs(0),
4040
RunE: func(cmd *cobra.Command, args []string) error {
41-
c, err := auth.NewClient(build.Issuer(), build.ClientID(), scopes)
41+
c, err := newAuthClient()
4242
if err != nil {
4343
return err
4444
}
@@ -60,7 +60,7 @@ func logoutCmd() *cobra.Command {
6060
Short: "Logout from devbox",
6161
Args: cobra.ExactArgs(0),
6262
RunE: func(cmd *cobra.Command, args []string) error {
63-
c, err := auth.NewClient(build.Issuer(), build.ClientID(), scopes)
63+
c, err := newAuthClient()
6464
if err != nil {
6565
return err
6666
}
@@ -110,9 +110,18 @@ func whoAmICmd() *cobra.Command {
110110
}
111111

112112
func genSession(ctx context.Context) (*session.Token, error) {
113-
c, err := auth.NewClient(build.Issuer(), build.ClientID(), scopes)
113+
c, err := newAuthClient()
114114
if err != nil {
115115
return nil, err
116116
}
117117
return c.GetSession(ctx)
118118
}
119+
120+
func newAuthClient() (*auth.Client, error) {
121+
return auth.NewClient(
122+
build.Issuer(),
123+
build.ClientID(),
124+
scopes,
125+
build.SuccessRedirect(),
126+
)
127+
}

internal/build/build.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,10 @@ func JetpackAPIHost() string {
8080
}
8181
return "https://api.jetpack.io"
8282
}
83+
84+
func SuccessRedirect() string {
85+
if IsDev {
86+
return "https://auth.jetpack.dev/account/login/success"
87+
}
88+
return "https://auth.jetpack.io/account/login/success"
89+
}

0 commit comments

Comments
 (0)