Skip to content

Commit

Permalink
Add support for Web Login (#2036)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNino authored Jul 5, 2023
1 parent 9e3efbe commit 9bcf74e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
7 changes: 7 additions & 0 deletions docs/general/login/help.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package login

var Usage = []string{"login"}

func GetDescription() string {
return "Log in to a JFrog Platform via your web browser. Available for Artifactory 7.63.1 and above"
}
14 changes: 14 additions & 0 deletions general/login/cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package login

import (
coreLogin "github.com/jfrog/jfrog-cli-core/v2/general/login"
"github.com/jfrog/jfrog-cli/utils/cliutils"
"github.com/urfave/cli"
)

func LoginCmd(c *cli.Context) error {
if c.NArg() > 0 {
return cliutils.WrongNumberOfArgumentsHandler(c)
}
return coreLogin.NewLoginCommand().Run()
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230629184314-ff61ffffba34
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230705084348-c7d33487e393

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.6-0.20230418122323-2bf299dd6d27

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230629174113-81715f46ec0f
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230705083849-6fd087a5e228
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ github.com/jfrog/build-info-go v1.9.6 h1:lCJ2j5uXAlJsSwDe5J8WD7Co1f/hUlZvMfwfb5A
github.com/jfrog/build-info-go v1.9.6/go.mod h1:GbuFS+viHCKZYx9nWHYu7ab1DgQkFdtVN3BJPUNb2D4=
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-cli-core/v2 v2.37.1 h1:VE/6cagGor/5lWB7l+aU5FlhztoHM9q9M2FlWcn3ESo=
github.com/jfrog/jfrog-cli-core/v2 v2.37.1/go.mod h1:i62WcX9jQbH0dJjQdkmJAGridZgFVIK1B3yIPfXayHI=
github.com/jfrog/jfrog-client-go v1.31.0 h1:VIptdPkECaM0UDbKE2ZjFZh9i85W99xM65c6rFxDNj4=
github.com/jfrog/jfrog-client-go v1.31.0/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230705084348-c7d33487e393 h1:zIaBtAjalQ7HLwiYcR3OSU9Jglpmhtw8rg6piYervNU=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230705084348-c7d33487e393/go.mod h1:DnamqHWhKmrmWlCRG3i3z8Wn0JRtNFMC+Bu8TCFzSPY=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230705083849-6fd087a5e228 h1:bkOkjb6sVqo6Jgw9eYSH58jIFPOJvFvwt+jIXvef7QM=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230705083849-6fd087a5e228/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk=
Expand Down
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import (
"github.com/jfrog/jfrog-cli/distribution"
"github.com/jfrog/jfrog-cli/docs/common"
"github.com/jfrog/jfrog-cli/docs/general/cisetup"
loginDocs "github.com/jfrog/jfrog-cli/docs/general/login"
cisetupcommand "github.com/jfrog/jfrog-cli/general/cisetup"
"github.com/jfrog/jfrog-cli/general/envsetup"
"github.com/jfrog/jfrog-cli/general/login"
"github.com/jfrog/jfrog-cli/general/project"
"github.com/jfrog/jfrog-cli/missioncontrol"
"github.com/jfrog/jfrog-cli/pipelines"
Expand Down Expand Up @@ -266,6 +268,15 @@ func getCommands() []cli.Command {
fmt.Println(common.GetGlobalEnvVars())
},
},
{
Name: "login",
Usage: loginDocs.GetDescription(),
HelpName: corecommon.CreateUsage("login", loginDocs.GetDescription(), loginDocs.Usage),
BashComplete: corecommon.CreateBashCompletionFunc(),
Category: otherCategory,
Action: login.LoginCmd,
Hidden: true, // TODO remove when Artifactory 7.63.1 is released to self-hosted
},
}
allCommands := append(slices.Clone(cliNameSpaces), utils.GetPlugins()...)
allCommands = append(allCommands, scan.GetCommands()...)
Expand Down

0 comments on commit 9bcf74e

Please sign in to comment.