com.liferay.oauth2.provider.internal.scheduler.OAuth2AuthorizationSchedulerJobConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.oauth2.provider.service
Show all versions of com.liferay.oauth2.provider.service
Liferay OAuth2 Provider Service
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.oauth2.provider.internal.scheduler;
import com.liferay.oauth2.provider.configuration.OAuth2ProviderConfiguration;
import com.liferay.oauth2.provider.service.OAuth2AuthorizationLocalService;
import com.liferay.petra.function.UnsafeRunnable;
import com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil;
import com.liferay.portal.kernel.scheduler.SchedulerJobConfiguration;
import com.liferay.portal.kernel.scheduler.TimeUnit;
import com.liferay.portal.kernel.scheduler.TriggerConfiguration;
import java.util.Map;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Marta Medio
*/
@Component(
configurationPid = "com.liferay.oauth2.provider.configuration.OAuth2ProviderConfiguration",
service = SchedulerJobConfiguration.class
)
public class OAuth2AuthorizationSchedulerJobConfiguration
implements SchedulerJobConfiguration {
@Override
public UnsafeRunnable getJobExecutorUnsafeRunnable() {
return _oAuth2AuthorizationLocalService::
deleteExpiredOAuth2Authorizations;
}
@Override
public TriggerConfiguration getTriggerConfiguration() {
return _triggerConfiguration;
}
@Activate
protected void activate(Map properties) {
OAuth2ProviderConfiguration oAuth2ProviderConfiguration =
ConfigurableUtil.createConfigurable(
OAuth2ProviderConfiguration.class, properties);
_triggerConfiguration = TriggerConfiguration.createTriggerConfiguration(
oAuth2ProviderConfiguration.expiredAuthorizationsCheckInterval(),
TimeUnit.MINUTE);
}
@Reference
private OAuth2AuthorizationLocalService _oAuth2AuthorizationLocalService;
private TriggerConfiguration _triggerConfiguration;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy