1
13693261870
2022-09-16 58d012f11dd34564d81b4eb3a6099eb689876597
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package org.apereo.cas.web.landtool.single.config;
 
import org.apereo.cas.CentralAuthenticationService;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.web.landtool.single.flow.UserAlreadyLoginedCheckAction;
import org.apereo.cas.web.landtool.single.listener.TGTCreateEventListener;
import org.apereo.cas.web.landtool.single.service.SingleLoginService;
import org.apereo.cas.web.landtool.single.service.UserIdObtainService;
import org.apereo.cas.web.landtool.single.service.impl.UserIdObtainServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.webflow.execution.Action;
 
/**
 * 单用户登录限制 配置
 * @author Tanbin
 * @date  2018-11-30
 */
@Configuration("SingleLoginConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class SingleLoginConfiguration {
    
    @Autowired
    private CentralAuthenticationService centralAuthenticationService;
 
    /**
     * 单用户限制登录服务
     */
    @Bean
    protected SingleLoginService singleLoginService() {
        return new SingleLoginService(centralAuthenticationService);
    }
    
    @Bean
    protected UserIdObtainService userIdObtainService() {
        return new UserIdObtainServiceImpl();
    }
 
    /**
     * 注册事件监听tgt的创建
     */
    @Bean
    protected TGTCreateEventListener tgtCreateEventListener() {
        return new TGTCreateEventListener();
    }
    
//    @Bean
//    @ConditionalOnMissingBean(name = "userAlreadyLoginedCheckAction")
//    public Action userAlreadyLoginedCheckAction() {
//        return new UserAlreadyLoginedCheckAction();
//    }
}