Skip to content

Commit

Permalink
add support for valid authorization header format in radio module
Browse files Browse the repository at this point in the history
  • Loading branch information
robo-w committed May 24, 2024
1 parent 3103da4 commit 4ab1913
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public MessageController(final RadioService radioService, final Environment env)
}

@PostMapping
public void receiveMessage(@RequestBody IncomingMessageDto message, @RequestHeader("Authorization") String key) {
if (authToken != null && Objects.equals(authToken, key)) {
public void receiveMessage(@RequestBody final IncomingMessageDto message, @RequestHeader("Authorization") final String key) {
String authKey = key != null ? key.replaceFirst("Bearer ", "").trim() : null;
if (authToken != null && Objects.equals(authToken, authKey)) {
radioService.receiveMessage(message);
} else {
LOG.debug("Mismatch of authentication token. Dropping radio message.");
Expand Down

0 comments on commit 4ab1913

Please sign in to comment.