Skip to content

Commit

Permalink
[secrets] Update envsec (#1812)
Browse files Browse the repository at this point in the history
## Summary

Updates envsec dependencies so that success URL can be specified.

## How was it tested?

builds
  • Loading branch information
mikeland73 authored Feb 14, 2024
1 parent 464fb9e commit 821906b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ require (
github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a
github.com/wk8/go-ordered-map/v2 v2.1.8
github.com/zealic/go2node v0.1.0
go.jetpack.io/envsec v0.0.16-0.20240111222345-e1fd0e1204ca
go.jetpack.io/pkg v0.0.0-20240108193620-a28b84329d15
go.jetpack.io/envsec v0.0.16-0.20240214025624-d233cf877eec
go.jetpack.io/pkg v0.0.0-20240213204231-ec96be3d78fb
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
golang.org/x/mod v0.15.0
golang.org/x/sync v0.6.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,12 @@ github.com/zealic/go2node v0.1.0 h1:ofxpve08cmLJBwFdI0lPCk9jfwGWOSD+s6216x0oAaA=
github.com/zealic/go2node v0.1.0/go.mod h1:GrkFr+HctXwP7vzcU9RsgtAeJjTQ6Ud0IPCQAqpTfBg=
go.jetpack.io/envsec v0.0.16-0.20240111222345-e1fd0e1204ca h1:7Ocnr+mVZTCG8MHlcAdW5d8ir7eqZTmD8S/aEskjXWk=
go.jetpack.io/envsec v0.0.16-0.20240111222345-e1fd0e1204ca/go.mod h1:kCgRGNSHU5AgQXQGUenohPPDoUd87SRL00uOzQsa+Q8=
go.jetpack.io/envsec v0.0.16-0.20240214025624-d233cf877eec h1:IvdOF1C8tAxvKEauWBd/4IWXZfeyXh5vmcfTrcTBPvQ=
go.jetpack.io/envsec v0.0.16-0.20240214025624-d233cf877eec/go.mod h1:koTmI1q2QKqtxaX4P/7r5ygODwgJQ56FKoKRfzpZ0bM=
go.jetpack.io/pkg v0.0.0-20240108193620-a28b84329d15 h1:ztX3CydpNKLePPMRmWgdi4HcxE/AXY6HViOJOmmYNiA=
go.jetpack.io/pkg v0.0.0-20240108193620-a28b84329d15/go.mod h1:kGUL8aZ7ddvoGro0AQxXos9GKn5Qw0J18qW7d5FP4Ws=
go.jetpack.io/pkg v0.0.0-20240213204231-ec96be3d78fb h1:ELaZEV3BL+/GDfPxWPXt6ODNig/VlywWhfAC4P8EG5A=
go.jetpack.io/pkg v0.0.0-20240213204231-ec96be3d78fb/go.mod h1:kGUL8aZ7ddvoGro0AQxXos9GKn5Qw0J18qW7d5FP4Ws=
go.jetpack.io/typeid v1.0.0 h1:8gQ+iYGdyiQ0Pr40ydSB/PzMOIwlXX5DTojp1CBeSPQ=
go.jetpack.io/typeid v1.0.0/go.mod h1:+UPEaECUgFxgAjFPn5Yf9eO/3ft/3xZ98Eahv9JW/GQ=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
Expand Down
15 changes: 12 additions & 3 deletions internal/boxcli/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func loginCmd() *cobra.Command {
Short: "Login to devbox",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
c, err := auth.NewClient(build.Issuer(), build.ClientID(), scopes)
c, err := newAuthClient()
if err != nil {
return err
}
Expand All @@ -60,7 +60,7 @@ func logoutCmd() *cobra.Command {
Short: "Logout from devbox",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
c, err := auth.NewClient(build.Issuer(), build.ClientID(), scopes)
c, err := newAuthClient()
if err != nil {
return err
}
Expand Down Expand Up @@ -110,9 +110,18 @@ func whoAmICmd() *cobra.Command {
}

func genSession(ctx context.Context) (*session.Token, error) {
c, err := auth.NewClient(build.Issuer(), build.ClientID(), scopes)
c, err := newAuthClient()
if err != nil {
return nil, err
}
return c.GetSession(ctx)
}

func newAuthClient() (*auth.Client, error) {
return auth.NewClient(
build.Issuer(),
build.ClientID(),
scopes,
build.SuccessRedirect(),
)
}
7 changes: 7 additions & 0 deletions internal/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,10 @@ func JetpackAPIHost() string {
}
return "https://api.jetpack.io"
}

func SuccessRedirect() string {
if IsDev {
return "https://auth.jetpack.dev/account/login/success"
}
return "https://auth.jetpack.io/account/login/success"
}

0 comments on commit 821906b

Please sign in to comment.