public FutureData<ManagedSource> addAuth(String id, boolean validate, String... resources) {
        if (id == null || resources == null || resources.length == 0) {
            throw new IllegalArgumentException("ID and a resource is required");
        }
        FutureData<ManagedSource> future = new FutureData<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(ADD_AUTH));
        try {
            List<BaseSource.ResourceParams> list = new ArrayList<>();
            for (String val : resources) {
                BaseSource.ResourceParams params = new ManagedSource.ResourceParams();
                params.set("value", val);
                list.add(params);
            }
            POST request = config.http().POST(uri, new PageReader(newRequestCallback(future,
                    new ManagedSource(), config)))
                    .form("id", id)
                    .form("auth", DataSiftClient.MAPPER.writeValueAsString(list))
                    .form("validate", DataSiftClient.MAPPER.writeValueAsString(Arrays.asList(validate)));
            performRequest(future, request);
        } catch (JsonProcessingException jpe) {
            future.interuptCause(jpe);
            future.doNotify();
        }
        return future;
    }
public FutureData < ManagedSource > addAuth ( String id , boolean validate , String ... resources ) { if ( id == null || resources == null || resources . length == 0 ) { throw new IllegalArgumentException ( "ID and a resource is required" ) ; } FutureData < ManagedSource > future = new FutureData < > ( ) ; URI uri = newParams ( ) . forURL ( config . newAPIEndpointURI ( ADD_AUTH ) ) ; try { List < BaseSource . ResourceParams > list = new ArrayList < > ( ) ; for ( String val : resources ) { BaseSource . ResourceParams params = new ManagedSource . ResourceParams ( ) ; params . set ( "value" , val ) ; list . add ( params ) ; } POST request = config . http ( ) . POST ( uri , new PageReader ( newRequestCallback ( future , new ManagedSource ( ) , config ) ) ) . form ( "id" , id ) . form ( "auth" , DataSiftClient . MAPPER . writeValueAsString ( list ) ) . form ( "validate" , DataSiftClient . MAPPER . writeValueAsString ( Arrays . asList ( validate ) ) ) ; performRequest ( future , request ) ; } catch ( JsonProcessingException jpe ) { future . interuptCause ( jpe ) ; future . doNotify ( ) ; } return future ; }
/*
Add one or more authentication credentials to a given managed source

@param id        the ID of the source
@param validate  if true each token is validated
@param resources a set of tokens
@return the source