Skip to content

Commit

Permalink
Merge pull request #839 from ioito/hotfix/qx-saml-auth
Browse files Browse the repository at this point in the history
fix(qcloud): saml auth
  • Loading branch information
ioito authored Mar 29, 2024
2 parents 0d32177 + 26d5972 commit 376ab51
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions pkg/multicloud/qcloud/qcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,23 @@ func (client *SQcloudClient) verifyAppId() error {
return errors.Wrap(err, "Head")
}

func (client *SQcloudClient) getOwnerName() string {
if len(client.ownerName) > 0 {
return client.ownerName
}
coscli, err := client.getCosClient(nil)
if err != nil {
return ""
}
s, _, err := coscli.Service.Get(context.Background())
if err != nil {
return ""
}
client.ownerId = s.Owner.ID
client.ownerName = s.Owner.DisplayName
return client.ownerName
}

func (client *SQcloudClient) fetchBuckets() error {
coscli, err := client.getCosClient(nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/multicloud/qcloud/saml_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (self *SAMLProvider) Delete() error {
}

func (self *SAMLProvider) GetAuthUrl(apiServer string) string {
return fmt.Sprintf("https://cloud.tencent.com/login/forwardIdp/%s/%s", self.client.ownerName, self.Name)
return fmt.Sprintf("https://cloud.tencent.com/login/forwardIdp/%s/%s", self.client.getOwnerName(), self.Name)
}

func (self *SAMLProvider) GetMetadataDocument() (*samlutils.EntityDescriptor, error) {
Expand Down

0 comments on commit 376ab51

Please sign in to comment.