class AutomationClientAuthFactory extends ClientAuthFactory {

  public AutomationClient provide(ContainerRequest containerRequest,
      HttpServletRequest httpServletRequest) {
    // This will throw a NotAuthorizedException if the client does not exist or cannot
    // be extracted from the request.
    Client client = super.provide(containerRequest, httpServletRequest);

    // This method returns null if the provided client is not actually an automation client
    return Optional.ofNullable(AutomationClient.of(client))
        .orElseThrow(() -> new ForbiddenException(
            format("Client %s not authorized as a AutomationClient", client.getName())));
  }

  @Inject public  AutomationClientAuthFactory(ClientDAOFactory clientDAOFactory,
      KeywhizConfig keywhizConfig);
  @VisibleForTesting  AutomationClientAuthFactory(ClientDAO clientDAO,
      ClientAuthConfig clientAuthConfig);

}