-
Notifications
You must be signed in to change notification settings - Fork 304
No error returned when credentials are incorrect #491
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
Comments
For information, basic auth has been removed in kubernetes 1.19 |
Edit I was wrong about this, it should throw on 404. |
How I can get the HTTP status code returned? When a 404 is returned, an exception is thrown. How to check for the 403? I don't have any exceptions thrown and I didn't find a method or a property that could tell me the result of the last request. When the password is incorrect, all these methods are returning a |
@sraillard That's something that took me a while to work out. I've got an example of handling something like that here - #489 (comment) Basically, I catch In one case I had to use the lower-level methods (that end with ...WithHttpMessagesAsync). |
@simonvane : I don't get any exception! That is my issue... |
Actually, I looked at the code. It returns null on unauthenticated HTTP 401. It should throw on unauthorized 403 (and on 404, I was wrong above) This doesn't seem right to me, but it will need to be fixed in the generated code. |
I dug into this some more. This is occurring because the Kubernetes swagger has the following declaration in it: "401": {
"description": "Unauthorized"
} Which basically means that 401 is a "expected" error and thus it doesn't throw. I'm going to see if I can strip this from the swagger because it really doesn't make sense to me for 401 not to throw. |
You mean it's in the original JSON provided by the Kubernetes project? |
Yes, the swagger.json that is provided by the Kubernetes project, that is then used to generate this library. There's a pre-processing script that we can use to strip it, I'm making the PR. |
@sraillard Sorry, I was hoping using the |
This was fixed by #505 |
When calling a method with basic authentication (login and password), if the credentials are incorrect, there is no exception. An example with the following will just produce a
ns
variable with anull
value:The text was updated successfully, but these errors were encountered: