protected void extractTokenParameters(String entandoApiToken, ApiMethod apiMethod,
HttpServletRequest request, Properties properties) throws ApiException, IOException, ServletException {
UserDetails user = null;
IApiTokenizerManager tokenizerManager =
(IApiTokenizerManager) ApsWebApplicationUtils.getBean(JpTokenApiSystemConstants.TOKENIZER_MANAGER, request);
IAuthenticationProviderManager authenticationProvider =
(IAuthenticationProviderManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHENTICATION_PROVIDER_MANAGER, request);
IAuthorizationManager authorizationManager =
(IAuthorizationManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, request);
try {
String username = tokenizerManager.getUser(entandoApiToken);
user = authenticationProvider.getUser(username);
if (null != user) {
properties.put(SystemConstants.API_USER_PARAMETER, user);
} else if (apiMethod.getRequiredAuth()) {
throw new ApiException(IApiErrorCodes.API_AUTHENTICATION_REQUIRED, "Invalid or missing user for token '" + entandoApiToken + "'", Response.Status.UNAUTHORIZED);
}