Skip to content

Most of Second PR#2

Open
lyzhang27 wants to merge 9 commits intomasterfrom
secondPR
Open

Most of Second PR#2
lyzhang27 wants to merge 9 commits intomasterfrom
secondPR

Conversation

@lyzhang27
Copy link
Copy Markdown

No description provided.

@lyzhang27 lyzhang27 requested a review from manu-sinha May 2, 2018 21:05
@@ -0,0 +1,208 @@
package com.auth0.msg;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You haven't refactored for package name?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

TODO

import java.io.IOException;
import java.net.MalformedURLException;
import java.nio.charset.StandardCharsets;
import java.util.*;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please add sepcific import.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown

@manu-sinha manu-sinha left a comment

Choose a reason for hiding this comment

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

  • Javadocs are missing from many classes/methods
  • Lot of methods are empty

private String input;
private Error error = null;
private boolean verified = false;
ObjectMapper mapper = new ObjectMapper();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

does this need to be protected?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

* @throws InvalidClaimsException
*/
public String toJwt(Key key, Algorithm algorithm) throws InvalidClaimsException, SerializationException {
return null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

implementation?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

noted

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

}
}
if (!errors.isEmpty()) {
String aggregateError = "";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

please reuse errorSB instead of aggregateError.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

* verify that the required claims are present
* @return whether the verification passed
*/
protected boolean verify() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The method signature should tell that this method can throw InvalidClaimsException so that caller can appropriately handle failed validation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done


if (errorSB.length() != 0) {
errors.add("Message is missing required claims:" + errorSB.toString());
return false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This doesn't help - you are adding errors but not returning.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Modified to put error messages into the InvalidClaimException thrown at the end which should be handled upstream and also update the instance of Error object

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Corrected

public class ECKeyDefinition extends KeyDefinition {
private String crv;

public ECKeyDefinition(KeyType type, KeyUseCase useCase, String crv) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please explain each of the parameters.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

/**
* A runtime exception that is thrown when there is an invalid claim in a Message object type
*/
public class InvalidClaimsException extends RuntimeException {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Extending RuntimeException is not right. You should extend Exception. This should be a checked exception so that caller can handle and recover from this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done


import java.util.List;
import java.util.Map;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please provide Javadoc

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

TODO


@Override
public boolean hasError() {
return false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why are you overriding hasError and always returning false? What happens when verify fails? If this is a special scenario please provide javadoc to explain that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Corrected

@@ -0,0 +1,87 @@
package com.auth0.msg;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In abstract message, i have suggested some changes to methods, please make the same changes to interface.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

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.

2 participants