Skip to content
Permalink
Browse files
Removing bearer token part and validating the token
  • Loading branch information
DImuthuUpe committed Aug 10, 2021
1 parent dfb3dd0 commit 499dfe9471d038e65d33f0a310fc181cd0c38ce4
Showing 1 changed file with 13 additions and 0 deletions.
@@ -59,6 +59,19 @@ public MFTDownloadResponse mftDownload(@RequestHeader("Authorization") String au
@PathVariable String resourceid) throws Exception {

logger.info("MFT download request to resource {}", resourceid);

if (authTokenStr!= null || authTokenStr.isEmpty()) {
logger.error("Auth token can not be null");
throw new Exception("Auth token can not be null");
}

if (!authTokenStr.startsWith("Bearer")) {
logger.error("No bearer token provided");
throw new Exception("No bearer token provided");
}

authTokenStr = authTokenStr.substring(7).trim();

MFTApiServiceGrpc.MFTApiServiceBlockingStub mftClient = MFTApiClient.buildClient(mftHost, mftPort);

ManagedChannel channel = ManagedChannelBuilder.forAddress(drmsHost, drmsPort).usePlaintext().build();

0 comments on commit 499dfe9

Please sign in to comment.