/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.portal.security.sso.google.internal.verify;
import com.liferay.portal.kernel.service.CompanyLocalService;
import com.liferay.portal.kernel.settings.SettingsFactory;
import com.liferay.portal.kernel.util.HashMapDictionary;
import com.liferay.portal.kernel.util.PrefsProps;
import com.liferay.portal.kernel.util.SetUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.security.sso.google.constants.GoogleAuthorizationConfigurationKeys;
import com.liferay.portal.security.sso.google.constants.GoogleConstants;
import com.liferay.portal.security.sso.google.constants.LegacyGoogleLoginPropsKeys;
import com.liferay.portal.verify.BaseCompanySettingsVerifyProcess;
import com.liferay.portal.verify.VerifyProcess;
import java.util.Dictionary;
import java.util.Set;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Stian Sigvartsen
*/
@Component(
immediate = true,
property = {"verify.process.name=com.liferay.portal.security.sso.google"},
service = VerifyProcess.class
)
public class GoogleLoginCompanySettingsVerifyProcess
extends BaseCompanySettingsVerifyProcess {
@Override
protected CompanyLocalService getCompanyLocalService() {
return _companyLocalService;
}
@Override
protected Set<String> getLegacyPropertyKeys() {
return SetUtil.fromArray(LegacyGoogleLoginPropsKeys.GOOGLE_LOGIN_KEYS);
}
@Override
protected Dictionary<String, String> getPropertyValues(long companyId) {
Dictionary<String, String> dictionary = new HashMapDictionary<>();
dictionary.put(
GoogleAuthorizationConfigurationKeys.AUTH_ENABLED,
_prefsProps.getString(
companyId, LegacyGoogleLoginPropsKeys.AUTH_ENABLED,
StringPool.FALSE));
dictionary.put(
GoogleAuthorizationConfigurationKeys.CLIENT_ID,
_prefsProps.getString(
companyId, LegacyGoogleLoginPropsKeys.CLIENT_ID,
StringPool.BLANK));
dictionary.put(
GoogleAuthorizationConfigurationKeys.CLIENT_SECRET,
_prefsProps.getString(
companyId, LegacyGoogleLoginPropsKeys.CLIENT_SECRET,
StringPool.BLANK));
return dictionary;
}
@Override
protected SettingsFactory getSettingsFactory() {
return _settingsFactory;
}
@Override
protected String getSettingsId() {
return GoogleConstants.SERVICE_NAME;
}
@Reference
private CompanyLocalService _companyLocalService;
@Reference
private PrefsProps _prefsProps;
@Reference
private SettingsFactory _settingsFactory;
}