-
Notifications
You must be signed in to change notification settings - Fork 24
Retry request on specific authentication errors. #37
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
Conversation
In some Instance Principal cases, the security token returned from OCI Identity may have a very short expiration. This change removes the expiration check, and allows a single retry on requests that get specific authN errors. It also adds trace-level logging of authentication token details.
| /* allow a single retry on clock skew / auth errors */ | ||
| String msg = iae.getMessage(); | ||
| if ((msg.contains("clock skew") == false && | ||
| msg.contains("request signature is invalid") == false) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would not do the right thing if IAM starts returning expired token exceptions. See the code I posted in slack. Look at the possible errors based on that code. It may not be worth the check on the message and just make this "if (kvRequest.getNumRetries() > 0)".
That is, I don't see a path where this exception happens where we wouldn't want to retry once
…bugfix/instance_principal_expirations
| /* allow a single retry on clock skew errors */ | ||
| if (iae.getMessage().contains("clock skew") == false || | ||
| kvRequest.getNumRetries() > 0) { | ||
| /* allow a single retry on clock skew / auth errors */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe comment that these are errors indicating actual invalid/expired auth info vs a permission-related error
In some Instance Principal cases, the security token returned from OCI Identity may have a very short expiration. This change removes the expiration check, and allows a single retry on requests that get specific authN errors.
It also adds trace-level logging of authentication token details.