/** * @param conf configuration * @param supportsOAuth set true if the authorization instance required to be OAuth'ed * @return authorization instance * @deprecated use {@link #getInstance(twitter4j.conf.Configuration)} instead */ public static Authorization getInstance(Configuration conf, boolean supportsOAuth) { Authorization auth = null; String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret(); if (supportsOAuth && null != consumerKey && null != consumerSecret) { OAuthAuthorization oauth; oauth = new OAuthAuthorization(conf, consumerKey, consumerSecret); String accessToken = conf.getOAuthAccessToken(); String accessTokenSecret = conf.getOAuthAccessTokenSecret(); if (null != accessToken && null != accessTokenSecret) { oauth.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret)); } auth = oauth; } else { String screenName = conf.getUser(); String password = conf.getPassword(); if (null != screenName && null != password) { auth = new BasicAuthorization(screenName, password); } } if (null == auth) { auth = NullAuthorization.getInstance(); } return auth; }