class AuthenticationSchemeFactory {

    public AuthenticationCommand getAuthenticationCommand(Authentication authentication) {
        final AbstractAuthenticationScheme scheme;
        if ((authentication == null) || (authentication.getScheme() == null)) {
            scheme = defaultScheme;
        } else {
            scheme = getSchema(authentication.getScheme());
        }

        final HttpServletRequest request = RequestContext.getCurrentContext().getRequest();
        final QueryResponse jwtQr = authenticationService.getJwtTokenFromRequest(request)
            .map(x -> authenticationService.parseJwtToken(x))
            .orElse(null);

        return scheme.createCommand(authentication, () -> jwtQr);
    }

    public  AuthenticationSchemeFactory(@Autowired AuthenticationService authenticationService, @Autowired List<AbstractAuthenticationScheme> schemes);

}