Skip to content

Commit

Permalink
Fixed problem in parsing jws
Browse files Browse the repository at this point in the history
  • Loading branch information
mattebit committed Mar 2, 2023
1 parent 3c5dc0f commit 81c32bc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tool/src/main/java/burp/JWT.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public JWT() {

/**
* Function that decodes a raw jwt with Base64 and splitting it into the three parts
*
* @param jwt the raw jwt as string
* @return an array of length 3 containing the three parts of the decoded JWT in order.
*/
Expand All @@ -61,7 +62,7 @@ static public String decode_raw_jwt(String jwt) {
public void parseJWT(String raw_jwt) throws ParsingException {
int i = raw_jwt.lastIndexOf('.');
String withoutSignature = raw_jwt.substring(0, i + 1);
jwt = Jwts.parser().parseClaimsJwt(withoutSignature);
jwt = Jwts.parserBuilder().build().parse(withoutSignature);

singing_alg = (String) jwt.getHeader().get("alg");

Expand Down Expand Up @@ -148,8 +149,9 @@ public String buildJWT_string() throws ParsingException {

/**
* Removes a claim from the given jwt section
*
* @param section the section containing the claim to remove
* @param what the name of the claim to remove
* @param what the name of the claim to remove
*/
public void removeClaim(Utils.Jwt_section section, String what) {
switch (section) {
Expand All @@ -174,9 +176,10 @@ public void removeClaim(Utils.Jwt_section section, String what) {
/**
* This function add or edit a claim from the given section. If the claim is present, it edits it, otherwise it
* adds it.
*
* @param section the section containing the claim or that should contain the claim
* @param what the name of the claim
* @param value the value of the claim to set
* @param what the name of the claim
* @param value the value of the claim to set
*/
public void editAddClaim(Utils.Jwt_section section, String what, String value) {
switch (section) {
Expand All @@ -200,8 +203,9 @@ public void editAddClaim(Utils.Jwt_section section, String what, String value) {

/**
* Function used to get the value of a claim
*
* @param section the section containing the claim
* @param what the name of the claim
* @param what the name of the claim
* @return the value of the claim
*/
public String getClaim(Utils.Jwt_section section, String what) {
Expand Down

0 comments on commit 81c32bc

Please sign in to comment.