rest api key authentication java example