use of com.liferay.opensocial.model.OAuthConsumer in project liferay-ide by liferay.
the class LiferayOAuthStoreProvider method _getOAuthConsumer.
private OAuthConsumer _getOAuthConsumer(String keyFileName, String keyName) {
OAuthConsumer oAuthConsumer = new OAuthConsumerImpl();
oAuthConsumer.setConsumerKey(_DEFAULT_CONSUMER_KEY);
oAuthConsumer.setServiceName(_DEFAULT_SERVICE_NAME);
String consumerSecret = null;
String path = PropsUtil.get(PropsKeys.LIFERAY_HOME).concat(_KEY_DIR);
path = path.replaceAll(StringPool.QUOTE, StringPool.BLANK);
keyFileName = path.concat(keyFileName);
try {
consumerSecret = FileUtil.read(keyFileName);
} catch (Exception e) {
} finally {
if (consumerSecret == null) {
if (!FileUtil.exists(path)) {
FileUtil.mkdirs(path);
}
if (_log.isWarnEnabled()) {
_log.warn("Unable to load OAuth key from " + keyFileName);
}
return null;
}
}
consumerSecret = _convertFromOpenSsl(consumerSecret);
oAuthConsumer.setConsumerSecret(consumerSecret);
oAuthConsumer.setKeyType(OAuthConsumerConstants.KEY_TYPE_RSA_PRIVATE);
oAuthConsumer.setKeyName(keyName);
return oAuthConsumer;
}
use of com.liferay.opensocial.model.OAuthConsumer in project liferay-ide by liferay.
the class OAuthConsumerModelImpl method equals.
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof OAuthConsumer)) {
return false;
}
OAuthConsumer oAuthConsumer = (OAuthConsumer) obj;
long primaryKey = oAuthConsumer.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
} else {
return false;
}
}
Aggregations