Skip to content

Instantly share code, notes, and snippets.

@radutoev
Created March 14, 2018 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radutoev/6974b5ea146c1a07ea605e6ff4e8adae to your computer and use it in GitHub Desktop.
Save radutoev/6974b5ea146c1a07ea605e6ff4e8adae to your computer and use it in GitHub Desktop.
@Bean
@Scope(scopeName = ScopeConfig.THREAD_INHERITED,
proxyMode = ScopedProxyMode.TARGET_CLASS)
public TokenString tokenString() {
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder
.currentRequestAttributes())
.getRequest();
String value = request.getHeader("Authorization").split(" ")[1];
return new TokenString(value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment