All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.casside.cas.support.DelegatedClientFactory Maven / Gradle / Ivy

The newest version!
package com.github.casside.cas.support;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.support.pac4j.authentication.DefaultDelegatedClientFactory;
import org.pac4j.core.client.IndirectClient;
import org.springframework.util.CollectionUtils;

/**
 * 重写 代理client工厂,添加企业微信Client
 */
@Slf4j
public class DelegatedClientFactory extends DefaultDelegatedClientFactory {

    /**
     * 注入自定义的 client
     */
    private List customClients = new ArrayList<>();

    public DelegatedClientFactory(CasConfigurationProperties casConfigurationProperties, List customClients) {
        super(casConfigurationProperties, Collections.emptyList());
        if (!CollectionUtils.isEmpty(customClients)) {
            this.customClients.addAll(customClients);
        }
    }

    @Override
    public Collection build() {
        Collection clients = super.build();
        clients.addAll(this.customClients);
        return clients;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy