View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.fit.core.reference;
20  
21  import com.nimbusds.jose.JOSEException;
22  import org.apache.syncope.common.lib.SyncopeConstants;
23  import org.apache.syncope.core.logic.IdRepoLogicContext;
24  import org.apache.syncope.core.logic.TaskLogic;
25  import org.apache.syncope.core.logic.audit.AuditAppender;
26  import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
27  import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
28  import org.apache.syncope.core.persistence.api.dao.UserDAO;
29  import org.apache.syncope.core.persistence.api.entity.EntityFactory;
30  import org.apache.syncope.core.provisioning.api.ImplementationLookup;
31  import org.apache.syncope.core.spring.security.AuthDataAccessor;
32  import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
33  import org.springframework.boot.autoconfigure.AutoConfigureBefore;
34  import org.springframework.context.annotation.Bean;
35  import org.springframework.context.annotation.ComponentScan;
36  import org.springframework.context.annotation.Configuration;
37  import org.springframework.context.annotation.Lazy;
38  
39  @AutoConfigureBefore(IdRepoLogicContext.class)
40  @ComponentScan("org.apache.syncope.fit.core.reference")
41  @Configuration(proxyBeanMethods = false)
42  public class CoreReferenceContext {
43  
44      @Bean
45      public ElasticsearchInit elasticsearchInit(
46              final ImplementationDAO implementationDAO,
47              final EntityFactory entityFactory,
48              final TaskLogic taskLogic) {
49  
50          return new ElasticsearchInit(implementationDAO, entityFactory, taskLogic);
51      }
52  
53      @Bean
54      public OpenSearchInit openSearchInit(
55              final ImplementationDAO implementationDAO,
56              final EntityFactory entityFactory,
57              final TaskLogic taskLogic) {
58  
59          return new OpenSearchInit(implementationDAO, entityFactory, taskLogic);
60      }
61  
62      @Bean
63      public EnableFlowableForTestUsers enableFlowableForTestUsers(final UserDAO userDAO) {
64          return new EnableFlowableForTestUsers(userDAO);
65      }
66  
67      @Bean
68      public ImplementationLookup implementationLookup(
69              final UserWorkflowAdapter uwf,
70              final AnySearchDAO anySearchDAO,
71              final EnableFlowableForTestUsers enableFlowableForTestUsers,
72              final ElasticsearchInit elasticsearchInit,
73              final OpenSearchInit openSearchInit) {
74  
75          return new ITImplementationLookup(
76                  uwf, anySearchDAO, enableFlowableForTestUsers, elasticsearchInit, openSearchInit);
77      }
78  
79      @Bean
80      public AuditAppender testFileAuditAppender() {
81          return new TestFileAuditAppender(SyncopeConstants.MASTER_DOMAIN);
82      }
83  
84      @Bean
85      public AuditAppender testFileRewriteAuditAppender() {
86          return new TestFileRewriteAuditAppender(SyncopeConstants.MASTER_DOMAIN);
87      }
88  
89      @Bean
90      public CustomJWTSSOProvider customJWTSSOProvider(
91              final AnySearchDAO anySearchDAO,
92              final @Lazy AuthDataAccessor authDataAccessor) throws JOSEException {
93  
94          return new CustomJWTSSOProvider(anySearchDAO, authDataAccessor);
95      }
96  }