Skip to content

Commit

Permalink
Set auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ron190 committed Jan 31, 2025
1 parent 26f9d5b commit 5961ccc
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions model/src/main/java/com/jsql/util/GitUtil.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.jsql.util;

import com.jsql.model.InjectionModel;
import com.jsql.model.exception.JSqlRuntimeException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
Expand Down Expand Up @@ -137,15 +138,18 @@ public void sendReport(String reportBody, ShowOnConsole showOnConsole, String re
return;
}

String token;
try {
token = StringUtil.fromHexZip(
this.injectionModel.getMediatorUtils().getPropertiesUtil().getProperties().getProperty("github.token")
);
} catch (IOException e) {
throw new JSqlRuntimeException(e);
}

var httpRequest = HttpRequest.newBuilder()
.uri(URI.create(this.injectionModel.getMediatorUtils().getPropertiesUtil().getProperties().getProperty("github.issues.url")))
.setHeader(
"Authorization",
"token "
+ StringUtil.base64Decode(
this.injectionModel.getMediatorUtils().getPropertiesUtil().getProperties().getProperty("github.token")
)
)
.setHeader("Authorization", "token "+ token)
.POST(BodyPublishers.ofString(
new JSONObject()
.put("title", reportTitle)
Expand Down

0 comments on commit 5961ccc

Please sign in to comment.