Skip to content

Commit

Permalink
Merge pull request #405 from IBM-Cloud/dev
Browse files Browse the repository at this point in the history
Promote 1.4.0 to master
  • Loading branch information
steveclay authored May 14, 2024
2 parents dd20f56 + 72058f3 commit bfe8b18
Show file tree
Hide file tree
Showing 50 changed files with 271 additions and 6,724 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go
dist: focal
go:
- '1.21.x'
- '1.22.x'
addons:
apt:
packages:
Expand Down
28 changes: 6 additions & 22 deletions bluemix/authentication/iam/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ import (
)

const (
defaultClientID = "bx"
defaultClientSecret = "bx"
defaultUAAClientID = "cf"
defaultUAAClientSecret = ""
crTokenParam = "cr_token"
profileIDParam = "profile_id"
profileNameParam = "profile_name"
profileCRNParam = "profile_crn"
defaultClientID = "bx"
defaultClientSecret = "bx"
crTokenParam = "cr_token"
profileIDParam = "profile_id"
profileNameParam = "profile_name"
profileCRNParam = "profile_crn"
)

// Grant types
Expand All @@ -40,7 +38,6 @@ const (
// Response types
const (
ResponseTypeIAM authentication.ResponseType = "cloud_iam"
ResponseTypeUAA authentication.ResponseType = "uaa"
ResponseTypeIMS authentication.ResponseType = "ims_portal"
ResponseTypeDelegatedRefreshToken authentication.ResponseType = "delegated_refresh_token" // #nosec G101 - this the API response grant type. Not a credential
)
Expand Down Expand Up @@ -191,10 +188,6 @@ type Token struct {
Scope string `json:"scope"`
Expiry time.Time `json:"expiration"`

// Fields present when ResponseTypeUAA is set
UAAToken string `json:"uaa_token"`
UAARefreshToken string `json:"uaa_refresh_token"`

// Fields present when ResponseTypeIMS is set
IMSUserID int64 `json:"ims_user_id"`
IMSToken string `json:"ims_token"`
Expand Down Expand Up @@ -263,8 +256,6 @@ func DefaultConfig(iamEndpoint string) Config {
SessionEndpoint: iamEndpoint + "/v1/sessions",
ClientID: defaultClientID,
ClientSecret: defaultClientSecret,
UAAClientID: defaultUAAClientID,
UAAClientSecret: defaultUAAClientSecret,
}
}

Expand All @@ -285,13 +276,6 @@ func (c *client) GetToken(tokenReq *authentication.TokenRequest) (*Token, error)
tokenReq.SetValue(v)

responseTypes := tokenReq.ResponseTypes()
for _, t := range responseTypes {
if t == ResponseTypeUAA {
v.Set("uaa_client_id", c.config.UAAClientID)
v.Set("uaa_client_secret", c.config.UAAClientSecret)
break
}
}
if len(responseTypes) == 0 {
v.Set("response_type", ResponseTypeIAM.String())
}
Expand Down
193 changes: 0 additions & 193 deletions bluemix/authentication/uaa/uaa.go

This file was deleted.

12 changes: 0 additions & 12 deletions bluemix/configuration/config_helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,6 @@ func PluginBinaryLocation(pluginName string) string {
return executable
}

func CFHome() string {
return ConfigDir()
}

func CFConfigDir() string {
return filepath.Join(CFHome(), ".cf")
}

func CFConfigFilePath() string {
return filepath.Join(CFConfigDir(), "config.json")
}

func UserHomeDir() string {
if runtime.GOOS == "windows" {
home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
Expand Down
34 changes: 2 additions & 32 deletions bluemix/configuration/core_config/bx_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ type BXConfigData struct {
Profile models.Profile
ResourceGroup models.ResourceGroup
LoginAt time.Time
CFEETargeted bool
CFEEEnvID string
PluginRepos []models.PluginRepo
SSLDisabled bool
Locale string
Expand Down Expand Up @@ -212,8 +210,7 @@ func (c *bxConfig) ConsoleEndpoints() (endpoints models.Endpoints) {
func (c *bxConfig) CurrentRegion() (region models.Region) {
c.read(func() {
region = models.Region{
MCCPID: c.data.RegionID,
Name: c.data.Region,
Name: c.data.Region,
}
})
return
Expand Down Expand Up @@ -311,7 +308,7 @@ func (c *bxConfig) IsLoggedIn() bool {
if token, refresh := c.IAMToken(), c.IAMRefreshToken(); token != "" || refresh != "" {
iamTokenInfo := NewIAMTokenInfo(token)
if iamTokenInfo.hasExpired() && refresh != "" {
repo := newRepository(c, nil)
repo := newRepository(c)
if _, err := repo.RefreshIAMToken(); err != nil {
return false
}
Expand Down Expand Up @@ -510,20 +507,6 @@ func (c *bxConfig) SDKVersion() (version string) {
return
}

func (c *bxConfig) HasTargetedCFEE() (targeted bool) {
c.read(func() {
targeted = c.data.CFEETargeted
})
return
}

func (c *bxConfig) CFEEEnvID() (envID string) {
c.read(func() {
envID = c.data.CFEEEnvID
})
return
}

func (c *bxConfig) SetAPIEndpoint(endpoint string) {
c.write(func() {
c.data.APIEndpoint = endpoint
Expand Down Expand Up @@ -553,7 +536,6 @@ func (c *bxConfig) SetConsoleEndpoints(endpoint models.Endpoints) {
func (c *bxConfig) SetRegion(region models.Region) {
c.write(func() {
c.data.Region = region.Name
c.data.RegionID = region.MCCPID
})
}

Expand Down Expand Up @@ -714,18 +696,6 @@ func (c *bxConfig) SetTrace(trace string) {
})
}

func (c *bxConfig) SetCFEETargeted(targeted bool) {
c.write(func() {
c.data.CFEETargeted = targeted
})
}

func (c *bxConfig) SetCFEEEnvID(envID string) {
c.write(func() {
c.data.CFEEEnvID = envID
})
}

func (c *bxConfig) SetCloudType(ctype string) {
c.write(func() {
c.data.CloudType = ctype
Expand Down
4 changes: 1 addition & 3 deletions bluemix/configuration/core_config/bx_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,11 @@ func checkUsageStats(enabled bool, timeStampExist bool, config core_config.Repos

func prepareConfigForCLI(cliConfigContent string, t *testing.T) core_config.Repository {
ioutil.WriteFile("config.json", []byte(cliConfigContent), 0644)
ioutil.WriteFile("cf_config.json", []byte(""), 0644)
return core_config.NewCoreConfigFromPath("cf_config.json", "config.json", func(err error) {
return core_config.NewCoreConfigFromPath("config.json", func(err error) {
t.Fatal(err.Error())
})
}

func cleanupConfigFiles() {
os.Remove("config.json")
os.Remove("cf_config.json")
}
Loading

0 comments on commit bfe8b18

Please sign in to comment.