@Override
  public Mono<GetExternalServiceCredentialsResponse> getExternalServiceCredentials(final GetExternalServiceCredentialsRequest request) {
    final ExternalServiceCredentialsGenerator credentialsGenerator = this.credentialsGeneratorByType
        .get(request.getExternalService());
    if (credentialsGenerator == null) {
      return Mono.error(Status.INVALID_ARGUMENT.asException());
    }
    final AuthenticatedDevice authenticatedDevice = AuthenticationUtil.requireAuthenticatedDevice();
    return rateLimiters.forDescriptor(RateLimiters.For.EXTERNAL_SERVICE_CREDENTIALS).validateReactive(authenticatedDevice.accountIdentifier())
        .then(Mono.fromSupplier(() -> {
          final ExternalServiceCredentials externalServiceCredentials = credentialsGenerator
              .generateForUuid(authenticatedDevice.accountIdentifier());
          return GetExternalServiceCredentialsResponse.newBuilder()
              .setUsername(externalServiceCredentials.username())
              .setPassword(externalServiceCredentials.password())
              .build();
        }));
  }
@Test
  public void testUnauthenticatedCall() throws Exception {
    assertStatusUnauthenticated(() -> unauthenticatedServiceStub().getExternalServiceCredentials(
        GetExternalServiceCredentialsRequest.newBuilder()
            .setExternalService(ExternalServiceType.EXTERNAL_SERVICE_TYPE_ART)
            .build()));
  }