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

Ian UI d2 1394 update attest failure reaction #125

Merged
merged 19 commits into from
Nov 20, 2023

Conversation

Ian-Nara
Copy link
Contributor

@Ian-Nara Ian-Nara commented Sep 12, 2023

Update shared to inform attestation response watcher of both status code and response body.

@Ian-Nara Ian-Nara marked this pull request as ready for review September 14, 2023 20:26
src/main/java/com/uid2/shared/attest/UidCoreClient.java Outdated Show resolved Hide resolved
@@ -33,12 +34,11 @@ public class AttestationTokenRetriever {
private final AtomicReference<String> attestationToken;
private final AtomicReference<String> optOutJwt;
private final AtomicReference<String> coreJwt;
private final Handler<Integer> responseWatcher;
private final Handler<Pair<Integer, String>> responseWatcher;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is only used by operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of the core, optout, admin, and operator, the attestation token retriever is used by operator and optout, but optout uses a null responseWatcher. Will look into optout closer to make sure it is not broken by these changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested optout/core with my shared changes locally and it is able to attest and refresh with no extra changes needed

Copy link
Contributor

@zaiweidu zaiweidu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zaiweidu zaiweidu self-requested a review September 20, 2023 22:05
Copy link
Contributor

@thomasm-ttd thomasm-ttd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we need to change the attestation scheduled behaviour. Attestation happens on the first call to core, and then after that 10 minutes before expiry of the token.

# Conflicts:
#	src/main/java/com/uid2/shared/attest/AttestationTokenRetriever.java
#	src/test/java/com/uid2/shared/attest/AttestationTokenRetrieverTest.java
@@ -112,6 +115,7 @@ private void attestationExpirationCheck(long timerId) {
}

try {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line

notifyResponseWatcher(401, e.getMessage());
LOGGER.info("Re-attest failed: ", e);
} catch (IOException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to do this as I know you have been trying to get this approved for a while, but can we log out for both the 401 and the 500 the response code, and change the messages so we can tell what the cause was?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure what you are suggesting. It will already log out for both a 401 and a 500, with the message being based on the exception that occurred. Are you suggesting we generalize the error that is logged, so that a 401 always logs the same thing and a 500 always logs the same thing? And if so what do you suggest for the message?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I want to make sure is that we can tell the difference in our logs (so we can alert differently) between the 2 types of 401 errors. If you are confident that this is the case, then I am OK with this.

Copy link
Contributor

@thomasm-ttd thomasm-ttd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the build for operator, so please make sure you are ready to merge operator soon after merging this change, publishing it and updating operator

Copy link
Contributor

@thomasm-ttd thomasm-ttd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check that all the conversations have been resolved before merging

@Ian-Nara Ian-Nara merged commit 0a359c5 into master Nov 20, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants