Skip to content

Commit

Permalink
Change in response from UAA
Browse files Browse the repository at this point in the history
Starting on version 76.26.0 of UAA a change was made that changes the
behavior more context in cloudfoundry/uaa#2545

Signed-off-by: João Pereira <joaod@vmware.com>
  • Loading branch information
joaopapereira committed Jun 24, 2024
1 parent 867d09c commit e0f882b
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/uaa/error_converter.go
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ func convert(rawHTTPStatusErr RawHTTPStatusError) error {
if uaaErrorResponse.Type == "invalid_token" {
return InvalidAuthTokenError{Message: uaaErrorResponse.Description}
}
if uaaErrorResponse.Type == "unauthorized" {
if uaaErrorResponse.Type == "unauthorized" || uaaErrorResponse.Type == "invalid_client" {
if uaaErrorResponse.Description == "Your account has been locked because of too many failed attempts to login." {
return AccountLockedError{Message: "Your account has been locked because of too many failed attempts to login."}
}
16 changes: 16 additions & 0 deletions api/uaa/error_converter_test.go
Original file line number Diff line number Diff line change
@@ -135,6 +135,22 @@ var _ = Describe("Error Wrapper", func() {
})
})

Context("invalid_client with bad credentials", func() {
BeforeEach(func() {
fakeConnectionErr.RawResponse = []byte(`{
"error": "invalid_client",
"error_description": "Bad credentials"
}`)
fakeConnection.MakeReturns(fakeConnectionErr)
})

It("returns a BadCredentialsError", func() {
Expect(fakeConnection.MakeCallCount()).To(Equal(1))

Expect(makeErr).To(MatchError(UnauthorizedError{Message: "Bad credentials"}))
})
})

Context("unauthorized - too many failed login attempts", func() {
BeforeEach(func() {
fakeConnectionErr.RawResponse = []byte(`{

0 comments on commit e0f882b

Please sign in to comment.