I know I can get a header via method parameters via the @RequestHeader
annotation as shown in this answer How to get access to HTTP header information in Spring MVC REST controller?; however, if I am using the same header for ever single method, this will get tedious. I am looking how to get the header information from a private utility method; not a http exposed method
I would like to do something like this:
@RestController
public class MyController {
private Identity getIdentity(){
Token token = ParseToken(headers.get("Authorization"));
token.verify("secret");
return new User(token.name);
...
Is something like this possible? Or am I barking up the wrong tree altogether?