Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workload Identity Federation Auth #199

Merged
merged 4 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/199.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
SDK can authenticate using Workload Identity Federation.
```
8 changes: 4 additions & 4 deletions auth/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func TestJsonToCache_InvalidFormat(t *testing.T) {
{
name: "empty values",
rawJSON: []byte(`{ "access_token": "", "refresh_token": "", "access_token_expiry": "", "session_expiry": "" }`),
expectedError: "failed to unmarshal the raw data to json: parsing time \"\\\"\\\"\" as \"\\\"2006-01-02T15:04:05Z07:00\\\"\": cannot parse \"\\\"\" as \"2006\"",
expectedError: "failed to unmarshal the raw data to json: parsing time",
},
{
name: "empty access token",
Expand All @@ -345,12 +345,12 @@ func TestJsonToCache_InvalidFormat(t *testing.T) {
{
name: "empty access token expiry",
rawJSON: []byte(`{ "access_token": "myaccesstoken", "refresh_token": "myrefreshtoken", "access_token_expiry": "", "session_expiry": "2022-11-20T17:10:59.273429-04:00"}`),
expectedError: "failed to unmarshal the raw data to json: parsing time \"\\\"\\\"\" as \"\\\"2006-01-02T15:04:05Z07:00\\\"\": cannot parse \"\\\"\" as \"2006\"",
expectedError: "failed to unmarshal the raw data to json: parsing time",
},
{
name: "empty session expiry",
rawJSON: []byte(`{ "access_token": "myaccesstoken", "refresh_token": "myrefreshtoken", "access_token_expiry": "2022-11-20T17:10:59.273429-04:00", "session_expiry": ""}`),
expectedError: "failed to unmarshal the raw data to json: parsing time \"\\\"\\\"\" as \"\\\"2006-01-02T15:04:05Z07:00\\\"\": cannot parse \"\\\"\" as \"2006\"",
expectedError: "failed to unmarshal the raw data to json: parsing time",
},
}

Expand All @@ -360,7 +360,7 @@ func TestJsonToCache_InvalidFormat(t *testing.T) {

_, err := jsonToCache(testCase.rawJSON)
require.Error(err)
require.EqualError(err, testCase.expectedError)
require.ErrorContains(err, testCase.expectedError)
})
}
}
Expand Down
Loading