Skip to content

Commit

Permalink
update authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinnii committed Oct 4, 2024
1 parent ed0f7fd commit 82b2026
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public ResponseEntity<String> handleRESTfulChat(@PathVariable("bot") String bot,
@PathVariable("channel") String channel,
HttpEntity<String> input, HttpServletRequest request) {
String token = request.getHeader("Authorization");
if (token.startsWith("Basic")) {
token = "Bearer " + request.getHeader("Access-Token");
}
RESTfulChatResponse answerMsg = null;
String email = "";

Expand Down Expand Up @@ -377,6 +380,10 @@ public ResponseEntity<String> handleRESTfulChatFile(@PathVariable("bot") String
@FormDataParam("file") InputStream uploadedInputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail, HttpServletRequest request) {
String token = request.getHeader("Authorization");
if (token.startsWith("Basic")) {
token = "Bearer " + request.getHeader("Access-Token");
}

RESTfulChatResponse answerMsg = new RESTfulChatResponse("");
try {
Bot b = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,10 @@ public void performIntentTrigger(BotConfiguration botConfig, String botName, Mes
throws ParseBotException {

String token = request.getHeader("Authorization");

if (token.startsWith("Basic")) {
token = "Bearer " + request.getHeader("Access-Token");
}

String botId = getModelByName(botName).getId().toString();
Bot bot = botConfig.getBots().get(botId);

Expand Down

0 comments on commit 82b2026

Please sign in to comment.