Skip to content

Commit

Permalink
Merge 66071d7 into 606ac27
Browse files Browse the repository at this point in the history
  • Loading branch information
caicloud-bot committed Sep 17, 2020
2 parents 606ac27 + 66071d7 commit ee4eedf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions pkg/server/biz/scm/scm.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,21 @@ func GenerateSCMToken(config *v1alpha1.SCMSource) error {

if generatedToken != "" && config.AuthType == v1alpha1.AuthTypePassword {
config.Token = generatedToken
} else {
err := provider.CheckToken()
if err != nil {
return err
}
}

// Cleanup the password for security.
config.Password = ""

// recreate the scm provider and check auth
provider, err = GetSCMProvider(config)
if err != nil {
return err
}
err = provider.CheckToken()
if err != nil {
return err
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/cerr/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var (

// ErrorExternalAuthorizationFailed defines error that authorization failed for external system, Unauthorized 401.
ErrorExternalAuthorizationFailed = nerror.InternalServerError.Build(ReasonAuthorizationFailed,
"authentication failed: ${error}")
"authorization failed: ${error}")

// ErrorExternalAuthenticationFailed defines error that authentication failed for external system, Forbidden 403.
ErrorExternalAuthenticationFailed = nerror.InternalServerError.Build(ReasonAuthenticationFailed,
Expand Down

0 comments on commit ee4eedf

Please sign in to comment.