-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to support GLP IAM API Client
In this PR we add support for GLP IAM API Clients. We retain support for GLCS API Clients. We also retain support for "non-api vended" GLCS API Clients for backwards compatibility. We've added a new provider parameter "iam_version" with the corresponding env-var HPEGL_IAM_VERSION to designate which version of IAM is being used: - glcs - glp The default value of this parameter is glp. We've added a function to validate the value of "iam_version". We've updated the "description" field for "api_vended_service_client" and "tenant_id" in light of the support for GLP IAM. The issuertoken package has been modified to generate the correct URL and the correct set of http request parameters depending on which type of IAM is being used. We've had to update various unit-tests and the generated mocks. Signed-off-by: Eamonn O'Toole <[email protected]>
- Loading branch information
1 parent
6aa29f7
commit 1aeeded
Showing
10 changed files
with
197 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// (C) Copyright 2024 Hewlett Packard Enterprise Development LP | ||
|
||
package issuertoken | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/hewlettpackard/hpegl-provider-lib/pkg/provider" | ||
) | ||
|
||
func TestGenerateParamsAndURL(t *testing.T) { | ||
t.Parallel() | ||
testcases := []struct { | ||
name string | ||
iamVersion string | ||
hasError bool | ||
}{ | ||
{ | ||
name: "valid IAM version GLCS", | ||
iamVersion: provider.IAMVersionGLCS, | ||
hasError: false, | ||
}, | ||
{ | ||
name: "valid IAM version GLP", | ||
iamVersion: provider.IAMVersionGLP, | ||
hasError: false, | ||
}, | ||
{ | ||
name: "invalid IAM version", | ||
iamVersion: "invalid", | ||
hasError: true, | ||
}, | ||
} | ||
|
||
for _, testcase := range testcases { | ||
tc := testcase | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() | ||
_, _, err := generateParamsAndURL("clientID", "clientSecret", "identityServiceURL", tc.iamVersion) | ||
if tc.hasError { | ||
assert.NotNil(t, err) | ||
} else { | ||
assert.Nil(t, err) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.