com.github.lontime.extspring.components.Pac4jComponentExt Maven / Gradle / Ivy
package com.github.lontime.extspring.components;
import java.util.stream.Collectors;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import com.github.lontime.base.commonj.components.ComponentInterfaceHelper;
import com.github.lontime.extpac4j.Pac4jInstance;
import com.github.lontime.extpac4j.provider.AuthenticatorInterface;
import com.github.lontime.extpac4j.provider.ProfileStorageDecisionInterface;
import com.github.lontime.extpac4j.provider.SpringProvider;
/**
* QuartzComponentExt.
* @author lontime
* @since 1.0
*/
public class Pac4jComponentExt implements InitializingBean {
private ObjectProvider authProviders;
private ObjectProvider decisionProviders;
@Autowired
public void setAuthProviders(ObjectProvider authProviders) {
this.authProviders = authProviders;
}
@Autowired
public void setDecisionProviders(ObjectProvider decisionProviders) {
this.decisionProviders = decisionProviders;
}
@Override
public void afterPropertiesSet() {
ComponentInterfaceHelper.register(authProviders.stream()
.filter(s -> s.getClazz() == AuthenticatorInterface.class).collect(Collectors.toList()));
ComponentInterfaceHelper.register(decisionProviders.stream()
.filter(s -> s.getClazz() == ProfileStorageDecisionInterface.class).collect(Collectors.toList()));
Pac4jInstance.set(SpringProvider.create());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy