Skip to content

HJ-Rich/bearer-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bearer-extractor

What's this for

  • Simple Bearer Token Extractor for JWT from HttpServletRequest
  • Supports single static method to extract token

How to Use

@GetMapping
public String hello(final HttpServletRequest httpServletRequest) {

    // call resolve method of BearerExtractor
    String token = BearerExtractor.resolve(httpServletRequest);
    
    return "you've sent authorization header with valid jwt!";
}

How to Import

  • Step 1. Add the JitPack repository to your build file
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  • Step 2. Add the dependency
dependencies {
        implementation 'com.github.HJ-Rich:bearer-extractor:0.1.1'
}