1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.core.logic;
20
21 import org.apache.syncope.core.logic.init.SAML2SP4UILoader;
22 import org.apache.syncope.core.logic.saml2.SAML2ClientCache;
23 import org.apache.syncope.core.logic.saml2.SAML2SP4UIUserManager;
24 import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
25 import org.apache.syncope.core.persistence.api.dao.SAML2SP4UIIdPDAO;
26 import org.apache.syncope.core.persistence.api.dao.UserDAO;
27 import org.apache.syncope.core.provisioning.api.IntAttrNameParser;
28 import org.apache.syncope.core.provisioning.api.UserProvisioningManager;
29 import org.apache.syncope.core.provisioning.api.data.AccessTokenDataBinder;
30 import org.apache.syncope.core.provisioning.api.data.SAML2SP4UIIdPDataBinder;
31 import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
32 import org.apache.syncope.core.provisioning.java.pushpull.InboundMatcher;
33 import org.apache.syncope.core.provisioning.java.utils.TemplateUtils;
34 import org.apache.syncope.core.spring.security.AuthDataAccessor;
35 import org.springframework.beans.factory.annotation.Qualifier;
36 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
37 import org.springframework.boot.context.properties.EnableConfigurationProperties;
38 import org.springframework.context.annotation.Bean;
39 import org.springframework.context.annotation.Configuration;
40 import org.springframework.core.io.support.ResourcePatternResolver;
41
42 @EnableConfigurationProperties(SAML2SP4UIProperties.class)
43 @Configuration(proxyBeanMethods = false)
44 public class SAML2SP4UILogicContext {
45
46 @ConditionalOnMissingBean(name = "saml2ClientCacheLogin")
47 @Bean
48 public SAML2ClientCache saml2ClientCacheLogin() {
49 return new SAML2ClientCache();
50 }
51
52 @ConditionalOnMissingBean(name = "saml2ClientCacheLogout")
53 @Bean
54 public SAML2ClientCache saml2ClientCacheLogout() {
55 return new SAML2ClientCache();
56 }
57
58 @ConditionalOnMissingBean
59 @Bean
60 public SAML2SP4UILoader saml2SP4UILoader() {
61 return new SAML2SP4UILoader();
62 }
63
64 @ConditionalOnMissingBean
65 @Bean
66 public SAML2SP4UIIdPLogic saml2SP4UIIdPLogic(
67 final SAML2SP4UIProperties props,
68 final ResourcePatternResolver resourceResolver,
69 @Qualifier("saml2ClientCacheLogin")
70 final SAML2ClientCache saml2ClientCacheLogin,
71 @Qualifier("saml2ClientCacheLogout")
72 final SAML2ClientCache saml2ClientCacheLogout,
73 final SAML2SP4UIIdPDataBinder binder,
74 final SAML2SP4UIIdPDAO idpDAO) {
75
76 return new SAML2SP4UIIdPLogic(
77 props,
78 resourceResolver,
79 saml2ClientCacheLogin,
80 saml2ClientCacheLogout,
81 binder,
82 idpDAO);
83 }
84
85 @ConditionalOnMissingBean
86 @Bean
87 public SAML2SP4UIUserManager saml2SP4UIUserManager(
88 final SAML2SP4UIIdPDAO idpDAO,
89 final InboundMatcher inboundMatcher,
90 final UserDAO userDAO,
91 final ImplementationDAO implementationDAO,
92 final IntAttrNameParser intAttrNameParser,
93 final TemplateUtils templateUtils,
94 final UserProvisioningManager provisioningManager,
95 final UserDataBinder binder) {
96
97 return new SAML2SP4UIUserManager(
98 idpDAO,
99 inboundMatcher,
100 userDAO,
101 implementationDAO,
102 intAttrNameParser,
103 templateUtils,
104 provisioningManager,
105 binder);
106 }
107
108 @ConditionalOnMissingBean
109 @Bean
110 public SAML2SP4UILogic saml2SP4UILogic(
111 final SAML2SP4UIProperties props,
112 final ResourcePatternResolver resourceResolver,
113 final AccessTokenDataBinder accessTokenDataBinder,
114 @Qualifier("saml2ClientCacheLogin")
115 final SAML2ClientCache saml2ClientCacheLogin,
116 @Qualifier("saml2ClientCacheLogout")
117 final SAML2ClientCache saml2ClientCacheLogout,
118 final SAML2SP4UIUserManager userManager,
119 final SAML2SP4UIIdPDAO idpDAO,
120 final AuthDataAccessor authDataAccessor) {
121
122 return new SAML2SP4UILogic(
123 props,
124 resourceResolver,
125 accessTokenDataBinder,
126 saml2ClientCacheLogin,
127 saml2ClientCacheLogout,
128 userManager,
129 idpDAO,
130 authDataAccessor);
131 }
132 }