Test Failed
Pull Request — master (#3063)
by
unknown
16:18
created

pac4jProfileService()   B

Complexity

Conditions 5

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
dl 0
loc 19
c 3
b 0
f 0
cc 5
rs 8.5454

2 Methods

Rating   Name   Duplication   Size   Complexity  
read 0 3 ?
deleteById 0 2 ?
1
package org.apereo.cas.support.pac4j.config;
2
3
import java.util.List;
4
import java.util.Map;
5
6
import org.apereo.cas.CentralAuthenticationService;
7
import org.apereo.cas.authentication.AuthenticationSystemSupport;
8
import org.apereo.cas.configuration.CasConfigurationProperties;
9
import org.apereo.cas.support.pac4j.web.flow.DelegatedClientAuthenticationAction;
10
import org.pac4j.core.client.Clients;
11
import org.pac4j.core.profile.CommonProfile;
12
import org.pac4j.core.profile.service.AbstractProfileService;
13
import org.pac4j.core.profile.service.ProfileService;
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.beans.factory.annotation.Qualifier;
16
import org.springframework.boot.context.properties.EnableConfigurationProperties;
17
import org.springframework.cloud.context.config.annotation.RefreshScope;
18
import org.springframework.context.annotation.Bean;
19
import org.springframework.context.annotation.Configuration;
20
import org.springframework.context.annotation.Lazy;
21
import org.springframework.webflow.execution.Action;
22
23
/**
24
 * This is {@link Pac4jDelegatedAuthenticationConfiguration}.
25
 *
26
 * @author Misagh Moayyed
27
 * @since 5.0.0
28
 */
29
@Configuration("pac4jDelegatedAuthenticationConfiguration")
30
@EnableConfigurationProperties(CasConfigurationProperties.class)
31
public class Pac4jDelegatedAuthenticationConfiguration {
32
33
    @Autowired
34
    private CasConfigurationProperties casProperties;
35
    
36
    @Autowired
37
    @Qualifier("defaultAuthenticationSystemSupport")
38
    private AuthenticationSystemSupport authenticationSystemSupport;
39
40
    @Autowired
41
    @Qualifier("centralAuthenticationService")
42
    private CentralAuthenticationService centralAuthenticationService;
43
    
44
    @Autowired
45
    @RefreshScope
46
    @Bean
47
    @Lazy
48
    public Action clientAction(@Qualifier("builtClients") final Clients builtClients) {
49
        return new DelegatedClientAuthenticationAction(builtClients, 
50
                authenticationSystemSupport, 
51
                centralAuthenticationService, 
52
                casProperties.getTheme().getParamName(), 
53
                casProperties.getLocale().getParamName(), 
54
                casProperties.getAuthn().getPac4j().isAutoRedirect(),
55
                pac4jProfileService());
56
    }
57
58
59
    @Bean
60
    public ProfileService<CommonProfile> pac4jProfileService() {
61
        return new AbstractProfileService<CommonProfile>() {
62
63
            @Override
64
            protected void insert(final Map<String, Object> attributes) {
65
            }
66
67
            @Override
68
            protected void update(final Map<String, Object> attributes) {
69
            }
70
71
            @Override
72
            protected void deleteById(final String id) {
73
            }
74
75
            @Override
76
            protected List<Map<String, Object>> read(final List<String> names, final String key, final String value) {
77
                return null;
78
            }
79
        };
80
    }
81
82
}
83