Commit e99259e1fe2b85508a42f8364c39532ea3bb679f
0 parents
Exists in
master
enviando arquivos da branch de unificação tarefa-4005
Showing
36 changed files
with
2326 additions
and
0 deletions
Show diff stats
1 | +++ a/.gitignore | |
... | ... | @@ -0,0 +1,57 @@ |
1 | +*.class | |
2 | +*.jasper | |
3 | + | |
4 | +# Mobile Tools for Java (J2ME) | |
5 | +.mtj.tmp/ | |
6 | + | |
7 | +# Package Files # | |
8 | +*.jar | |
9 | +*.war | |
10 | +*.ear | |
11 | + | |
12 | +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | |
13 | +hs_err_pid* | |
14 | + | |
15 | +*.pydevproject | |
16 | +.metadata | |
17 | +.gradle | |
18 | +bin/ | |
19 | +tmp/ | |
20 | +*.tmp | |
21 | +*.bak | |
22 | +*.swp | |
23 | +*~.nib | |
24 | +local.properties | |
25 | +.settings/ | |
26 | +.loadpath | |
27 | + | |
28 | +# Eclipse Core | |
29 | +.project | |
30 | + | |
31 | +# External tool builders | |
32 | +.externalToolBuilders/ | |
33 | + | |
34 | +# Locally stored "Eclipse launch configurations" | |
35 | +*.launch | |
36 | + | |
37 | +# CDT-specific | |
38 | +.cproject | |
39 | + | |
40 | +# JDT-specific (Eclipse Java Development Tools) | |
41 | +.classpath | |
42 | + | |
43 | +# Java annotation processor (APT) | |
44 | +.factorypath | |
45 | + | |
46 | +# PDT-specific | |
47 | +.buildpath | |
48 | + | |
49 | +# sbteclipse plugin | |
50 | +.target | |
51 | + | |
52 | +# TeXlipse plugin | |
53 | +.texlipse | |
54 | + | |
55 | +# STS (Spring Tool Suite) | |
56 | +.springBeans | |
57 | +target | ... | ... |
1 | +++ a/cit-esi-listener-api/pom.xml | |
... | ... | @@ -0,0 +1,67 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- ******************************************************************************************************************** --> | |
3 | +<!-- * LICENCA*GPLv2 * --> | |
4 | +<!-- * Copyright [2011,2012,2013,2014,2015] da CentralIT Tecnologia da Informação Ltda (www.centralit.com.br) * --> | |
5 | +<!-- * * --> | |
6 | +<!-- * Este arquivo é parte do programa/software: Citsmart (www.citsmart.com.br) * --> | |
7 | +<!-- * * --> | |
8 | +<!-- * O Citsmart é um software livre; você pode redistribui-lo e/ou modificá-lo dentro dos termos da Licença * --> | |
9 | +<!-- * Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versção 2 da Licença. * --> | |
10 | +<!-- * * --> | |
11 | +<!-- * Este programa/software é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma * --> | |
12 | +<!-- * garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral * --> | |
13 | +<!-- * GNU/GPL em português para maiores detalhes. * --> | |
14 | +<!-- * * --> | |
15 | +<!-- * Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título 'LICENCA.txt', junto com este * --> | |
16 | +<!-- * programa/software, se não, acesse o Portal do Software Público Brasileiro no endereço www.softwarepublico.gov.br * --> | |
17 | +<!-- * ou escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,USA * --> | |
18 | +<!-- ******************************************************************************************************************** --> | |
19 | +<project | |
20 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | |
21 | + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
22 | + <modelVersion>4.0.0</modelVersion> | |
23 | + | |
24 | + <parent> | |
25 | + <groupId>br.com.centralit</groupId> | |
26 | + <artifactId>cit-esi-listener</artifactId> | |
27 | + <version>1.8.0-SNAPSHOT</version> | |
28 | + </parent> | |
29 | + | |
30 | + <artifactId>cit-esi-listener-api</artifactId> | |
31 | + <name>cit-esi-listener-api</name> | |
32 | + | |
33 | + <description>Este projeto contém as classes estruturais que são utilizadas pelo projeto cit-esi-listener-web.</description> | |
34 | + | |
35 | + <properties> | |
36 | + <findbugs.config.path>${project.parent.parent.parent.basedir}/filterfile.xml</findbugs.config.path> | |
37 | + <license.config.path>${project.parent.parent.basedir}/src/licensing</license.config.path> | |
38 | + <maven-antrun-plugin.phase>package</maven-antrun-plugin.phase> | |
39 | + </properties> | |
40 | + | |
41 | + <dependencies> | |
42 | + <dependency> | |
43 | + <groupId>br.com.centralit</groupId> | |
44 | + <artifactId>cit-core</artifactId> | |
45 | + <version>${project.version}</version> | |
46 | + </dependency> | |
47 | + <dependency> | |
48 | + <groupId>br.com.centralit</groupId> | |
49 | + <artifactId>cit-esi-api</artifactId> | |
50 | + <version>${project.version}</version> | |
51 | + </dependency> | |
52 | + | |
53 | + <dependency> | |
54 | + <groupId>org.apache.activemq</groupId> | |
55 | + <artifactId>activemq-all</artifactId> | |
56 | + </dependency> | |
57 | + <dependency> | |
58 | + <groupId>org.quartz-scheduler</groupId> | |
59 | + <artifactId>quartz</artifactId> | |
60 | + </dependency> | |
61 | + <dependency> | |
62 | + <groupId>org.quartz-scheduler</groupId> | |
63 | + <artifactId>quartz-jobs</artifactId> | |
64 | + </dependency> | |
65 | + </dependencies> | |
66 | + | |
67 | +</project> | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/message/RuntimeOutputMessage.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/message/RuntimeOutputMessage.java | |
... | ... | @@ -0,0 +1,25 @@ |
1 | +package br.com.centralit.esi.api.jms.message; | |
2 | + | |
3 | +import javax.jms.JMSException; | |
4 | +import javax.jms.Message; | |
5 | +import javax.jms.Session; | |
6 | + | |
7 | +import org.springframework.jms.support.converter.MessageConversionException; | |
8 | + | |
9 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
10 | + | |
11 | +public class RuntimeOutputMessage { | |
12 | + | |
13 | + private final RuntimeEnvironmentOutput output; | |
14 | + private RuntimeOutputMessageConverter messageConverter; | |
15 | + | |
16 | + public RuntimeOutputMessage(RuntimeEnvironmentOutput output, RuntimeOutputMessageConverter messageConverter) { | |
17 | + this.output = output; | |
18 | + this.messageConverter = messageConverter; | |
19 | + } | |
20 | + | |
21 | + public Message convertToMessage(Session session) throws MessageConversionException, JMSException { | |
22 | + return (this.messageConverter.toMessage(this.output, session)); | |
23 | + } | |
24 | + | |
25 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/message/RuntimeOutputMessageConverter.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/message/RuntimeOutputMessageConverter.java | |
... | ... | @@ -0,0 +1,47 @@ |
1 | +package br.com.centralit.esi.api.jms.message; | |
2 | + | |
3 | +import javax.jms.JMSException; | |
4 | +import javax.jms.Message; | |
5 | +import javax.jms.Session; | |
6 | +import javax.jms.TextMessage; | |
7 | + | |
8 | +import org.springframework.jms.support.converter.MessageConversionException; | |
9 | +import org.springframework.jms.support.converter.MessageConverter; | |
10 | + | |
11 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
12 | +import br.com.centralit.esi.api.util.ConvertUtilsESI; | |
13 | +import br.com.centralit.esi.api.util.XStreamTranslator; | |
14 | + | |
15 | +public class RuntimeOutputMessageConverter implements MessageConverter{ | |
16 | + | |
17 | + public Object fromMessage(Message message) throws JMSException,MessageConversionException { | |
18 | + if (message instanceof TextMessage) { | |
19 | + TextMessage textMessage = (TextMessage) message; | |
20 | + String text = textMessage.getText().trim(); | |
21 | + if (text.charAt(0) == '<') { | |
22 | + return (RuntimeEnvironmentOutput) XStreamTranslator.getInstance().toObject(text); | |
23 | + }else if (text.charAt(0) == '{') { | |
24 | + return (RuntimeEnvironmentOutput) ConvertUtilsESI.fromJson(text, RuntimeEnvironmentOutput.class); | |
25 | + }else { | |
26 | + throw new MessageConversionException("Formato inválido de mensagem"); | |
27 | + } | |
28 | + }else { | |
29 | + throw new MessageConversionException("Formato inválido de mensagem"); | |
30 | + } | |
31 | + } | |
32 | + | |
33 | + public Message toMessage(Object object, Session session) throws JMSException,MessageConversionException { | |
34 | + RuntimeEnvironmentOutput output = (RuntimeEnvironmentOutput) object; | |
35 | + RuntimeEnvironmentOutput auxOutput = new RuntimeEnvironmentOutput(); | |
36 | + if (output.getProcessInstance() != null) | |
37 | + auxOutput.setProcessInstanceId(output.getProcessInstance().getId()); | |
38 | + auxOutput.setOutputVariables(output.getOutputVariables()); | |
39 | + auxOutput.setSynchronous(output.isSynchronous()); | |
40 | + | |
41 | + String xml = XStreamTranslator.getInstance().toXMLString(auxOutput); | |
42 | + TextMessage message = session.createTextMessage(xml); | |
43 | + | |
44 | + return message; | |
45 | + } | |
46 | + | |
47 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/service/RuntimeOutputProducer.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/service/RuntimeOutputProducer.java | |
... | ... | @@ -0,0 +1,9 @@ |
1 | +package br.com.centralit.esi.api.jms.service; | |
2 | + | |
3 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
4 | + | |
5 | +public interface RuntimeOutputProducer { | |
6 | + | |
7 | + public void send(final RuntimeEnvironmentOutput output, final String correlationId); | |
8 | + | |
9 | +} | |
0 | 10 | \ No newline at end of file | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/service/impl/RuntimeOutputProducerImpl.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/jms/service/impl/RuntimeOutputProducerImpl.java | |
... | ... | @@ -0,0 +1,50 @@ |
1 | +package br.com.centralit.esi.api.jms.service.impl; | |
2 | + | |
3 | +import javax.jms.JMSException; | |
4 | +import javax.jms.Message; | |
5 | +import javax.jms.Session; | |
6 | + | |
7 | +import org.springframework.beans.factory.InitializingBean; | |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.beans.factory.annotation.Qualifier; | |
10 | +import org.springframework.jms.core.JmsTemplate; | |
11 | +import org.springframework.jms.core.MessageCreator; | |
12 | +import org.springframework.stereotype.Service; | |
13 | +import org.springframework.util.Assert; | |
14 | + | |
15 | +import br.com.centralit.esi.api.jms.message.RuntimeOutputMessage; | |
16 | +import br.com.centralit.esi.api.jms.message.RuntimeOutputMessageConverter; | |
17 | +import br.com.centralit.esi.api.jms.service.RuntimeOutputProducer; | |
18 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
19 | + | |
20 | +@Service("runtimeOutputProducerService") | |
21 | +public class RuntimeOutputProducerImpl implements InitializingBean, RuntimeOutputProducer { | |
22 | + | |
23 | + @Autowired | |
24 | + @Qualifier("runtimeOutputProducer") | |
25 | + private JmsTemplate jmsTemplate; | |
26 | + | |
27 | + @Autowired | |
28 | + private RuntimeOutputMessageConverter messageConverter; | |
29 | + | |
30 | + @Override | |
31 | + public void send(final RuntimeEnvironmentOutput output, final String correlationId) { | |
32 | + this.jmsTemplate.send(new MessageCreator() { | |
33 | + @Override | |
34 | + public Message createMessage(Session session) throws JMSException { | |
35 | + Message message = new RuntimeOutputMessage(output, messageConverter).convertToMessage(session); | |
36 | + message.setJMSCorrelationID(correlationId); | |
37 | + return message; | |
38 | + } | |
39 | + }); | |
40 | + } | |
41 | + | |
42 | + protected final JmsTemplate getJmsTemplate() { | |
43 | + return (this.jmsTemplate); | |
44 | + } | |
45 | + | |
46 | + @Override | |
47 | + public void afterPropertiesSet() throws Exception { | |
48 | + Assert.notNull(this.jmsTemplate, "JmsTemplate instance can not be null. See the Spring configuration file context."); | |
49 | + } | |
50 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/router/service/RouterService.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/router/service/RouterService.java | |
... | ... | @@ -0,0 +1,34 @@ |
1 | +package br.com.centralit.esi.api.router.service; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentInput; | |
6 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
7 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
8 | + | |
9 | + | |
10 | +public interface RouterService { | |
11 | + | |
12 | + void processJob(RuntimeEnvironmentInput input); | |
13 | + | |
14 | + RuntimeEnvironmentOutput signalEvent(SignalEventInput input); | |
15 | + | |
16 | + RuntimeEnvironmentOutput completeTask(RuntimeEnvironmentInput runtimeEnvironment); | |
17 | + | |
18 | + List<Object> execute(String flowName, String[] response, String[] variables); | |
19 | + | |
20 | + RuntimeEnvironmentOutput start(RuntimeEnvironmentInput input); | |
21 | + | |
22 | + RuntimeEnvironmentOutput captureTask(RuntimeEnvironmentInput input); | |
23 | + | |
24 | + RuntimeEnvironmentOutput delegateUserTask(RuntimeEnvironmentInput input); | |
25 | + | |
26 | + RuntimeEnvironmentOutput removeUserTaskDelegation(RuntimeEnvironmentInput input); | |
27 | + | |
28 | + RuntimeEnvironmentOutput suspendProcessInstance(RuntimeEnvironmentInput input); | |
29 | + | |
30 | + RuntimeEnvironmentOutput restartProcessInstance(RuntimeEnvironmentInput input); | |
31 | + | |
32 | + RuntimeEnvironmentOutput reopenProcessInstance(RuntimeEnvironmentInput input); | |
33 | + | |
34 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/router/service/impl/RouterServiceImpl.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/router/service/impl/RouterServiceImpl.java | |
... | ... | @@ -0,0 +1,153 @@ |
1 | +package br.com.centralit.esi.api.router.service.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | +import br.com.centralit.esi.api.business.model.BusinessProcessInstance; | |
9 | +import br.com.centralit.esi.api.business.service.BusinessProcessManager; | |
10 | +import br.com.centralit.esi.api.design.model.FlowVersion; | |
11 | +import br.com.centralit.esi.api.enumerated.RuntimeActionEnum; | |
12 | +import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
13 | +import br.com.centralit.esi.api.execution.service.ProcessInstanceService; | |
14 | +import br.com.centralit.esi.api.jms.service.RuntimeOutputProducer; | |
15 | +import br.com.centralit.esi.api.log.service.RuntimeLogService; | |
16 | +import br.com.centralit.esi.api.router.service.RouterService; | |
17 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentInput; | |
18 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
19 | +import br.com.centralit.esi.api.runtime.service.RuntimeManager; | |
20 | +import br.com.centralit.esi.api.runtime.service.RuntimeManagerBase; | |
21 | +import br.com.centralit.esi.api.security.service.SecurityService; | |
22 | +import br.com.centralit.esi.api.signal.service.SignalEventProducer; | |
23 | +import br.com.centralit.esi.api.util.EsiAppUtils; | |
24 | +import br.com.centralit.esi.exception.EsiControlledException; | |
25 | +import br.com.centralit.framework.esi.environment.EnvironmentInput; | |
26 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
27 | + | |
28 | +@Service("routerService") | |
29 | +public class RouterServiceImpl implements RouterService { | |
30 | + | |
31 | + @Autowired | |
32 | + private RuntimeManager runtimeManager; | |
33 | + | |
34 | + @Autowired | |
35 | + private BusinessProcessManager businessProcessManager; | |
36 | + | |
37 | + @Autowired | |
38 | + private SignalEventProducer signalEventProducer; | |
39 | + | |
40 | + @Autowired | |
41 | + private RuntimeOutputProducer runtimeOutputProducer; | |
42 | + | |
43 | + @Autowired | |
44 | + protected RuntimeLogService runtimeLogService; | |
45 | + | |
46 | + @Autowired | |
47 | + protected SecurityService securityService; | |
48 | + | |
49 | + @Autowired | |
50 | + private ProcessInstanceService processInstanceService; | |
51 | + | |
52 | + private RuntimeManagerBase getRuntimeManager(EnvironmentInput input) { | |
53 | + if (input.getProcessInstanceId() != null) { | |
54 | + ProcessInstance processInstance = (ProcessInstance) EsiAppUtils.getUnproxyModel(processInstanceService.find(input.getProcessInstanceId())); | |
55 | + if (processInstance != null && processInstance.hasBusinessProcess()) { | |
56 | + input.setBusinessProcessId(((BusinessProcessInstance) processInstance).getBusinessProcess().getId()); | |
57 | + input.setBusinessProcessName(((BusinessProcessInstance) processInstance).getBusinessProcess().getName()); | |
58 | + return businessProcessManager; | |
59 | + }else{ | |
60 | + return runtimeManager; | |
61 | + } | |
62 | + }else{ | |
63 | + return input.getBusinessProcessId() != null ? businessProcessManager : runtimeManager; | |
64 | + } | |
65 | + } | |
66 | + | |
67 | + protected void solveException(RuntimeActionEnum action, Throwable exception, EnvironmentInput runtimeEnvironmentInput, FlowVersion flowVersion, ProcessInstance processInstance) { | |
68 | + exception.printStackTrace(); | |
69 | + if (!(exception instanceof EsiControlledException) || processInstance == null) { | |
70 | + runtimeLogService.create(action, exception, securityService.getAuthenticatedUser(), runtimeEnvironmentInput, flowVersion, processInstance); | |
71 | + throw new EsiControlledException(exception); | |
72 | + }else if (exception instanceof RuntimeException) { | |
73 | + throw (RuntimeException) exception; | |
74 | + }else{ | |
75 | + throw new EsiControlledException(exception); | |
76 | + } | |
77 | + } | |
78 | + | |
79 | + @Override | |
80 | + public void processJob(RuntimeEnvironmentInput input) { | |
81 | + RuntimeEnvironmentOutput output = null; | |
82 | + if (input.getWorkItemId() != null) { | |
83 | + output = this.getRuntimeManager(input).executeWorkItem(input, null); | |
84 | + }else{ | |
85 | + output = this.getRuntimeManager(input).start(input); | |
86 | + } | |
87 | + | |
88 | + if (input.isSignal()) { | |
89 | + ProcessInstance processInstance = output.getProcessInstance(); | |
90 | + FlowVersion flowVersion = processInstance != null ? processInstance.getFlowVersion() : null; | |
91 | + try { | |
92 | + runtimeOutputProducer.send(output, input.getCorrelationId()); | |
93 | + } catch (Exception e) { | |
94 | + solveException(RuntimeActionEnum.PROCESS_JOB, e, input, flowVersion, processInstance); | |
95 | + } | |
96 | + } | |
97 | + } | |
98 | + | |
99 | + @Override | |
100 | + public RuntimeEnvironmentOutput signalEvent(SignalEventInput input) { | |
101 | + RuntimeEnvironmentOutput output = null; | |
102 | + try { | |
103 | + output = signalEventProducer.send(input); | |
104 | + } catch (Exception e) { | |
105 | + solveException(RuntimeActionEnum.SIGNAL_EVENT, e, input, null, null); | |
106 | + } | |
107 | + return output; | |
108 | + } | |
109 | + | |
110 | + @Override | |
111 | + public RuntimeEnvironmentOutput completeTask(RuntimeEnvironmentInput input) { | |
112 | + return this.getRuntimeManager(input).completeTask(input); | |
113 | + } | |
114 | + | |
115 | + @Override | |
116 | + public RuntimeEnvironmentOutput start(RuntimeEnvironmentInput input) { | |
117 | + return this.getRuntimeManager(input).start(input); | |
118 | + } | |
119 | + | |
120 | + @Override | |
121 | + public List<Object> execute(String flowName, String[] response, String[] variables) { | |
122 | + return runtimeManager.execute(flowName, response, variables); | |
123 | + } | |
124 | + | |
125 | + @Override | |
126 | + public RuntimeEnvironmentOutput captureTask(RuntimeEnvironmentInput input) { | |
127 | + return this.getRuntimeManager(input).captureTask(input); | |
128 | + } | |
129 | + | |
130 | + @Override | |
131 | + public RuntimeEnvironmentOutput delegateUserTask(RuntimeEnvironmentInput input) { | |
132 | + return this.getRuntimeManager(input).delegateUserTask(input); } | |
133 | + | |
134 | + @Override | |
135 | + public RuntimeEnvironmentOutput removeUserTaskDelegation(RuntimeEnvironmentInput input) { | |
136 | + return this.getRuntimeManager(input).removeUserTaskDelegation(input); | |
137 | + } | |
138 | + | |
139 | + @Override | |
140 | + public RuntimeEnvironmentOutput suspendProcessInstance(RuntimeEnvironmentInput input) { | |
141 | + return this.getRuntimeManager(input).suspendProcessInstance(input); | |
142 | + } | |
143 | + | |
144 | + @Override | |
145 | + public RuntimeEnvironmentOutput restartProcessInstance(RuntimeEnvironmentInput input) { | |
146 | + return this.getRuntimeManager(input).restartProcessInstance(input); | |
147 | + } | |
148 | + | |
149 | + @Override | |
150 | + public RuntimeEnvironmentOutput reopenProcessInstance(RuntimeEnvironmentInput input) { | |
151 | + return this.getRuntimeManager(input).reopenProcessInstance(input); | |
152 | + } | |
153 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/scheduler/EventScheduler.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/scheduler/EventScheduler.java | |
... | ... | @@ -0,0 +1,170 @@ |
1 | +package br.com.centralit.esi.api.scheduler; | |
2 | + | |
3 | +import java.util.List; | |
4 | +import java.util.UUID; | |
5 | + | |
6 | +import org.quartz.CronScheduleBuilder; | |
7 | +import org.quartz.CronTrigger; | |
8 | +import org.quartz.JobBuilder; | |
9 | +import org.quartz.JobDataMap; | |
10 | +import org.quartz.JobDetail; | |
11 | +import org.quartz.JobKey; | |
12 | +import org.quartz.Scheduler; | |
13 | +import org.quartz.SchedulerException; | |
14 | +import org.quartz.SchedulerFactory; | |
15 | +import org.quartz.Trigger; | |
16 | +import org.quartz.TriggerBuilder; | |
17 | +import org.quartz.impl.StdSchedulerFactory; | |
18 | +import org.springframework.beans.factory.annotation.Autowired; | |
19 | + | |
20 | +import br.com.centralit.esi.api.design.model.event.SignalEvent; | |
21 | +import br.com.centralit.esi.api.router.service.RouterService; | |
22 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentInput; | |
23 | +import br.com.centralit.esi.api.scheduler.job.RuntimeJob; | |
24 | +import br.com.centralit.esi.api.scheduler.model.EventJob; | |
25 | +import br.com.centralit.esi.api.scheduler.service.EventJobService; | |
26 | +import br.com.centralit.esi.exception.EsiExecutionException; | |
27 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
28 | + | |
29 | + | |
30 | +public class EventScheduler { | |
31 | + | |
32 | + public final String GROUP_NAME = "EsiTimerEventGoup"; | |
33 | + | |
34 | + private Scheduler schedule = null; | |
35 | + | |
36 | + private RouterService routerService; | |
37 | + | |
38 | + private EventJobService eventJobService; | |
39 | + | |
40 | + @Autowired | |
41 | + private EventScheduler(RouterService routerService, EventJobService eventJobService) { | |
42 | + this.routerService = routerService; | |
43 | + this.eventJobService = eventJobService; | |
44 | + } | |
45 | + | |
46 | + public void initialize() { | |
47 | + try { | |
48 | + SchedulerFactory sf = new StdSchedulerFactory(); | |
49 | + schedule = sf.getScheduler(); | |
50 | + schedule.start(); | |
51 | + | |
52 | + this.retrieveJobs(); | |
53 | + } catch (SchedulerException e) { | |
54 | + e.printStackTrace(); | |
55 | + throw new EsiExecutionException(e); | |
56 | + } | |
57 | + } | |
58 | + | |
59 | + private void retrieveJobs() { | |
60 | + List<EventJob> jobs = eventJobService.findAll(); | |
61 | + for (EventJob eventJob : jobs) { | |
62 | + if (eventJob.isActive()) { | |
63 | + this.schedulerTimerEvent(eventJob); | |
64 | + } | |
65 | + } | |
66 | + } | |
67 | + | |
68 | + private void deleteJob(JobKey jobKey) { | |
69 | + try { | |
70 | + this.schedule.deleteJob(jobKey); | |
71 | + } catch (SchedulerException e) { | |
72 | + e.printStackTrace(); | |
73 | + throw new EsiExecutionException(e); | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + private void buildJobDataMap(JobDetail job, RuntimeEnvironmentInput input) { | |
78 | + JobDataMap data = job.getJobDataMap(); | |
79 | + data.put("runtimeManager", routerService); | |
80 | + data.put("environmentInput", input); | |
81 | + } | |
82 | + | |
83 | + private void schedulerTimerJob(JobDetail job, String cronExpression) { | |
84 | + try { | |
85 | + CronTrigger cronTrigger = TriggerBuilder.newTrigger() | |
86 | + .withIdentity("CronTrigger_"+job.getKey().getName(), GROUP_NAME) | |
87 | + .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)) | |
88 | + .build(); | |
89 | + | |
90 | + this.schedule.scheduleJob(job, cronTrigger); | |
91 | + } catch (SchedulerException e) { | |
92 | + e.printStackTrace(); | |
93 | + throw new EsiExecutionException(e); | |
94 | + } | |
95 | + } | |
96 | + | |
97 | + private void schedulerImmediateTimerJob(JobDetail job) { | |
98 | + Trigger trigger = TriggerBuilder.newTrigger() | |
99 | + .withIdentity("Trigger_"+job.getKey().getName(), GROUP_NAME) | |
100 | + .startNow() | |
101 | + .build(); | |
102 | + | |
103 | + try { | |
104 | + this.schedule.scheduleJob(job, trigger); | |
105 | + } catch (SchedulerException e) { | |
106 | + e.printStackTrace(); | |
107 | + throw new EsiExecutionException(e); | |
108 | + } | |
109 | + } | |
110 | + | |
111 | + private void schedulerTimerEvent(EventJob eventJob) { | |
112 | + String jobName = eventJob.getName(); | |
113 | + String cronExpression = eventJob.getCronExpression(); | |
114 | + RuntimeEnvironmentInput input = eventJob.getEnvironmentInput(); | |
115 | + | |
116 | + JobDetail job = createJobDetail(jobName); | |
117 | + | |
118 | + this.buildJobDataMap(job, input); | |
119 | + this.deleteJob(job.getKey()); | |
120 | + if (input.isSignal()) { | |
121 | + this.schedulerImmediateTimerJob(job); | |
122 | + }else{ | |
123 | + this.schedulerTimerJob(job, cronExpression); | |
124 | + } | |
125 | + } | |
126 | + | |
127 | + private JobDetail createJobDetail(String jobName) { | |
128 | + return JobBuilder.newJob(RuntimeJob.class) | |
129 | + .withIdentity(jobName, GROUP_NAME) | |
130 | + .build(); | |
131 | + } | |
132 | + | |
133 | + public void schedulerSignalEvent(SignalEvent signalEvent, SignalEventInput signalEventInput, String correlationId, Long workItemId) { | |
134 | + RuntimeEnvironmentInput input = new RuntimeEnvironmentInput( | |
135 | + signalEvent.getFlowVersion().getFlow().getName() | |
136 | + , workItemId | |
137 | + , signalEvent.getName() | |
138 | + , signalEventInput.getBusinessProcessId() | |
139 | + , signalEventInput.getCorrelationId() | |
140 | + , true | |
141 | + , signalEventInput.isSynchronous() | |
142 | + , true | |
143 | + , signalEventInput.getUsername() | |
144 | + , true); | |
145 | + | |
146 | + | |
147 | + String jobName = "SignalEvent#"+UUID.randomUUID().toString(); | |
148 | + input.setInputVariables(signalEventInput.getInputVariables()); | |
149 | + input.setUuid(signalEventInput.getUuid()); | |
150 | + | |
151 | + this.schedule(jobName, null, input); | |
152 | + } | |
153 | + | |
154 | + public void schedule(String jobName, String cronExpression, RuntimeEnvironmentInput input) { | |
155 | + JobDetail job = createJobDetail(jobName); | |
156 | + | |
157 | + this.buildJobDataMap(job, input); | |
158 | + this.deleteJob(job.getKey()); | |
159 | + if (input.isSignal()) { | |
160 | + this.schedulerImmediateTimerJob(job); | |
161 | + }else{ | |
162 | + this.schedulerTimerJob(job, cronExpression); | |
163 | + } | |
164 | + } | |
165 | + | |
166 | + public void removeSchedule(String jobName) { | |
167 | + this.deleteJob(new JobKey(jobName, GROUP_NAME)); | |
168 | + } | |
169 | + | |
170 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/scheduler/job/RuntimeJob.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/scheduler/job/RuntimeJob.java | |
... | ... | @@ -0,0 +1,24 @@ |
1 | +package br.com.centralit.esi.api.scheduler.job; | |
2 | + | |
3 | +import org.quartz.DisallowConcurrentExecution; | |
4 | +import org.quartz.Job; | |
5 | +import org.quartz.JobDataMap; | |
6 | +import org.quartz.JobExecutionContext; | |
7 | +import org.quartz.JobExecutionException; | |
8 | + | |
9 | +import br.com.centralit.esi.api.router.service.RouterService; | |
10 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentInput; | |
11 | + | |
12 | +@DisallowConcurrentExecution | |
13 | +public class RuntimeJob implements Job { | |
14 | + | |
15 | + @Override | |
16 | + public void execute(JobExecutionContext context) throws JobExecutionException { | |
17 | + JobDataMap data = context.getJobDetail().getJobDataMap(); | |
18 | + RouterService runtimeManager = (RouterService) data.get("runtimeManager"); | |
19 | + RuntimeEnvironmentInput input = (RuntimeEnvironmentInput) data.get("environmentInput"); | |
20 | + | |
21 | + runtimeManager.processJob(input); | |
22 | + } | |
23 | + | |
24 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/consumer/SignalEventConsumer.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/consumer/SignalEventConsumer.java | |
... | ... | @@ -0,0 +1,37 @@ |
1 | +package br.com.centralit.esi.api.signal.consumer; | |
2 | + | |
3 | +import javax.jms.JMSException; | |
4 | +import javax.jms.Message; | |
5 | +import javax.jms.MessageListener; | |
6 | + | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.jms.support.converter.MessageConversionException; | |
9 | + | |
10 | +import br.com.centralit.esi.api.signal.message.SignalEventMessageConverter; | |
11 | +import br.com.centralit.esi.api.signal.service.SignalEventService; | |
12 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
13 | + | |
14 | +public class SignalEventConsumer implements MessageListener { | |
15 | + | |
16 | + @Autowired | |
17 | + private SignalEventService signalEventService; | |
18 | + | |
19 | + @Autowired | |
20 | + private SignalEventMessageConverter messageConverter; | |
21 | + | |
22 | + @Override | |
23 | + public void onMessage(Message message) { | |
24 | + try { | |
25 | + Object obj = messageConverter.fromMessage(message); | |
26 | + if (obj instanceof SignalEventInput) { | |
27 | + SignalEventInput input = (SignalEventInput) obj; | |
28 | + signalEventService.receive(input, message); | |
29 | + } | |
30 | + } catch (MessageConversionException e) { | |
31 | + e.printStackTrace(); | |
32 | + } catch (JMSException e) { | |
33 | + e.printStackTrace(); | |
34 | + } | |
35 | + } | |
36 | + | |
37 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/message/SignalEventMessage.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/message/SignalEventMessage.java | |
... | ... | @@ -0,0 +1,25 @@ |
1 | +package br.com.centralit.esi.api.signal.message; | |
2 | + | |
3 | +import javax.jms.JMSException; | |
4 | +import javax.jms.Message; | |
5 | +import javax.jms.Session; | |
6 | + | |
7 | +import org.springframework.jms.support.converter.MessageConversionException; | |
8 | + | |
9 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
10 | + | |
11 | +public class SignalEventMessage { | |
12 | + | |
13 | + private final SignalEventInput input; | |
14 | + private SignalEventMessageConverter messageConverter; | |
15 | + | |
16 | + public SignalEventMessage(SignalEventInput input, SignalEventMessageConverter messageConverter) { | |
17 | + this.input = input; | |
18 | + this.messageConverter = messageConverter; | |
19 | + } | |
20 | + | |
21 | + public Message convertToMessage(Session session) throws MessageConversionException, JMSException { | |
22 | + return (this.messageConverter.toMessage(this.input, session)); | |
23 | + } | |
24 | + | |
25 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/message/SignalEventMessageConverter.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/message/SignalEventMessageConverter.java | |
... | ... | @@ -0,0 +1,58 @@ |
1 | +package br.com.centralit.esi.api.signal.message; | |
2 | + | |
3 | +import javax.jms.JMSException; | |
4 | +import javax.jms.MapMessage; | |
5 | +import javax.jms.Message; | |
6 | +import javax.jms.Session; | |
7 | +import javax.jms.TextMessage; | |
8 | + | |
9 | +import org.springframework.jms.support.converter.MessageConversionException; | |
10 | +import org.springframework.jms.support.converter.MessageConverter; | |
11 | + | |
12 | +import br.com.centralit.esi.api.util.ConvertUtilsESI; | |
13 | +import br.com.centralit.esi.api.util.XStreamTranslator; | |
14 | +import br.com.centralit.framework.esi.enumerated.EventTargetEnum; | |
15 | +import br.com.centralit.framework.esi.environment.EnvironmentVariable; | |
16 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
17 | + | |
18 | +import com.thoughtworks.xstream.XStream; | |
19 | + | |
20 | +public class SignalEventMessageConverter implements MessageConverter{ | |
21 | + | |
22 | + private XStream xstream = new XStream(); | |
23 | + | |
24 | + public Object fromMessage(Message message) throws JMSException,MessageConversionException { | |
25 | + if (message instanceof MapMessage) { | |
26 | + MapMessage mapMessage = (MapMessage) message; | |
27 | + return new SignalEventInput() | |
28 | + .setEventTarget(EventTargetEnum.values()[mapMessage.getInt("eventTarget")]) | |
29 | + .setEventName(mapMessage.getString("eventName")) | |
30 | + .setFlowName(mapMessage.getString("flowName")) | |
31 | + .setProcessInstanceId(mapMessage.getLong("processInstanceId")); | |
32 | + }else if (message instanceof TextMessage) { | |
33 | + TextMessage textMessage = (TextMessage) message; | |
34 | + String text = textMessage.getText().trim(); | |
35 | + if (text.charAt(0) == '<') { | |
36 | + xstream.alias("signalEventInput", SignalEventInput.class); | |
37 | + xstream.alias("environmentVariable", EnvironmentVariable.class); | |
38 | + | |
39 | + return (SignalEventInput) xstream.fromXML(text); | |
40 | + }else if (text.charAt(0) == '{') { | |
41 | + return (SignalEventInput) ConvertUtilsESI.fromJson(text, SignalEventInput.class); | |
42 | + }else { | |
43 | + throw new MessageConversionException("Formato inválido de mensagem"); | |
44 | + } | |
45 | + }else { | |
46 | + throw new MessageConversionException("Formato inválido de mensagem"); | |
47 | + } | |
48 | + } | |
49 | + | |
50 | + public Message toMessage(Object object, Session session) throws JMSException,MessageConversionException { | |
51 | + SignalEventInput input = (SignalEventInput) object; | |
52 | + String xml = XStreamTranslator.getInstance().toXMLString(input); | |
53 | + TextMessage message = session.createTextMessage(xml); | |
54 | + | |
55 | + return message; | |
56 | + } | |
57 | + | |
58 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/SignalEventProducer.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/SignalEventProducer.java | |
... | ... | @@ -0,0 +1,10 @@ |
1 | +package br.com.centralit.esi.api.signal.service; | |
2 | + | |
3 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
4 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
5 | + | |
6 | +public interface SignalEventProducer { | |
7 | + | |
8 | + public RuntimeEnvironmentOutput send(final SignalEventInput input); | |
9 | + | |
10 | +} | |
0 | 11 | \ No newline at end of file | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/SignalEventService.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/SignalEventService.java | |
... | ... | @@ -0,0 +1,10 @@ |
1 | +package br.com.centralit.esi.api.signal.service; | |
2 | + | |
3 | +import javax.jms.Message; | |
4 | + | |
5 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
6 | + | |
7 | + | |
8 | +public interface SignalEventService { | |
9 | + public void receive(SignalEventInput input, Message message); | |
10 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/impl/SignalEventProducerImpl.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/impl/SignalEventProducerImpl.java | |
... | ... | @@ -0,0 +1,135 @@ |
1 | +package br.com.centralit.esi.api.signal.service.impl; | |
2 | + | |
3 | +import java.util.UUID; | |
4 | + | |
5 | +import javax.jms.Connection; | |
6 | +import javax.jms.ConnectionFactory; | |
7 | +import javax.jms.Destination; | |
8 | +import javax.jms.JMSException; | |
9 | +import javax.jms.Message; | |
10 | +import javax.jms.MessageConsumer; | |
11 | +import javax.jms.MessageProducer; | |
12 | +import javax.jms.Session; | |
13 | +import javax.jms.TextMessage; | |
14 | + | |
15 | +import org.springframework.beans.factory.InitializingBean; | |
16 | +import org.springframework.beans.factory.annotation.Autowired; | |
17 | +import org.springframework.beans.factory.annotation.Qualifier; | |
18 | +import org.springframework.jms.core.JmsTemplate; | |
19 | +import org.springframework.jms.core.MessageCreator; | |
20 | +import org.springframework.stereotype.Service; | |
21 | +import org.springframework.util.Assert; | |
22 | + | |
23 | +import br.com.centralit.esi.api.jms.message.RuntimeOutputMessageConverter; | |
24 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; | |
25 | +import br.com.centralit.esi.api.signal.message.SignalEventMessage; | |
26 | +import br.com.centralit.esi.api.signal.message.SignalEventMessageConverter; | |
27 | +import br.com.centralit.esi.api.signal.service.SignalEventProducer; | |
28 | +import br.com.centralit.esi.exception.RuntimeManagerException; | |
29 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
30 | + | |
31 | + | |
32 | +@Service("signalEventProducerService") | |
33 | +public class SignalEventProducerImpl implements InitializingBean, SignalEventProducer { | |
34 | + | |
35 | + @Autowired | |
36 | + @Qualifier("signalEventProducer") | |
37 | + private JmsTemplate jmsTemplate; | |
38 | + | |
39 | + @Autowired | |
40 | + @Qualifier("runtimeOutputProducer") | |
41 | + private JmsTemplate jmsOutputTemplate; | |
42 | + | |
43 | + @Autowired | |
44 | + private SignalEventMessageConverter messageConverter; | |
45 | + | |
46 | + @Autowired | |
47 | + private RuntimeOutputMessageConverter outputMessageConverter; | |
48 | + | |
49 | + @Override | |
50 | + public RuntimeEnvironmentOutput send(final SignalEventInput input) { | |
51 | + if (input.isSynchronous()) { | |
52 | + return sendSynchronous(input); | |
53 | + }else{ | |
54 | + this.jmsTemplate.send(new MessageCreator() { | |
55 | + @Override | |
56 | + public Message createMessage(Session session) throws JMSException { | |
57 | + return new SignalEventMessage(input, messageConverter).convertToMessage(session); | |
58 | + } | |
59 | + }); | |
60 | + return new RuntimeEnvironmentOutput(); | |
61 | + } | |
62 | + } | |
63 | + | |
64 | + public RuntimeEnvironmentOutput sendSynchronous(SignalEventInput input) { | |
65 | + Destination replyQueue = this.jmsOutputTemplate.getDefaultDestination(); | |
66 | + ConnectionFactory connectionFactory = this.jmsTemplate.getConnectionFactory(); | |
67 | + | |
68 | + try { | |
69 | + Connection connection = connectionFactory.createConnection(); | |
70 | + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); | |
71 | + Destination destination = this.jmsTemplate.getDefaultDestination(); | |
72 | + MessageProducer messageProducer = session.createProducer(destination); | |
73 | + | |
74 | + connection = connectionFactory.createConnection(); | |
75 | + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); | |
76 | + | |
77 | + connection.start(); | |
78 | + try{ | |
79 | + return this.sendMessage(session, messageProducer, replyQueue, input); | |
80 | + }finally{ | |
81 | + try { | |
82 | + messageProducer.close(); | |
83 | + } catch (Exception e) { | |
84 | + } | |
85 | + try { | |
86 | + session.close(); | |
87 | + } catch (Exception e) { | |
88 | + } | |
89 | + try { | |
90 | + connection.close(); | |
91 | + } catch (Exception e) { | |
92 | + } | |
93 | + } | |
94 | + } catch (Exception e) { | |
95 | + e.printStackTrace(); | |
96 | + throw new RuntimeManagerException(e); | |
97 | + } | |
98 | + } | |
99 | + | |
100 | + private RuntimeEnvironmentOutput sendMessage(Session session, MessageProducer messageProducer, Destination replyQueue, SignalEventInput input) { | |
101 | + try { | |
102 | + UUID id = UUID.randomUUID(); | |
103 | + String correlationId = id.toString(); | |
104 | + | |
105 | + TextMessage message = (TextMessage) messageConverter.toMessage(input, session); | |
106 | + message.setJMSReplyTo(replyQueue); | |
107 | + message.setJMSCorrelationID(correlationId); | |
108 | + String messageSelector = "JMSCorrelationID = '" + correlationId + "'"; | |
109 | + | |
110 | + MessageConsumer replyConsumer = session.createConsumer(replyQueue,messageSelector); | |
111 | + messageProducer.send(message, javax.jms.DeliveryMode.PERSISTENT, javax.jms.Message.DEFAULT_PRIORITY, 15000); | |
112 | + | |
113 | + Message replyMessage = replyConsumer.receive(); | |
114 | + | |
115 | + return (RuntimeEnvironmentOutput) outputMessageConverter.fromMessage(replyMessage); | |
116 | + } catch (Exception je) { | |
117 | + throw new RuntimeManagerException(je); | |
118 | + } | |
119 | + } | |
120 | + | |
121 | + | |
122 | + | |
123 | + protected final JmsTemplate getJmsTemplate() { | |
124 | + return (this.jmsTemplate); | |
125 | + } | |
126 | + | |
127 | + protected final JmsTemplate getOutputJmsTemplate() { | |
128 | + return (this.jmsOutputTemplate); | |
129 | + } | |
130 | + | |
131 | + @Override | |
132 | + public void afterPropertiesSet() throws Exception { | |
133 | + Assert.notNull(this.jmsTemplate, "JmsTemplate instance can not be null. See the Spring configuration file context."); | |
134 | + } | |
135 | +} | ... | ... |
cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/impl/SignalEventServiceImpl.java
0 → 100644
1 | +++ a/cit-esi-listener-api/src/main/java/br/com/centralit/esi/api/signal/service/impl/SignalEventServiceImpl.java | |
... | ... | @@ -0,0 +1,133 @@ |
1 | +package br.com.centralit.esi.api.signal.service.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | +import java.util.UUID; | |
5 | + | |
6 | +import javax.jms.JMSException; | |
7 | +import javax.jms.Message; | |
8 | + | |
9 | +import org.springframework.beans.factory.annotation.Autowired; | |
10 | +import org.springframework.stereotype.Service; | |
11 | + | |
12 | +import br.com.centralit.esi.api.business.model.BusinessProcess; | |
13 | +import br.com.centralit.esi.api.business.service.BusinessProcessService; | |
14 | +import br.com.centralit.esi.api.design.model.FlowElement; | |
15 | +import br.com.centralit.esi.api.design.model.event.Event; | |
16 | +import br.com.centralit.esi.api.design.model.event.SignalEvent; | |
17 | +import br.com.centralit.esi.api.design.service.FlowElementService; | |
18 | +import br.com.centralit.esi.api.enumerated.RuntimeActionEnum; | |
19 | +import br.com.centralit.esi.api.execution.model.WorkItem; | |
20 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
21 | +import br.com.centralit.esi.api.log.service.RuntimeLogService; | |
22 | +import br.com.centralit.esi.api.scheduler.EventScheduler; | |
23 | +import br.com.centralit.esi.api.security.service.SecurityService; | |
24 | +import br.com.centralit.esi.api.signal.service.SignalEventService; | |
25 | +import br.com.centralit.esi.exception.EsiControlledException; | |
26 | +import br.com.centralit.esi.exception.RuntimeManagerException; | |
27 | +import br.com.centralit.framework.esi.enumerated.EventTargetEnum; | |
28 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
29 | +import br.com.centralit.framework.util.UtilString; | |
30 | + | |
31 | +@Service("signalEventService") | |
32 | +public class SignalEventServiceImpl implements SignalEventService { | |
33 | + | |
34 | + @Autowired | |
35 | + protected RuntimeLogService runtimeLogService; | |
36 | + | |
37 | + @Autowired | |
38 | + protected EventScheduler eventScheduler; | |
39 | + | |
40 | + @SuppressWarnings("rawtypes") | |
41 | + @Autowired | |
42 | + protected WorkItemService workItemService; | |
43 | + | |
44 | + @Autowired | |
45 | + protected FlowElementService flowElementService; | |
46 | + | |
47 | + @Autowired | |
48 | + protected BusinessProcessService businessProcessService; | |
49 | + | |
50 | + @Autowired | |
51 | + protected SecurityService securityService; | |
52 | + | |
53 | + | |
54 | + @SuppressWarnings("unchecked") | |
55 | + @Override | |
56 | + public void receive(SignalEventInput input, Message message) { | |
57 | + this.validateInput(input); | |
58 | + | |
59 | + String correlationId = null; | |
60 | + try { | |
61 | + correlationId = message.getJMSCorrelationID(); | |
62 | + } catch (JMSException e) { | |
63 | + } | |
64 | + | |
65 | + if (input.getEventTarget().equals(EventTargetEnum.PROCESS_INSTANCE)) { | |
66 | + List<WorkItem> workItems = workItemService.retrieveAvailableEvents(input); | |
67 | + this.executeWorkItems(input, correlationId, workItems); | |
68 | + }else{ | |
69 | + List<FlowElement> elements = flowElementService.retrieveSignalEvents(input); | |
70 | + this.startProcess(input, correlationId, elements); | |
71 | + } | |
72 | + } | |
73 | + | |
74 | + private void startProcess(SignalEventInput input, String correlationId, List<FlowElement> elements) { | |
75 | + if (elements != null) { | |
76 | + for (FlowElement flowElement : elements) { | |
77 | + if (!((Event) flowElement).isCatchEvent()) { | |
78 | + continue; | |
79 | + } | |
80 | + if (input.getEventName() == null) { | |
81 | + input.setEventName(((SignalEvent) flowElement).getName()); | |
82 | + } | |
83 | + eventScheduler.schedulerSignalEvent((SignalEvent) flowElement, input, correlationId, null); | |
84 | + } | |
85 | + } | |
86 | + } | |
87 | + | |
88 | + private void executeWorkItems(SignalEventInput input, String correlationId, List<WorkItem> workItems) { | |
89 | + if (workItems != null) { | |
90 | + for (WorkItem workItem : workItems) { | |
91 | + eventScheduler.schedulerSignalEvent((SignalEvent) workItem.getFlowElement(), input, correlationId, workItem.getId()); | |
92 | + } | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + private void validateInput(SignalEventInput input) { | |
97 | + try { | |
98 | + if (input.getEventTarget() == null) { | |
99 | + if (!UtilString.isNullOrEmpty(input.getBusinessProcessName())) { | |
100 | + input.setEventTarget(EventTargetEnum.BUSINESS_PROCESS); | |
101 | + }else if (!UtilString.isNullOrEmpty(input.getFlowName())) { | |
102 | + input.setEventTarget(EventTargetEnum.FLOW_ELEMENT); | |
103 | + } | |
104 | + if (input.getEventTarget() == null) { | |
105 | + throw new EsiControlledException("Alvo não informado"); | |
106 | + } | |
107 | + }else if (input.getEventTarget().equals(EventTargetEnum.FLOW_ELEMENT) && UtilString.isNullOrEmpty(input.getFlowName())) { | |
108 | + throw new RuntimeManagerException("Nome do fluxo não informado"); | |
109 | + }else if (input.getEventTarget().equals(EventTargetEnum.BUSINESS_PROCESS) && UtilString.isNullOrEmpty(input.getBusinessProcessName())) { | |
110 | + throw new EsiControlledException("Nome do processo de negócio não informado"); | |
111 | + } | |
112 | + | |
113 | + if (input.getEventTarget().equals(EventTargetEnum.BUSINESS_PROCESS)) { | |
114 | + BusinessProcess businessProcess = businessProcessService.findByName(input.getBusinessProcessName()); | |
115 | + if (businessProcess == null) { | |
116 | + throw new EsiControlledException("Processo de negócio não encontrado"); | |
117 | + } | |
118 | + input.setEventTarget(EventTargetEnum.BUSINESS_PROCESS); | |
119 | + input.setBusinessProcessId(businessProcess.getId()); | |
120 | + input.setFlowName(businessProcess.getFlow().getName()); | |
121 | + } | |
122 | + if (input.getUuid() == null) { | |
123 | + input.setUuid(UUID.randomUUID().toString()); | |
124 | + } | |
125 | + } catch (EsiControlledException e) { | |
126 | + runtimeLogService.create(RuntimeActionEnum.SIGNAL_EVENT, e, securityService.getAuthenticatedUser(), input, null, null); | |
127 | + throw e; | |
128 | + }catch (Exception e) { | |
129 | + runtimeLogService.create(RuntimeActionEnum.SIGNAL_EVENT, e, securityService.getAuthenticatedUser(), input, null, null); | |
130 | + throw new EsiControlledException(e); | |
131 | + } | |
132 | + } | |
133 | +} | ... | ... |
1 | +++ a/cit-esi-listener-web/pom.xml | |
... | ... | @@ -0,0 +1,48 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- ******************************************************************************************************************** --> | |
3 | +<!-- * LICENCA*GPLv2 * --> | |
4 | +<!-- * Copyright [2011,2012,2013,2014,2015] da CentralIT Tecnologia da Informação Ltda (www.centralit.com.br) * --> | |
5 | +<!-- * * --> | |
6 | +<!-- * Este arquivo é parte do programa/software: Citsmart (www.citsmart.com.br) * --> | |
7 | +<!-- * * --> | |
8 | +<!-- * O Citsmart é um software livre; você pode redistribui-lo e/ou modificá-lo dentro dos termos da Licença * --> | |
9 | +<!-- * Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versção 2 da Licença. * --> | |
10 | +<!-- * * --> | |
11 | +<!-- * Este programa/software é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma * --> | |
12 | +<!-- * garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral * --> | |
13 | +<!-- * GNU/GPL em português para maiores detalhes. * --> | |
14 | +<!-- * * --> | |
15 | +<!-- * Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título 'LICENCA.txt', junto com este * --> | |
16 | +<!-- * programa/software, se não, acesse o Portal do Software Público Brasileiro no endereço www.softwarepublico.gov.br * --> | |
17 | +<!-- * ou escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,USA * --> | |
18 | +<!-- ******************************************************************************************************************** --> | |
19 | +<project | |
20 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | |
21 | + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
22 | + <modelVersion>4.0.0</modelVersion> | |
23 | + | |
24 | + <parent> | |
25 | + <groupId>br.com.centralit</groupId> | |
26 | + <artifactId>cit-esi-listener</artifactId> | |
27 | + <version>1.8.0-SNAPSHOT</version> | |
28 | + </parent> | |
29 | + | |
30 | + <artifactId>cit-esi-listener-web</artifactId> | |
31 | + <packaging>war</packaging> | |
32 | + <name>cit-esi-listener-web</name> | |
33 | + | |
34 | + <properties> | |
35 | + <findbugs.config.path>${project.parent.parent.parent.basedir}/filterfile.xml</findbugs.config.path> | |
36 | + <license.config.path>${project.parent.parent.basedir}/src/licensing</license.config.path> | |
37 | + <maven-antrun-plugin.phase>package</maven-antrun-plugin.phase> | |
38 | + <minify-maven-plugin.phase>prepare-package</minify-maven-plugin.phase> | |
39 | + </properties> | |
40 | + | |
41 | + <dependencies> | |
42 | + <dependency> | |
43 | + <groupId>br.com.centralit</groupId> | |
44 | + <artifactId>cit-esi-listener-api</artifactId> | |
45 | + </dependency> | |
46 | + </dependencies> | |
47 | + | |
48 | +</project> | ... | ... |
cit-esi-listener-web/src/main/java/br/com/centralit/controller/RuntimeManagerController.java
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/java/br/com/centralit/controller/RuntimeManagerController.java | |
... | ... | @@ -0,0 +1,145 @@ |
1 | +package br.com.centralit.controller; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Controller; | |
5 | +import org.springframework.web.bind.annotation.PathVariable; | |
6 | +import org.springframework.web.bind.annotation.RequestBody; | |
7 | +import org.springframework.web.bind.annotation.RequestMapping; | |
8 | +import org.springframework.web.bind.annotation.RequestMethod; | |
9 | +import org.springframework.web.bind.annotation.RequestParam; | |
10 | +import org.springframework.web.bind.annotation.ResponseBody; | |
11 | + | |
12 | +import br.com.centralit.esi.api.business.service.BusinessRuleManager; | |
13 | +import br.com.centralit.esi.api.design.model.FlowVersion; | |
14 | +import br.com.centralit.esi.api.design.service.FlowVersionService; | |
15 | +import br.com.centralit.esi.api.execution.service.ProcessInstanceService; | |
16 | +import br.com.centralit.esi.api.execution.service.WorkItemAssignmentService; | |
17 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
18 | +import br.com.centralit.esi.api.router.service.RouterService; | |
19 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironmentInput; | |
20 | +import br.com.centralit.esi.api.scheduler.EventScheduler; | |
21 | +import br.com.centralit.framework.controller.GenericController; | |
22 | +import br.com.centralit.framework.esi.environment.SignalEventInput; | |
23 | +import br.com.centralit.framework.json.ResponseBodyWrapper; | |
24 | +import br.com.centralit.framework.json.Views; | |
25 | +import br.com.centralit.framework.json.Views.GenericView; | |
26 | + | |
27 | +@Controller | |
28 | +@RequestMapping("/rest/esi") | |
29 | +public class RuntimeManagerController extends GenericController<FlowVersion>{ | |
30 | + | |
31 | + @Autowired | |
32 | + private RouterService runtimeManager; | |
33 | + | |
34 | + @Autowired | |
35 | + private WorkItemService<?> workItemService; | |
36 | + | |
37 | + @Autowired | |
38 | + private WorkItemAssignmentService workItemAssignmentService; | |
39 | + | |
40 | + @Autowired | |
41 | + private ProcessInstanceService processInstanceService; | |
42 | + | |
43 | + @Autowired | |
44 | + private BusinessRuleManager businessRuleManager; | |
45 | + | |
46 | + @Autowired | |
47 | + private EventScheduler eventScheduler; | |
48 | + | |
49 | + @Autowired | |
50 | + public RuntimeManagerController(FlowVersionService flowVersionService) { | |
51 | + super(flowVersionService); | |
52 | + } | |
53 | + | |
54 | + @RequestMapping(value = "/start", method = RequestMethod.POST) | |
55 | + @ResponseBody | |
56 | + public ResponseBodyWrapper start(@RequestBody RuntimeEnvironmentInput input) { | |
57 | + return new ResponseBodyWrapper(runtimeManager.start(input), getEditView()); | |
58 | + } | |
59 | + | |
60 | + @RequestMapping(value = "/task/capture", method = RequestMethod.POST) | |
61 | + @ResponseBody | |
62 | + public ResponseBodyWrapper captureTask(@RequestBody RuntimeEnvironmentInput runtimeEnvironment) { | |
63 | + return new ResponseBodyWrapper(runtimeManager.captureTask(runtimeEnvironment), getEditView()); | |
64 | + } | |
65 | + | |
66 | + @RequestMapping(value = "/task/complete", method = RequestMethod.POST) | |
67 | + @ResponseBody | |
68 | + public ResponseBodyWrapper completeTask(@RequestBody RuntimeEnvironmentInput runtimeEnvironment) { | |
69 | + return new ResponseBodyWrapper(runtimeManager.completeTask(runtimeEnvironment), getEditView()); | |
70 | + } | |
71 | + | |
72 | + @RequestMapping(value = "/execute/{flowName}", method = RequestMethod.GET) | |
73 | + @ResponseBody | |
74 | + public ResponseBodyWrapper execute(@PathVariable("flowName") String flowName, @RequestParam("response") final String[] response, @RequestParam(value="variables",required = false) final String[] variables) { | |
75 | + return new ResponseBodyWrapper(runtimeManager.execute(flowName, response, variables), Views.GenericView.class); | |
76 | + } | |
77 | + | |
78 | + @RequestMapping(value = "/signalEvent", method = RequestMethod.POST) | |
79 | + @ResponseBody | |
80 | + public ResponseBodyWrapper signalEvent(@RequestBody SignalEventInput signalEventInput) { | |
81 | + return new ResponseBodyWrapper(runtimeManager.signalEvent(signalEventInput), getEditView()); | |
82 | + } | |
83 | + | |
84 | + @RequestMapping(value = "/schedule", method = RequestMethod.POST) | |
85 | + @ResponseBody | |
86 | + public ResponseBodyWrapper schedule(@RequestBody RuntimeEnvironmentInput input) { | |
87 | + eventScheduler.schedule(input.getJobName(), input.getCronExpression(), input); | |
88 | + return new ResponseBodyWrapper(null, getEditView()); | |
89 | + } | |
90 | + | |
91 | + @RequestMapping(value = "/removeSchedule", method = RequestMethod.POST) | |
92 | + @ResponseBody | |
93 | + public ResponseBodyWrapper removeSchedule(@RequestBody RuntimeEnvironmentInput input) { | |
94 | + eventScheduler.removeSchedule(input.getJobName()); | |
95 | + return new ResponseBodyWrapper(null, getEditView()); | |
96 | + } | |
97 | + | |
98 | + @RequestMapping(value = "/rule/execute", method = RequestMethod.POST) | |
99 | + @ResponseBody | |
100 | + public ResponseBodyWrapper executeBusinessRule(@RequestBody RuntimeEnvironmentInput input) { | |
101 | + return new ResponseBodyWrapper(businessRuleManager.execute(input), null); | |
102 | + } | |
103 | + | |
104 | + @RequestMapping(value = "/task/delegate", method = RequestMethod.POST) | |
105 | + @ResponseBody | |
106 | + public ResponseBodyWrapper delegateUserTask(@RequestBody RuntimeEnvironmentInput input) { | |
107 | + return new ResponseBodyWrapper(runtimeManager.delegateUserTask(input), getEditView()); | |
108 | + } | |
109 | + | |
110 | + @RequestMapping(value = "/task/removeDelegation", method = RequestMethod.POST) | |
111 | + @ResponseBody | |
112 | + public ResponseBodyWrapper removeUserTaskDelegation(@RequestBody RuntimeEnvironmentInput input) { | |
113 | + return new ResponseBodyWrapper(runtimeManager.removeUserTaskDelegation(input), getEditView()); | |
114 | + } | |
115 | + | |
116 | + @RequestMapping(value = "/instance/suspend", method = RequestMethod.POST) | |
117 | + @ResponseBody | |
118 | + public ResponseBodyWrapper suspendProcessInstance(@RequestBody RuntimeEnvironmentInput input) { | |
119 | + return new ResponseBodyWrapper(runtimeManager.suspendProcessInstance(input), getEditView()); | |
120 | + } | |
121 | + | |
122 | + @RequestMapping(value = "/instance/restart", method = RequestMethod.POST) | |
123 | + @ResponseBody | |
124 | + public ResponseBodyWrapper restartProcessInstance(@RequestBody RuntimeEnvironmentInput input) { | |
125 | + return new ResponseBodyWrapper(runtimeManager.restartProcessInstance(input), getEditView()); | |
126 | + } | |
127 | + | |
128 | + @RequestMapping(value = "/instance/reopen", method = RequestMethod.POST) | |
129 | + @ResponseBody | |
130 | + public ResponseBodyWrapper reopenProcessInstance(@RequestBody RuntimeEnvironmentInput input) { | |
131 | + return new ResponseBodyWrapper(runtimeManager.reopenProcessInstance(input), getEditView()); | |
132 | + } | |
133 | + | |
134 | + @Override | |
135 | + public Class<? extends Views.GenericView> getEditView() { | |
136 | + return Views.EsiEditView.class; | |
137 | + } | |
138 | + | |
139 | + @Override | |
140 | + public Class<? extends GenericView> getListView() { | |
141 | + return Views.EsiListView.class; | |
142 | + } | |
143 | + | |
144 | +} | |
145 | + | ... | ... |
cit-esi-listener-web/src/main/java/br/com/centralit/listener/StartupListenerEsiListener.java
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/java/br/com/centralit/listener/StartupListenerEsiListener.java | |
... | ... | @@ -0,0 +1,73 @@ |
1 | +package br.com.centralit.listener; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | +import org.springframework.context.ApplicationListener; | |
7 | +import org.springframework.context.event.ContextRefreshedEvent; | |
8 | +import org.springframework.stereotype.Component; | |
9 | + | |
10 | +import br.com.centralit.esi.api.parameter.model.Parameter; | |
11 | +import br.com.centralit.esi.api.parameter.service.ParameterService; | |
12 | +import br.com.centralit.esi.api.scheduler.EventScheduler; | |
13 | +import br.com.centralit.esi.api.util.EsiAppUtils; | |
14 | +import br.com.centralit.framework.model.UtilStartup; | |
15 | + | |
16 | +/** | |
17 | + * <p> | |
18 | + * <img src="http://centralit.com.br/images/logo_central.png"> | |
19 | + * </p> | |
20 | + * | |
21 | + * <p> | |
22 | + * <b>Company: </b> Central IT - Governança Corporativa - | |
23 | + * </p> | |
24 | + * | |
25 | + * <p> | |
26 | + * <b>Title: </b> | |
27 | + * </p> | |
28 | + * | |
29 | + * <p> | |
30 | + * <b>Description: </b> | |
31 | + * </p> | |
32 | + * | |
33 | + * <p> | |
34 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
35 | + * </p> | |
36 | + * | |
37 | + * <p> | |
38 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
39 | + * </p> | |
40 | + * | |
41 | + * @since 29/05/2015 - 18:05:54 | |
42 | + * | |
43 | + * @version 1.0.0 | |
44 | + * | |
45 | + * @author carlos.alberto | |
46 | + * | |
47 | + */ | |
48 | +@Component | |
49 | +public class StartupListenerEsiListener extends UtilStartup implements ApplicationListener<ContextRefreshedEvent> { | |
50 | + | |
51 | + @Autowired | |
52 | + private EventScheduler eventScheduler; | |
53 | + | |
54 | + @Autowired | |
55 | + private ParameterService parameterService; | |
56 | + | |
57 | + /** | |
58 | + * | |
59 | + */ | |
60 | + @Override | |
61 | + public void onApplicationEvent(final ContextRefreshedEvent event) { | |
62 | + eventScheduler.initialize(); | |
63 | + | |
64 | + List<Parameter> parameters = parameterService.findAll(); | |
65 | + if (parameters != null && parameters.size() > 0) { | |
66 | + for (Parameter parameter : parameters) { | |
67 | + EsiAppUtils.updateParameter(parameter); | |
68 | + } | |
69 | + } | |
70 | + | |
71 | + } | |
72 | + | |
73 | +} | ... | ... |
cit-esi-listener-web/src/main/resources/log4j.properties
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/log4j.properties | |
... | ... | @@ -0,0 +1,22 @@ |
1 | +# Root logger option | |
2 | +log4j.rootLogger=INFO, file, stdout | |
3 | + | |
4 | +# Direct log messages to a log file | |
5 | +log4j.appender.file=org.apache.log4j.RollingFileAppender | |
6 | +log4j.appender.file.File=${project.build.directory}/log/${project.name}.log | |
7 | +log4j.appender.file.MaxFileSize=5MB | |
8 | +log4j.appender.file.MaxBackupIndex=10 | |
9 | +log4j.appender.file.layout=org.apache.log4j.PatternLayout | |
10 | +log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n | |
11 | + | |
12 | +# Direct log messages to stdout | |
13 | +log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |
14 | +log4j.appender.stdout.Target=System.out | |
15 | +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | |
16 | +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n | |
17 | + | |
18 | +#Frameworks to logging | |
19 | +log4j.logger.org.springframework=DEBUG | |
20 | +log4j.logger.org.hibernate.engine.internal.StatefulPersistenceContext=ERROR | |
21 | +log4j.logger.org.hibernate=INFO | |
22 | +log4j.logger.org.hibernate.type=trace | ... | ... |
cit-esi-listener-web/src/main/resources/metadata/idp.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/metadata/idp.xml | |
... | ... | @@ -0,0 +1,78 @@ |
1 | +<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" | |
2 | + ID="patrimonio.com" entityID="patrimonio.com"> | |
3 | + <SPSSODescriptor AuthnRequestsSigned="true" | |
4 | + WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> | |
5 | + <KeyDescriptor use="signing"> | |
6 | + <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> | |
7 | + <ds:X509Data> | |
8 | + <ds:X509Certificate> | |
9 | + MIIDUjCCAjqgAwIBAgIEUOLIQTANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQGEwJGSTEQMA4GA1UE | |
10 | + CBMHVXVzaW1hYTERMA8GA1UEBxMISGVsc2lua2kxGDAWBgNVBAoTD1JNNSBTb2Z0d2FyZSBPeTEM | |
11 | + MAoGA1UECwwDUiZEMQ8wDQYDVQQDEwZhcG9sbG8wHhcNMTMwMTAxMTEyODAxWhcNMjIxMjMwMTEy | |
12 | + ODAxWjBrMQswCQYDVQQGEwJGSTEQMA4GA1UECBMHVXVzaW1hYTERMA8GA1UEBxMISGVsc2lua2kx | |
13 | + GDAWBgNVBAoTD1JNNSBTb2Z0d2FyZSBPeTEMMAoGA1UECwwDUiZEMQ8wDQYDVQQDEwZhcG9sbG8w | |
14 | + ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCXqP0wqL2Ai1haeTj0alwsLafhrDtUt00E | |
15 | + 5xc7kdD7PISRA270ZmpYMB4W24Uk2QkuwaBp6dI/yRdUvPfOT45YZrqIxMe2451PAQWtEKWF5Z13 | |
16 | + F0J4/lB71TtrzyH94RnqSHXFfvRN8EY/rzuEzrpZrHdtNs9LRyLqcRTXMMO4z7QghBuxh3K5gu7K | |
17 | + qxpHx6No83WNZj4B3gvWLRWv05nbXh/F9YMeQClTX1iBNAhLQxWhwXMKB4u1iPQ/KSaal3R26pON | |
18 | + UUmu1qVtU1quQozSTPD8HvsDqGG19v2+/N3uf5dRYtvEPfwXN3wIY+/R93vBA6lnl5nTctZIRsyg | |
19 | + 0Gv5AgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAFQwAAYUjso1VwjDc2kypK/RRcB8bMAUUIG0hLGL | |
20 | + 82IvnKouGixGqAcULwQKIvTs6uGmlgbSG6Gn5ROb2mlBztXqQ49zRvi5qWNRttir6eyqwRFGOM6A | |
21 | + 8rxj3Jhxi2Vb/MJn7XzeVHHLzA1sV5hwl/2PLnaL2h9WyG9QwBbwtmkMEqUt/dgixKb1Rvby/tBu | |
22 | + RogWgPONNSACiW+Z5o8UdAOqNMZQozD/i1gOjBXoF0F5OksjQN7xoQZLj9xXefxCFQ69FPcFDeEW | |
23 | + bHwSoBy5hLPNALaEUoa5zPDwlixwRjFQTc5XXaRpgIjy/2gsL8+Y5QRhyXnLqgO67BlLYW/GuHE= | |
24 | + </ds:X509Certificate> | |
25 | + </ds:X509Data> | |
26 | + </ds:KeyInfo> | |
27 | + </KeyDescriptor> | |
28 | + <KeyDescriptor use="encryption"> | |
29 | + <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> | |
30 | + <ds:X509Data> | |
31 | + <ds:X509Certificate> | |
32 | + MIIDUjCCAjqgAwIBAgIEUOLIQTANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQGEwJGSTEQMA4GA1UE | |
33 | + CBMHVXVzaW1hYTERMA8GA1UEBxMISGVsc2lua2kxGDAWBgNVBAoTD1JNNSBTb2Z0d2FyZSBPeTEM | |
34 | + MAoGA1UECwwDUiZEMQ8wDQYDVQQDEwZhcG9sbG8wHhcNMTMwMTAxMTEyODAxWhcNMjIxMjMwMTEy | |
35 | + ODAxWjBrMQswCQYDVQQGEwJGSTEQMA4GA1UECBMHVXVzaW1hYTERMA8GA1UEBxMISGVsc2lua2kx | |
36 | + GDAWBgNVBAoTD1JNNSBTb2Z0d2FyZSBPeTEMMAoGA1UECwwDUiZEMQ8wDQYDVQQDEwZhcG9sbG8w | |
37 | + ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCXqP0wqL2Ai1haeTj0alwsLafhrDtUt00E | |
38 | + 5xc7kdD7PISRA270ZmpYMB4W24Uk2QkuwaBp6dI/yRdUvPfOT45YZrqIxMe2451PAQWtEKWF5Z13 | |
39 | + F0J4/lB71TtrzyH94RnqSHXFfvRN8EY/rzuEzrpZrHdtNs9LRyLqcRTXMMO4z7QghBuxh3K5gu7K | |
40 | + qxpHx6No83WNZj4B3gvWLRWv05nbXh/F9YMeQClTX1iBNAhLQxWhwXMKB4u1iPQ/KSaal3R26pON | |
41 | + UUmu1qVtU1quQozSTPD8HvsDqGG19v2+/N3uf5dRYtvEPfwXN3wIY+/R93vBA6lnl5nTctZIRsyg | |
42 | + 0Gv5AgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAFQwAAYUjso1VwjDc2kypK/RRcB8bMAUUIG0hLGL | |
43 | + 82IvnKouGixGqAcULwQKIvTs6uGmlgbSG6Gn5ROb2mlBztXqQ49zRvi5qWNRttir6eyqwRFGOM6A | |
44 | + 8rxj3Jhxi2Vb/MJn7XzeVHHLzA1sV5hwl/2PLnaL2h9WyG9QwBbwtmkMEqUt/dgixKb1Rvby/tBu | |
45 | + RogWgPONNSACiW+Z5o8UdAOqNMZQozD/i1gOjBXoF0F5OksjQN7xoQZLj9xXefxCFQ69FPcFDeEW | |
46 | + bHwSoBy5hLPNALaEUoa5zPDwlixwRjFQTc5XXaRpgIjy/2gsL8+Y5QRhyXnLqgO67BlLYW/GuHE= | |
47 | + </ds:X509Certificate> | |
48 | + </ds:X509Data> | |
49 | + </ds:KeyInfo> | |
50 | + </KeyDescriptor> | |
51 | + <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" | |
52 | + Location="http://grp.com:8080/citgrp-patrimonio-web/saml/SingleLogout" /> | |
53 | + <SingleLogoutService | |
54 | + Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" | |
55 | + Location="http://grp.com:8080/citgrp-patrimonio-web/saml/SingleLogout" /> | |
56 | + <NameIDFormat> | |
57 | + urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress | |
58 | + </NameIDFormat> | |
59 | + <NameIDFormat> | |
60 | + urn:oasis:names:tc:SAML:2.0:nameid-format:transient | |
61 | + </NameIDFormat> | |
62 | + <NameIDFormat> | |
63 | + urn:oasis:names:tc:SAML:2.0:nameid-format:persistent | |
64 | + </NameIDFormat> | |
65 | + <NameIDFormat> | |
66 | + urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified | |
67 | + </NameIDFormat> | |
68 | + <NameIDFormat> | |
69 | + urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName | |
70 | + </NameIDFormat> | |
71 | + <AssertionConsumerService index="0" | |
72 | + isDefault="true" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" | |
73 | + Location="http://grp.com:8080/citgrp-patrimonio-web/saml/SSO" /> | |
74 | + <AssertionConsumerService index="1" | |
75 | + Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" | |
76 | + Location="http://grp.com:8080/citgrp-patrimonio-web/saml/SSO" /> | |
77 | + </SPSSODescriptor> | |
78 | +</EntityDescriptor> | |
0 | 79 | \ No newline at end of file | ... | ... |
No preview for this file type
cit-esi-listener-web/src/main/resources/spring/applicationContext.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/spring/applicationContext.xml | |
... | ... | @@ -0,0 +1,172 @@ |
1 | +<beans xmlns="http://www.springframework.org/schema/beans" | |
2 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
3 | + xmlns:context="http://www.springframework.org/schema/context" | |
4 | + xmlns:util="http://www.springframework.org/schema/util" | |
5 | + xmlns:p="http://www.springframework.org/schema/p" | |
6 | + xmlns:tx="http://www.springframework.org/schema/tx" | |
7 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | |
8 | + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
9 | + http://www.springframework.org/schema/context | |
10 | + http://www.springframework.org/schema/context/spring-context-3.1.xsd | |
11 | + http://www.springframework.org/schema/util | |
12 | + http://www.springframework.org/schema/util/spring-util-3.1.xsd | |
13 | + http://www.springframework.org/schema/tx | |
14 | + http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"> | |
15 | + | |
16 | + <bean id="citEsiDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> | |
17 | + <property name="jndiName" value="java:/env/jdbc/cit-esi-listener" /> | |
18 | + </bean> | |
19 | + | |
20 | + <bean id="entityManagerFactory" | |
21 | + class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" | |
22 | + p:packagesToScan="br.com.centralit.framework.model, br.com.centralit.api.model, br.com.centralit.esi.api" p:dataSource-ref="citEsiDataSource" | |
23 | + p:jpaPropertyMap-ref="jpaPropertyMap" p:jpaVendorAdapter-ref="jpaVendorAdapter" /> | |
24 | + | |
25 | + <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> | |
26 | + | |
27 | + <util:map id="jpaPropertyMap"> | |
28 | + <entry key="generateDdl" value="${hibernate.generate.ddl}" /> | |
29 | + <entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" /> | |
30 | + <entry key="hibernate.dialect" value="${hibernate.dialect}" /> | |
31 | + <entry key="hibernate.format_sql" value="${hibernate.format.sql}" /> | |
32 | + </util:map> | |
33 | + | |
34 | + <context:component-scan base-package="br.jm.filehandler"> | |
35 | + <context:include-filter type="annotation" | |
36 | + expression="org.springframework.jmx.export.annotation.ManagedResource" /> | |
37 | + </context:component-scan> | |
38 | + | |
39 | + <import resource="webmvc-context.xml" /> | |
40 | + <import resource="classpath*:spring/applicationContext-base.xml" /> | |
41 | + | |
42 | + <bean id="esiAppUtils" class="br.com.centralit.esi.api.util.EsiAppUtils"/> | |
43 | + <bean id="eventScheduler" class="br.com.centralit.esi.api.scheduler.EventScheduler"/> | |
44 | + <bean id="runtimeContext" class="br.com.centralit.esi.api.runtime.RuntimeContext"/> | |
45 | + | |
46 | + <context:component-scan base-package="br.com.centralit.listener" /> | |
47 | + | |
48 | + <context:component-scan base-package="br.com.centralit.esi.api.signal.service"/> | |
49 | + <context:component-scan base-package="br.com.centralit.esi.api.jms.service"/> | |
50 | + | |
51 | + <bean id="inputQueue" class="org.apache.activemq.command.ActiveMQQueue"> | |
52 | + <constructor-arg value="${esi.input.queue}" /> | |
53 | + </bean> | |
54 | + | |
55 | + <bean id="responseQueue" class="org.apache.activemq.command.ActiveMQQueue"> | |
56 | + <constructor-arg value="${esi.output.queue}" /> | |
57 | + </bean> | |
58 | + | |
59 | + <bean id="signalEventMessageConverter" class="br.com.centralit.esi.api.signal.message.SignalEventMessageConverter" /> | |
60 | + <bean id="runtimeOutputMessageConverter" class="br.com.centralit.esi.api.jms.message.RuntimeOutputMessageConverter" /> | |
61 | + | |
62 | + <!-- a pooling based JMS provider --> | |
63 | + <bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory" | |
64 | + destroy-method="stop"> | |
65 | + <property name="connectionFactory"> | |
66 | + <bean class="org.apache.activemq.ActiveMQConnectionFactory"> | |
67 | + <property name="brokerURL"> | |
68 | + <value>${broker.url}</value> | |
69 | + </property> | |
70 | + </bean> | |
71 | + </property> | |
72 | + </bean> | |
73 | + | |
74 | + <bean id="signalEventProducer" class="org.springframework.jms.core.JmsTemplate"> | |
75 | + <property name="connectionFactory"> | |
76 | + <ref local="jmsFactory" /> | |
77 | + </property> | |
78 | + <property name="defaultDestination"> | |
79 | + <ref local="inputQueue" /> | |
80 | + </property> | |
81 | + <property name="deliveryPersistent" value="true"/> | |
82 | + <property name="deliveryMode" value="2"/> | |
83 | + </bean> | |
84 | + | |
85 | + <bean id="runtimeOutputProducer" class="org.springframework.jms.core.JmsTemplate"> | |
86 | + <property name="connectionFactory"> | |
87 | + <ref local="jmsFactory" /> | |
88 | + </property> | |
89 | + <property name="defaultDestination"> | |
90 | + <ref local="responseQueue" /> | |
91 | + </property> | |
92 | + <property name="deliveryPersistent" value="true"/> | |
93 | + <property name="deliveryMode" value="2"/> | |
94 | + </bean> | |
95 | + | |
96 | + <tx:advice id="txAdvice" transaction-manager="transactionManager"> | |
97 | + <!-- the transactional semantics... --> | |
98 | + <tx:attributes> | |
99 | + <!-- all methods starting with 'find' are read-only --> | |
100 | + <tx:method name="find*" read-only="true" /> | |
101 | + <!-- all methods starting with 'get' are read-only --> | |
102 | + <tx:method name="get*" read-only="true" /> | |
103 | + <!-- all methods starting with 'get' are read-only --> | |
104 | + <tx:method name="retrieve*" read-only="true" /> | |
105 | + <!-- other methods use the default transaction settings (see below) --> | |
106 | + <tx:method name="*" propagation="REQUIRED" no-rollback-for="EsiControlledException"/> | |
107 | + </tx:attributes> | |
108 | + </tx:advice> | |
109 | + | |
110 | + <context:component-scan base-package="br.com.centralit.esi.api.design.model"/> | |
111 | + <context:component-scan base-package="br.com.centralit.esi.api.execution.model"/> | |
112 | + <context:component-scan base-package="br.com.centralit.esi.api.calendar.model"/> | |
113 | + <context:component-scan base-package="br.com.centralit.esi.api.business.model"/> | |
114 | + <context:component-scan base-package="br.com.centralit.esi.api.scheduler.model"/> | |
115 | + <context:component-scan base-package="br.com.centralit.esi.api.log.model"/> | |
116 | + <context:component-scan base-package="br.com.centralit.esi.api.domain.model"/> | |
117 | + <context:component-scan base-package="br.com.centralit.esi.api.document.model"/> | |
118 | + <context:component-scan base-package="br.com.centralit.esi.api.notification.model"/> | |
119 | + <context:component-scan base-package="br.com.centralit.esi.api.subscriber.model"/> | |
120 | + <context:component-scan base-package="br.com.centralit.esi.api.parameter.model"/> | |
121 | + <context:component-scan base-package="br.com.centralit.esi.api.drools.model"/> | |
122 | + <context:component-scan base-package="br.com.centralit.esi.api.resource.model"/> | |
123 | + <context:component-scan base-package="br.com.centralit.esi.api.data.model"/> | |
124 | + <context:component-scan base-package="br.com.centralit.esi.api.pack.model"/> | |
125 | + | |
126 | + <context:component-scan base-package="br.com.centralit.esi.api.design.dao"/> | |
127 | + <context:component-scan base-package="br.com.centralit.esi.api.execution.dao"/> | |
128 | + <context:component-scan base-package="br.com.centralit.esi.api.scheduler.dao"/> | |
129 | + <context:component-scan base-package="br.com.centralit.esi.api.calendar.dao"/> | |
130 | + <context:component-scan base-package="br.com.centralit.esi.api.business.dao"/> | |
131 | + <context:component-scan base-package="br.com.centralit.esi.api.log.dao"/> | |
132 | + <context:component-scan base-package="br.com.centralit.esi.api.domain.dao"/> | |
133 | + <context:component-scan base-package="br.com.centralit.esi.api.document.dao"/> | |
134 | + <context:component-scan base-package="br.com.centralit.esi.api.notification.dao"/> | |
135 | + <context:component-scan base-package="br.com.centralit.esi.api.subscriber.dao"/> | |
136 | + <context:component-scan base-package="br.com.centralit.esi.api.parameter.dao"/> | |
137 | + <context:component-scan base-package="br.com.centralit.esi.api.drools.dao"/> | |
138 | + <context:component-scan base-package="br.com.centralit.esi.api.resource.dao"/> | |
139 | + <context:component-scan base-package="br.com.centralit.esi.api.data.dao"/> | |
140 | + <context:component-scan base-package="br.com.centralit.esi.api.pack.dao"/> | |
141 | + | |
142 | + <context:component-scan base-package="br.com.centralit.esi.api.design.service"/> | |
143 | + <context:component-scan base-package="br.com.centralit.esi.api.execution.service"/> | |
144 | + <context:component-scan base-package="br.com.centralit.esi.api.calendar.service"/> | |
145 | + <context:component-scan base-package="br.com.centralit.esi.api.business.service"/> | |
146 | + <context:component-scan base-package="br.com.centralit.esi.api.document.service"/> | |
147 | + <context:component-scan base-package="br.com.centralit.esi.api.runtime.service"/> | |
148 | + <context:component-scan base-package="br.com.centralit.esi.api.scheduler.service"/> | |
149 | + <context:component-scan base-package="br.com.centralit.esi.api.security.service"/> | |
150 | + <context:component-scan base-package="br.com.centralit.esi.api.log.service"/> | |
151 | + <context:component-scan base-package="br.com.centralit.esi.api.domain.service"/> | |
152 | + <context:component-scan base-package="br.com.centralit.esi.api.notification.service"/> | |
153 | + <context:component-scan base-package="br.com.centralit.esi.api.subscriber.service"/> | |
154 | + <context:component-scan base-package="br.com.centralit.esi.api.router.service"/> | |
155 | + <context:component-scan base-package="br.com.centralit.esi.api.parameter.service"/> | |
156 | + <context:component-scan base-package="br.com.centralit.esi.api.drools.service"/> | |
157 | + <context:component-scan base-package="br.com.centralit.esi.api.resource.service"/> | |
158 | + <context:component-scan base-package="br.com.centralit.esi.api.data.service"/> | |
159 | + <context:component-scan base-package="br.com.centralit.esi.api.pack.service"/> | |
160 | + | |
161 | + <bean id="signalEventConsumer" class="br.com.centralit.esi.api.signal.consumer.SignalEventConsumer" /> | |
162 | + | |
163 | + <!-- and this is the message listener container --> | |
164 | + <bean id="jmsInputContainer" | |
165 | + class="org.springframework.jms.listener.DefaultMessageListenerContainer"> | |
166 | + <property name="connectionFactory" ref="jmsFactory" /> | |
167 | + <property name="destination" ref="inputQueue" /> | |
168 | + <property name="messageListener" ref="signalEventConsumer" /> | |
169 | + </bean> | |
170 | + | |
171 | + <import resource="${authentication.method}" /> | |
172 | +</beans> | |
0 | 173 | \ No newline at end of file | ... | ... |
cit-esi-listener-web/src/main/resources/spring/security.properties
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/spring/security.properties | |
... | ... | @@ -0,0 +1,6 @@ |
1 | +/html/**=ROLE_USER | |
2 | +/admin/**=ROLE_ADMIN,ROLE_MANAGER | |
3 | +/admin/userPreference/**=ROLE_MANAGER | |
4 | +/admin/userPreference/updatePreference.action=ROLE_USER,ROLE_ASSOCIATE | |
5 | +/admin/userPreference/deletePreference.action=ROLE_USER | |
6 | +/html/dominio/**=ROLE_ADMIN | ... | ... |
cit-esi-listener-web/src/main/resources/spring/spring-security-cas.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/spring/spring-security-cas.xml | |
... | ... | @@ -0,0 +1,76 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<beans xmlns="http://www.springframework.org/schema/beans" | |
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
4 | + xmlns:p="http://www.springframework.org/schema/p" | |
5 | + xmlns:security="http://www.springframework.org/schema/security" | |
6 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | |
7 | + http://www.springframework.org/schema/beans/spring-beans.xsd | |
8 | + http://www.springframework.org/schema/security | |
9 | + http://www.springframework.org/schema/security/spring-security-3.2.xsd"> | |
10 | + | |
11 | + <security:http auto-config="true" use-expressions="true" entry-point-ref="casProcessingFilterEntryPoint" access-denied-page="/denied.jsp"> | |
12 | + <security:intercept-url pattern="/loginCas" access="permitAll" /> | |
13 | + <security:intercept-url pattern="/rest/esi/**" access="permitAll" /> | |
14 | + <security:intercept-url pattern="/**" access="isFullyAuthenticated()" requires-channel="https"/> | |
15 | + <security:logout logout-success-url="/cas-logout.jsp"/> | |
16 | + <security:custom-filter ref="casAuthenticationFilter" after="CAS_FILTER"/> | |
17 | + | |
18 | + <security:session-management session-fixation-protection="newSession"> | |
19 | + <security:concurrency-control max-sessions="1"/> | |
20 | + </security:session-management> | |
21 | + </security:http> | |
22 | + | |
23 | + <security:authentication-manager alias="authenticationManager"> | |
24 | + <security:authentication-provider ref="casAuthenticationProvider"/> | |
25 | + </security:authentication-manager> | |
26 | + | |
27 | + <bean id="casAuthenticationFilter" | |
28 | + class="org.springframework.security.cas.web.CasAuthenticationFilter"> | |
29 | + <property name="authenticationManager" ref="authenticationManager"/> | |
30 | + <property name="authenticationFailureHandler"> | |
31 | + <bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> | |
32 | + <property name="defaultFailureUrl" value="/authfailed.jsp"/> | |
33 | + </bean> | |
34 | + </property> | |
35 | + <property name="authenticationSuccessHandler"> | |
36 | + <bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler"> | |
37 | + <property name="defaultTargetUrl" value="/"/> | |
38 | + </bean> | |
39 | + </property> | |
40 | + <property name="proxyGrantingTicketStorage" ref="proxyGrantingTicketStorage"/> | |
41 | + <property name="proxyReceptorUrl" value="/secure/receptor"/> | |
42 | + </bean> | |
43 | + | |
44 | + <bean id="casProcessingFilterEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint"> | |
45 | + <property name="loginUrl" value="${authentication.url}/cas/login"/> | |
46 | + <property name="serviceProperties" ref="serviceProperties"/> | |
47 | + </bean> | |
48 | + | |
49 | + <bean id="casAuthenticationProvider" | |
50 | + class="org.springframework.security.cas.authentication.CasAuthenticationProvider" | |
51 | + p:key="central@123" | |
52 | + p:serviceProperties-ref="serviceProperties" | |
53 | + p:authenticationUserDetailsService-ref="userDetailsService"> | |
54 | + <property name="ticketValidator"> | |
55 | + <bean class="org.jasig.cas.client.validation.Saml11TicketValidator"> | |
56 | + <constructor-arg index="0" value="${authentication.url}/cas"/> | |
57 | + </bean> | |
58 | + </property> | |
59 | + </bean> | |
60 | + | |
61 | + <bean id="proxyGrantingTicketStorage" class="org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl"/> | |
62 | + | |
63 | + <bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties"> | |
64 | + <property name="service" value="${authentication.url}/cit-esi-listener-web/j_spring_cas_security_check"/> | |
65 | + <property name="sendRenew" value="false"/> | |
66 | + </bean> | |
67 | + | |
68 | + <bean id="userDetailsService" class="br.com.centralit.api.security.GrantedAuthorityFromAssertionAttributesUserDetailsService"> | |
69 | + <constructor-arg> | |
70 | + <list> | |
71 | + <value>authorities</value> | |
72 | + </list> | |
73 | + </constructor-arg> | |
74 | + </bean> | |
75 | + | |
76 | +</beans> | ... | ... |
cit-esi-listener-web/src/main/resources/spring/spring-security-db.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/spring/spring-security-db.xml | |
... | ... | @@ -0,0 +1,56 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + | |
4 | + ********************************************************************************************************************* | |
5 | + * LICENCA*GPLv2 * | |
6 | + * Copyright [2011,2012,2013,2014,2015] da CentralIT Tecnologia da Informação Ltda (www.centralit.com.br) * | |
7 | + * * | |
8 | + * Este arquivo é parte do programa/software: Citsmart (www.citsmart.com.br) * | |
9 | + * * | |
10 | + * O Citsmart é um software livre; você pode redistribui-lo e/ou modificá-lo dentro dos termos da Licença * | |
11 | + * Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versção 2 da Licença. * | |
12 | + * * | |
13 | + * Este programa/software é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma * | |
14 | + * garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral * | |
15 | + * GNU/GPL em português para maiores detalhes. * | |
16 | + * * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título 'LICENCA.txt', junto com este * | |
18 | + * programa/software, se não, acesse o Portal do Software Público Brasileiro no endereço www.softwarepublico.gov.br * | |
19 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,USA * | |
20 | + ********************************************************************************************************************* | |
21 | + | |
22 | +--> | |
23 | +<beans xmlns="http://www.springframework.org/schema/beans" | |
24 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
25 | + xmlns:p="http://www.springframework.org/schema/p" | |
26 | + xmlns:security="http://www.springframework.org/schema/security" | |
27 | + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | |
28 | + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> | |
29 | + | |
30 | + <security:global-method-security secured-annotations="enabled" /> | |
31 | + | |
32 | + <security:http auto-config="true" use-expressions="true" access-denied-page="/login?error=403"> | |
33 | + | |
34 | + <security:form-login login-page="/login" authentication-failure-url="/login?error=403" default-target-url="/sso2" /> | |
35 | + | |
36 | + <security:intercept-url pattern="/login" access="permitAll" /> | |
37 | + <security:intercept-url pattern="/resetPassword" access="permitAll" /> | |
38 | + <security:intercept-url pattern="/recoveryPassword" access="permitAll" /> | |
39 | + <security:intercept-url pattern="/requestRecoveryPassword" access="permitAll" /> | |
40 | + <security:intercept-url pattern="/j_spring_security_check" access="permitAll" /> | |
41 | + <security:intercept-url pattern="/modulos" access="permitAll" /> | |
42 | + <security:intercept-url pattern="/assets/**" access="permitAll" /> | |
43 | + <security:intercept-url pattern="/rest/esi/execute/**" access="permitAll" /> | |
44 | + <security:intercept-url pattern="/rest/esi/attachedFile/**" access="permitAll" /> | |
45 | + <security:intercept-url pattern="/**" access="isFullyAuthenticated()" /> | |
46 | + | |
47 | + | |
48 | + <security:logout invalidate-session="true" logout-success-url="/login" logout-url="/logout" /> | |
49 | + </security:http> | |
50 | + | |
51 | + <bean id="customAuthenticationProvider" class="br.com.centralit.api.security.CustomAuthenticationProvider" /> | |
52 | + | |
53 | + <security:authentication-manager> | |
54 | + <security:authentication-provider ref="customAuthenticationProvider" /> | |
55 | + </security:authentication-manager> | |
56 | +</beans> | |
0 | 57 | \ No newline at end of file | ... | ... |
cit-esi-listener-web/src/main/resources/spring/spring-security-openam.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/spring/spring-security-openam.xml | |
... | ... | @@ -0,0 +1,372 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!-- | |
3 | + | |
4 | + ********************************************************************************************************************* | |
5 | + * LICENCA*GPLv2 * | |
6 | + * Copyright [2011,2012,2013,2014,2015] da CentralIT Tecnologia da Informação Ltda (www.centralit.com.br) * | |
7 | + * * | |
8 | + * Este arquivo é parte do programa/software: Citsmart (www.citsmart.com.br) * | |
9 | + * * | |
10 | + * O Citsmart é um software livre; você pode redistribui-lo e/ou modificá-lo dentro dos termos da Licença * | |
11 | + * Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versção 2 da Licença. * | |
12 | + * * | |
13 | + * Este programa/software é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma * | |
14 | + * garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral * | |
15 | + * GNU/GPL em português para maiores detalhes. * | |
16 | + * * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título 'LICENCA.txt', junto com este * | |
18 | + * programa/software, se não, acesse o Portal do Software Público Brasileiro no endereço www.softwarepublico.gov.br * | |
19 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,USA * | |
20 | + ********************************************************************************************************************* | |
21 | + | |
22 | +--> | |
23 | +<beans xmlns="http://www.springframework.org/schema/beans" | |
24 | + xmlns:security="http://www.springframework.org/schema/security" | |
25 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
26 | + xmlns:context="http://www.springframework.org/schema/context" | |
27 | + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
28 | + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> | |
29 | + | |
30 | + <!-- Enable auto-wiring --> | |
31 | + <context:annotation-config/> | |
32 | + | |
33 | + <!-- Scan for auto-wiring classes in spring saml packages --> | |
34 | + <context:component-scan base-package="org.springframework.security.saml"/> | |
35 | + | |
36 | + <bean id="filterSecurityInterceptor" class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor"> | |
37 | + <property name="authenticationManager" ref="authenticationManager"></property> | |
38 | + <property name="accessDecisionManager" ref="affirmativeBased"></property> | |
39 | + <property name="securityMetadataSource" ref="optionsFromDataBaseFilterInvocationSecurityMetadataSource"></property> | |
40 | + <property name="validateConfigAttributes" value="true"/> | |
41 | + </bean> | |
42 | + | |
43 | + <bean id="optionsFromDataBaseFilterInvocationSecurityMetadataSource" class="br.com.centralit.api.security.MyFilterSecurityMetadataSource" /> | |
44 | + | |
45 | + <bean id="roleVoter" class="org.springframework.security.access.vote.RoleVoter" /> | |
46 | + | |
47 | + <bean id="affirmativeBased" class='org.springframework.security.access.vote.AffirmativeBased'> | |
48 | + <property name="decisionVoters"> | |
49 | + <list> | |
50 | + <ref bean="roleVoter"/> | |
51 | + </list> | |
52 | + </property> | |
53 | + </bean> | |
54 | + | |
55 | + <!-- Unsecured pages --> | |
56 | + <security:http security="none" pattern="/favicon.ico"/> | |
57 | + <security:http security="none" pattern="/images/**"/> | |
58 | + <security:http security="none" pattern="/css/**"/> | |
59 | + <security:http security="none" pattern="/logout.jsp"/> | |
60 | + <security:http security="none" pattern="/accessDeniedPage.htm"/> | |
61 | + | |
62 | + <security:global-method-security secured-annotations="enabled" /> | |
63 | + | |
64 | + <!-- Security for the administration UI --> | |
65 | + <security:http pattern="/saml/web/**" access-denied-page="/accessDeniedPage.htm"> | |
66 | + <security:form-login login-processing-url="/saml/web/login" login-page="/saml/web/metadata/login" default-target-url="/saml/web/metadata"/> | |
67 | + <security:intercept-url pattern="/saml/web/metadata/login" access="IS_AUTHENTICATED_ANONYMOUSLY"/> | |
68 | + <security:intercept-url pattern="/saml/web/**" access="ROLE_ADMIN"/> | |
69 | + <security:custom-filter before="FIRST" ref="metadataGeneratorFilter"/> | |
70 | + </security:http> | |
71 | + | |
72 | + <!-- Secured pages with SAML as entry point --> | |
73 | + <security:http entry-point-ref="samlEntryPoint" auto-config="true" access-denied-page="/accessDeniedPage.htm"> | |
74 | + <security:intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY"/> | |
75 | + <security:custom-filter before="FIRST" ref="metadataGeneratorFilter"/> | |
76 | + <security:custom-filter after="BASIC_AUTH_FILTER" ref="samlFilter"/> | |
77 | + </security:http> | |
78 | + | |
79 | + <!-- Filters for processing of SAML messages --> | |
80 | + <bean id="samlFilter" class="org.springframework.security.web.FilterChainProxy"> | |
81 | + <security:filter-chain-map request-matcher="ant"> | |
82 | + <security:filter-chain pattern="/saml/login/**" filters="samlEntryPoint"/> | |
83 | + <security:filter-chain pattern="/saml/logout/**" filters="samlLogoutFilter"/> | |
84 | + <security:filter-chain pattern="/saml/metadata/**" filters="metadataDisplayFilter"/> | |
85 | + <security:filter-chain pattern="/saml/SSO/**" filters="samlWebSSOProcessingFilter"/> | |
86 | + <security:filter-chain pattern="/saml/SSOHoK/**" filters="samlWebSSOHoKProcessingFilter"/> | |
87 | + <security:filter-chain pattern="/saml/SingleLogout/**" filters="samlLogoutProcessingFilter"/> | |
88 | + <security:filter-chain pattern="/saml/discovery/**" filters="samlIDPDiscovery"/> | |
89 | + <security:filter-chain pattern="/html/**" filters="filterSecurityInterceptor"/> | |
90 | + </security:filter-chain-map> | |
91 | + </bean> | |
92 | + | |
93 | + <!-- Handler deciding where to redirect user after successful login --> | |
94 | + <bean id="successRedirectHandler" class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"> | |
95 | + <property name="defaultTargetUrl" value="/"/> | |
96 | + </bean> | |
97 | + <!-- | |
98 | + Use the following for interpreting RelayState coming from unsolicited response as redirect URL: | |
99 | + <bean id="successRedirectHandler" class="org.springframework.security.saml.SAMLRelayStateSuccessHandler"> | |
100 | + <property name="defaultTargetUrl" value="/" /> | |
101 | + </bean> | |
102 | + --> | |
103 | + | |
104 | + <!-- Handler deciding where to redirect user after failed login --> | |
105 | + <bean id="failureRedirectHandler" | |
106 | + class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> | |
107 | + <property name="useForward" value="true"/> | |
108 | + <property name="defaultFailureUrl" value="/error.jsp"/> | |
109 | + </bean> | |
110 | + | |
111 | + <!-- Handler for successful logout --> | |
112 | + <bean id="successLogoutHandler" class="org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler"> | |
113 | + <property name="defaultTargetUrl" value="/logout.jsp"/> | |
114 | + </bean> | |
115 | + | |
116 | + <security:authentication-manager alias="authenticationManager"> | |
117 | + <!-- Register authentication manager for SAML provider --> | |
118 | + <security:authentication-provider ref="samlAuthenticationProvider"/> | |
119 | + <!-- Register authentication manager for administration UI --> | |
120 | + <security:authentication-provider> | |
121 | + <security:user-service id="adminInterfaceService"> | |
122 | + <security:user name="admin" password="admin" authorities="ROLE_ADMIN"/> | |
123 | + </security:user-service> | |
124 | + </security:authentication-provider> | |
125 | + </security:authentication-manager> | |
126 | + | |
127 | + <!-- Logger for SAML messages and events --> | |
128 | + <bean id="samlLogger" class="org.springframework.security.saml.log.SAMLDefaultLogger"/> | |
129 | + | |
130 | + <!-- Central storage of cryptographic keys --> | |
131 | + <bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager"> | |
132 | + <constructor-arg value="classpath:security/samlKeystore.jks"/> | |
133 | + <constructor-arg type="java.lang.String" value="nalle123"/> | |
134 | + <constructor-arg> | |
135 | + <map> | |
136 | + <entry key="apollo" value="nalle123"/> | |
137 | + </map> | |
138 | + </constructor-arg> | |
139 | + <constructor-arg type="java.lang.String" value="apollo"/> | |
140 | + </bean> | |
141 | + | |
142 | + <!-- Entry point to initialize authentication, default values taken from properties file --> | |
143 | + <bean id="samlEntryPoint" class="org.springframework.security.saml.SAMLEntryPoint"> | |
144 | + <property name="defaultProfileOptions"> | |
145 | + <bean class="org.springframework.security.saml.websso.WebSSOProfileOptions"> | |
146 | + <property name="binding" value="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/> | |
147 | + <property name="includeScoping" value="true"/> | |
148 | + </bean> | |
149 | + </property> | |
150 | + </bean> | |
151 | + | |
152 | + <!-- IDP Discovery Service --> | |
153 | + <bean id="samlIDPDiscovery" class="org.springframework.security.saml.SAMLDiscovery"> | |
154 | + <property name="idpSelectionPath" value="/WEB-INF/security/idpSelection.jsp"/> | |
155 | + </bean> | |
156 | + | |
157 | + <!-- Filter automatically generates default SP metadata --> | |
158 | + <bean id="metadataGeneratorFilter" class="org.springframework.security.saml.metadata.MetadataGeneratorFilter"> | |
159 | + <constructor-arg> | |
160 | + <bean class="org.springframework.security.saml.metadata.MetadataGenerator"> | |
161 | + <property name="entityId" value="grp.com"/> | |
162 | + </bean> | |
163 | + </constructor-arg> | |
164 | + </bean> | |
165 | + | |
166 | + <!-- bean id="metadataGeneratorFilter" class="org.springframework.security.saml.metadata.MetadataGeneratorFilter"> | |
167 | + <constructor-arg> | |
168 | + <bean class="org.springframework.security.saml.metadata.MetadataGenerator"> | |
169 | + <property name="extendedMetadata"> | |
170 | + <bean class="org.springframework.security.saml.metadata.ExtendedMetadata"> | |
171 | + <property name="entityId" value="teste"/> | |
172 | + <property name="idpDiscoveryEnabled" value="true"/> | |
173 | + </bean> | |
174 | + </property> | |
175 | + </bean> | |
176 | + </constructor-arg> | |
177 | + </bean --> | |
178 | + | |
179 | + <!-- The filter is waiting for connections on URL suffixed with filterSuffix and presents SP metadata there --> | |
180 | + <bean id="metadataDisplayFilter" class="org.springframework.security.saml.metadata.MetadataDisplayFilter"/> | |
181 | + | |
182 | + <!-- IDP Metadata configuration - paths to metadata of IDPs in circle of trust is here --> | |
183 | + <bean id="metadata" class="org.springframework.security.saml.metadata.CachingMetadataManager"> | |
184 | + <constructor-arg> | |
185 | + <list> | |
186 | + <!-- Example of classpath metadata with Extended Metadata --> | |
187 | + <bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate"> | |
188 | + <constructor-arg> | |
189 | + <bean class="org.opensaml.saml2.metadata.provider.ResourceBackedMetadataProvider"> | |
190 | + <constructor-arg> | |
191 | + <bean class="java.util.Timer"/> | |
192 | + </constructor-arg> | |
193 | + <constructor-arg> | |
194 | + <bean class="org.opensaml.util.resource.ClasspathResource"> | |
195 | + <constructor-arg value="/metadata/idp.xml"/> | |
196 | + </bean> | |
197 | + </constructor-arg> | |
198 | + <property name="parserPool" ref="parserPool"/> | |
199 | + </bean> | |
200 | + </constructor-arg> | |
201 | + <constructor-arg> | |
202 | + <bean class="org.springframework.security.saml.metadata.ExtendedMetadata"> | |
203 | + </bean> | |
204 | + </constructor-arg> | |
205 | + </bean> | |
206 | + <!-- Example of HTTP metadata without Extended Metadata --> | |
207 | + <bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider"> | |
208 | + <!-- URL containing the metadata --> | |
209 | + <constructor-arg> | |
210 | + <value type="java.lang.String">http://iam.cit.local:8080/openam/saml2/jsp/exportmetadata.jsp?realm=grp</value> | |
211 | + </constructor-arg> | |
212 | + <!-- Timeout for metadata loading in ms --> | |
213 | + <constructor-arg> | |
214 | + <value type="int">15000</value> | |
215 | + </constructor-arg> | |
216 | + <property name="parserPool" ref="parserPool"/> | |
217 | + </bean> | |
218 | + <!-- Example of file system metadata without Extended Metadata --> | |
219 | + <!-- | |
220 | + <bean class="org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider"> | |
221 | + <constructor-arg> | |
222 | + <value type="java.io.File">/usr/local/metadata/idp.xml</value> | |
223 | + </constructor-arg> | |
224 | + <property name="parserPool" ref="parserPool"/> | |
225 | + </bean> | |
226 | + --> | |
227 | + </list> | |
228 | + </constructor-arg> | |
229 | + <!-- OPTIONAL used when one of the metadata files contains information about this service provider --> | |
230 | + <!-- <property name="hostedSPName" value=""/> --> | |
231 | + <!-- OPTIONAL property: can tell the system which IDP should be used for authenticating user by default. --> | |
232 | + <!-- <property name="defaultIDP" value="http://localhost:8080/opensso"/> --> | |
233 | + </bean> | |
234 | + | |
235 | + <!-- SAML Authentication Provider responsible for validating of received SAML messages --> | |
236 | + <bean id="samlAuthenticationProvider" class="org.springframework.security.saml.SAMLAuthenticationProvider"> | |
237 | + <!-- OPTIONAL property: can be used to store/load user data after login --> | |
238 | + <!-- | |
239 | + <property name="userDetails" ref="bean" /> | |
240 | + --> | |
241 | + <property name="userDetails" ref="samlUserDetailsServiceBean" /> | |
242 | + </bean> | |
243 | + | |
244 | + <bean id="samlUserDetailsServiceBean" class="br.com.centralit.api.security.SAMLUserDetailsServiceImpl" /> | |
245 | + | |
246 | + <!-- Provider of default SAML Context --> | |
247 | + <bean id="contextProvider" class="org.springframework.security.saml.context.SAMLContextProviderImpl"/> | |
248 | + | |
249 | + <!-- Processing filter for WebSSO profile messages --> | |
250 | + <bean id="samlWebSSOProcessingFilter" class="org.springframework.security.saml.SAMLProcessingFilter"> | |
251 | + <property name="authenticationManager" ref="authenticationManager"/> | |
252 | + <property name="authenticationSuccessHandler" ref="successRedirectHandler"/> | |
253 | + <property name="authenticationFailureHandler" ref="failureRedirectHandler"/> | |
254 | + </bean> | |
255 | + | |
256 | + <!-- Processing filter for WebSSO Holder-of-Key profile --> | |
257 | + <bean id="samlWebSSOHoKProcessingFilter" class="org.springframework.security.saml.SAMLWebSSOHoKProcessingFilter"> | |
258 | + <property name="authenticationManager" ref="authenticationManager"/> | |
259 | + <property name="authenticationSuccessHandler" ref="successRedirectHandler"/> | |
260 | + <property name="authenticationFailureHandler" ref="failureRedirectHandler"/> | |
261 | + </bean> | |
262 | + | |
263 | + <!-- Logout handler terminating local session --> | |
264 | + <bean id="logoutHandler" | |
265 | + class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler"> | |
266 | + <property name="invalidateHttpSession" value="false"/> | |
267 | + </bean> | |
268 | + | |
269 | + <!-- Override default logout processing filter with the one processing SAML messages --> | |
270 | + <bean id="samlLogoutFilter" class="org.springframework.security.saml.SAMLLogoutFilter"> | |
271 | + <constructor-arg index="0" ref="successLogoutHandler"/> | |
272 | + <constructor-arg index="1" ref="logoutHandler"/> | |
273 | + <constructor-arg index="2" ref="logoutHandler"/> | |
274 | + </bean> | |
275 | + | |
276 | + <!-- Filter processing incoming logout messages --> | |
277 | + <!-- First argument determines URL user will be redirected to after successful global logout --> | |
278 | + <bean id="samlLogoutProcessingFilter" class="org.springframework.security.saml.SAMLLogoutProcessingFilter"> | |
279 | + <constructor-arg index="0" ref="successLogoutHandler"/> | |
280 | + <constructor-arg index="1" ref="logoutHandler"/> | |
281 | + </bean> | |
282 | + | |
283 | + <!-- Class loading incoming SAML messages from httpRequest stream --> | |
284 | + <bean id="processor" class="org.springframework.security.saml.processor.SAMLProcessorImpl"> | |
285 | + <constructor-arg> | |
286 | + <list> | |
287 | + <ref bean="redirectBinding"/> | |
288 | + <ref bean="postBinding"/> | |
289 | + <ref bean="artifactBinding"/> | |
290 | + <ref bean="soapBinding"/> | |
291 | + <ref bean="paosBinding"/> | |
292 | + </list> | |
293 | + </constructor-arg> | |
294 | + </bean> | |
295 | + | |
296 | + <!-- SAML 2.0 WebSSO Assertion Consumer --> | |
297 | + <bean id="webSSOprofileConsumer" class="org.springframework.security.saml.websso.WebSSOProfileConsumerImpl"> | |
298 | + <property name="responseSkew" value="500"></property> | |
299 | + </bean> | |
300 | + | |
301 | + <!-- SAML 2.0 Holder-of-Key WebSSO Assertion Consumer --> | |
302 | + <bean id="hokWebSSOprofileConsumer" class="org.springframework.security.saml.websso.WebSSOProfileConsumerHoKImpl"/> | |
303 | + | |
304 | + <!-- SAML 2.0 Web SSO profile --> | |
305 | + <bean id="webSSOprofile" class="org.springframework.security.saml.websso.WebSSOProfileImpl"/> | |
306 | + | |
307 | + <!-- SAML 2.0 Holder-of-Key Web SSO profile --> | |
308 | + <bean id="hokWebSSOProfile" class="org.springframework.security.saml.websso.WebSSOProfileConsumerHoKImpl"/> | |
309 | + | |
310 | + <!-- SAML 2.0 ECP profile --> | |
311 | + <bean id="ecpprofile" class="org.springframework.security.saml.websso.WebSSOProfileECPImpl"/> | |
312 | + | |
313 | + <!-- SAML 2.0 Logout Profile --> | |
314 | + <bean id="logoutprofile" class="org.springframework.security.saml.websso.SingleLogoutProfileImpl"/> | |
315 | + | |
316 | + <!-- Bindings, encoders and decoders used for creating and parsing messages --> | |
317 | + <bean id="postBinding" class="org.springframework.security.saml.processor.HTTPPostBinding"> | |
318 | + <constructor-arg ref="parserPool"/> | |
319 | + <constructor-arg ref="velocityEngine"/> | |
320 | + </bean> | |
321 | + | |
322 | + <bean id="redirectBinding" class="org.springframework.security.saml.processor.HTTPRedirectDeflateBinding"> | |
323 | + <constructor-arg ref="parserPool"/> | |
324 | + </bean> | |
325 | + | |
326 | + <bean id="artifactBinding" class="org.springframework.security.saml.processor.HTTPArtifactBinding"> | |
327 | + <constructor-arg ref="parserPool"/> | |
328 | + <constructor-arg ref="velocityEngine"/> | |
329 | + <constructor-arg> | |
330 | + <bean class="org.springframework.security.saml.websso.ArtifactResolutionProfileImpl"> | |
331 | + <constructor-arg> | |
332 | + <bean class="org.apache.commons.httpclient.HttpClient"> | |
333 | + <constructor-arg> | |
334 | + <bean class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager"/> | |
335 | + </constructor-arg> | |
336 | + </bean> | |
337 | + </constructor-arg> | |
338 | + <property name="processor"> | |
339 | + <bean class="org.springframework.security.saml.processor.SAMLProcessorImpl"> | |
340 | + <constructor-arg ref="soapBinding"/> | |
341 | + </bean> | |
342 | + </property> | |
343 | + </bean> | |
344 | + </constructor-arg> | |
345 | + </bean> | |
346 | + | |
347 | + <bean id="soapBinding" class="org.springframework.security.saml.processor.HTTPSOAP11Binding"> | |
348 | + <constructor-arg ref="parserPool"/> | |
349 | + </bean> | |
350 | + | |
351 | + <bean id="paosBinding" class="org.springframework.security.saml.processor.HTTPPAOS11Binding"> | |
352 | + <constructor-arg ref="parserPool"/> | |
353 | + </bean> | |
354 | + | |
355 | + <!-- Initialization of OpenSAML library--> | |
356 | + <bean class="org.springframework.security.saml.SAMLBootstrap"/> | |
357 | + | |
358 | + <!-- Initialization of the velocity engine --> | |
359 | + <bean id="velocityEngine" class="org.springframework.security.saml.util.VelocityFactory" factory-method="getEngine"/> | |
360 | + | |
361 | + <!-- XML parser pool needed for OpenSAML parsing --> | |
362 | + <bean id="parserPool" class="org.opensaml.xml.parse.StaticBasicParserPool" init-method="initialize"> | |
363 | + <property name="builderFeatures"> | |
364 | + <map> | |
365 | + <entry key="http://apache.org/xml/features/dom/defer-node-expansion" value="false"/> | |
366 | + </map> | |
367 | + </property> | |
368 | + </bean> | |
369 | + | |
370 | + <bean id="parserPoolHolder" class="org.springframework.security.saml.parser.ParserPoolHolder"/> | |
371 | + | |
372 | +</beans> | ... | ... |
cit-esi-listener-web/src/main/resources/spring/webmvc-context.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/resources/spring/webmvc-context.xml | |
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<beans xmlns="http://www.springframework.org/schema/beans" | |
3 | + xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
4 | + xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" | |
5 | + xsi:schemaLocation=" | |
6 | + http://www.springframework.org/schema/beans | |
7 | + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
8 | + http://www.springframework.org/schema/context | |
9 | + http://www.springframework.org/schema/context/spring-context-3.1.xsd | |
10 | + http://www.springframework.org/schema/mvc | |
11 | + http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> | |
12 | + | |
13 | + <mvc:annotation-driven> | |
14 | + <mvc:message-converters register-defaults="true"> | |
15 | + <bean id="jacksonMessageConverter" class="br.com.centralit.framework.json.CustomMappingJackson2"/> | |
16 | + </mvc:message-converters> | |
17 | + </mvc:annotation-driven> | |
18 | + | |
19 | + <mvc:default-servlet-handler /> | |
20 | + | |
21 | + <mvc:resources mapping="/resources/**" location="/resources/" /> | |
22 | + <mvc:resources mapping="/assets/**" location="/assets/" /> | |
23 | + | |
24 | + <!-- i18n --> | |
25 | + <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> | |
26 | + <property name="basename" value="WEB-INF/i18n" /> | |
27 | + <property name="defaultEncoding" value="UTF-8" /> | |
28 | + <property name="useCodeAsDefaultMessage" value="true" /> | |
29 | + </bean> | |
30 | + | |
31 | + <bean id="localeResolver" class="org.springframework.web.servlet.i18n.FixedLocaleResolver"> | |
32 | + <property name="defaultLocale" value="pt_BR" /> | |
33 | + </bean> | |
34 | + | |
35 | + <!-- View Handler --> | |
36 | + <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> | |
37 | + <property name="resourceLoaderPath" value="/html/" /> | |
38 | + </bean> | |
39 | + | |
40 | + <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> | |
41 | + <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> | |
42 | + <property name="prefix" value="/html/" /> | |
43 | + <property name="suffix" value=".jsp" /> | |
44 | + </bean> | |
45 | + | |
46 | + <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> | |
47 | + | |
48 | + <!-- setting maximum upload size --> | |
49 | + <property name="maxUploadSize" value="52428800" /> | |
50 | + | |
51 | + </bean> | |
52 | +</beans> | |
0 | 53 | \ No newline at end of file | ... | ... |
cit-esi-listener-web/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/webapp/WEB-INF/jboss-deployment-structure.xml | |
... | ... | @@ -0,0 +1,8 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<jboss-deployment-structure> | |
3 | + <deployment> | |
4 | + <dependencies> | |
5 | + <module name="br.com.citsmart-grp" /> | |
6 | + </dependencies> | |
7 | + </deployment> | |
8 | +</jboss-deployment-structure> | |
0 | 9 | \ No newline at end of file | ... | ... |
cit-esi-listener-web/src/main/webapp/WEB-INF/jboss-web.xml
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/webapp/WEB-INF/web.xml | |
... | ... | @@ -0,0 +1,109 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<web-app xmlns="http://java.sun.com/xml/ns/javaee" | |
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
4 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | |
5 | + version="3.0"> | |
6 | + <display-name>BPE/ESI</display-name> | |
7 | + <session-config> | |
8 | + <session-timeout>600</session-timeout> | |
9 | + </session-config> | |
10 | + <listener> | |
11 | + <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> | |
12 | + </listener> | |
13 | + <listener> | |
14 | + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | |
15 | + </listener> | |
16 | + <context-param> | |
17 | + <param-name>contextConfigLocation</param-name> | |
18 | + <param-value> | |
19 | + /WEB-INF/classes/spring/applicationContext.xml | |
20 | + </param-value> | |
21 | + </context-param> | |
22 | + | |
23 | + <!-- Configuracoes do properties --> | |
24 | + <context-param> | |
25 | + <param-name>contextInitializerClasses</param-name> | |
26 | + <param-value>br.com.centralit.framework.util.CustomApplicationContextInitializer</param-value> | |
27 | + </context-param> | |
28 | + <context-param> | |
29 | + <param-name>propertiesFile</param-name> | |
30 | + <param-value>classpath:cit-app.properties</param-value> | |
31 | + </context-param> | |
32 | + <context-param> | |
33 | + <param-name>propertiesFileLoadOrder</param-name> | |
34 | + <param-value>FIRST</param-value> | |
35 | + </context-param> | |
36 | + <!-- Este parametro controla a ordem na qual o arquivo de propriedades sera carregado --> | |
37 | + <!-- "FIRST": Os parametros do arquivo de propriedades sao carregados primero que os outros recursos no ambiente (System, JVM, JNDI Parameters). --> | |
38 | + <!-- "LAST": Os parametros do arquivo de propriedades sao carregados por ultimo que os outros recursos no ambiente (System, JVM, JNDI Parameters). --> | |
39 | + <!-- Por padrao o parametro eh "FIRST". --> | |
40 | + | |
41 | + <filter> | |
42 | + <filter-name>openSessionInViewFilter</filter-name> | |
43 | + <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class> | |
44 | + </filter> | |
45 | + <filter-mapping> | |
46 | + <filter-name>openSessionInViewFilter</filter-name> | |
47 | + <url-pattern>*.json</url-pattern> | |
48 | + </filter-mapping> | |
49 | + | |
50 | + <filter> | |
51 | + <filter-name>encoding-filter</filter-name> | |
52 | + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | |
53 | + <init-param> | |
54 | + <param-name>encoding</param-name> | |
55 | + <param-value>UTF-8</param-value> | |
56 | + </init-param> | |
57 | + </filter> | |
58 | + <filter-mapping> | |
59 | + <filter-name>encoding-filter</filter-name> | |
60 | + <url-pattern>/*</url-pattern> | |
61 | + </filter-mapping> | |
62 | + | |
63 | + <filter> | |
64 | + <filter-name>CAS Single Sign Out Filter</filter-name> | |
65 | + <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class> | |
66 | + </filter> | |
67 | + | |
68 | + <filter-mapping> | |
69 | + <filter-name>CAS Single Sign Out Filter</filter-name> | |
70 | + <url-pattern>/*</url-pattern> | |
71 | + </filter-mapping> | |
72 | + | |
73 | + <listener> | |
74 | + <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class> | |
75 | + </listener> | |
76 | + | |
77 | + <filter> | |
78 | + <filter-name>springSecurityFilterChain</filter-name> | |
79 | + <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> | |
80 | + </filter> | |
81 | + <filter-mapping> | |
82 | + <filter-name>springSecurityFilterChain</filter-name> | |
83 | + <url-pattern>/*</url-pattern> | |
84 | + </filter-mapping> | |
85 | + | |
86 | + <!-- CORS Filter --> | |
87 | + <filter> | |
88 | + <filter-name>cors</filter-name> | |
89 | + <filter-class>br.com.centralit.framework.filter.SimpleCORSFilter</filter-class> | |
90 | + </filter> | |
91 | + | |
92 | + <filter-mapping> | |
93 | + <filter-name>cors</filter-name> | |
94 | + <url-pattern>/*</url-pattern> | |
95 | + </filter-mapping> | |
96 | + | |
97 | + <servlet> | |
98 | + <servlet-name>spring</servlet-name> | |
99 | + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | |
100 | + <init-param> | |
101 | + <param-name>contextConfigLocation</param-name> | |
102 | + <param-value></param-value> | |
103 | + </init-param> | |
104 | + </servlet> | |
105 | + <servlet-mapping> | |
106 | + <servlet-name>spring</servlet-name> | |
107 | + <url-pattern>/</url-pattern> | |
108 | + </servlet-mapping> | |
109 | +</web-app> | |
0 | 110 | \ No newline at end of file | ... | ... |
cit-esi-listener-web/src/main/webapp/assets/js/angular/custom/.gitignore
0 → 100644
1 | +++ a/cit-esi-listener-web/src/main/webapp/assets/js/angular/custom/.gitignore | ... | ... |
1 | +++ a/pom.xml | |
... | ... | @@ -0,0 +1,60 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- ******************************************************************************************************************** --> | |
3 | +<!-- * LICENCA*GPLv2 * --> | |
4 | +<!-- * Copyright [2011,2012,2013,2014,2015] da CentralIT Tecnologia da Informação Ltda (www.centralit.com.br) * --> | |
5 | +<!-- * * --> | |
6 | +<!-- * Este arquivo é parte do programa/software: Citsmart (www.citsmart.com.br) * --> | |
7 | +<!-- * * --> | |
8 | +<!-- * O Citsmart é um software livre; você pode redistribui-lo e/ou modificá-lo dentro dos termos da Licença * --> | |
9 | +<!-- * Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença. * --> | |
10 | +<!-- * * --> | |
11 | +<!-- * Este programa/software é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma * --> | |
12 | +<!-- * garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral * --> | |
13 | +<!-- * GNU/GPL em português para maiores detalhes. * --> | |
14 | +<!-- * * --> | |
15 | +<!-- * Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título 'LICENCA.txt', junto com este * --> | |
16 | +<!-- * programa/software, se não, acesse o Portal do Software Público Brasileiro no endereço www.softwarepublico.gov.br * --> | |
17 | +<!-- * ou escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,USA * --> | |
18 | +<!-- ******************************************************************************************************************** --> | |
19 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
20 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
21 | + <modelVersion>4.0.0</modelVersion> | |
22 | + | |
23 | + <parent> | |
24 | + <groupId>br.com.centralit</groupId> | |
25 | + <artifactId>citsmart-grp-modules</artifactId> | |
26 | + <version>1.8.0-SNAPSHOT</version> | |
27 | + <relativePath>../cit-grp-modules</relativePath> | |
28 | + </parent> | |
29 | + | |
30 | + <artifactId>cit-esi-listener</artifactId> | |
31 | + <packaging>pom</packaging> | |
32 | + <name>cit-esi-listener</name> | |
33 | + | |
34 | + <properties> | |
35 | + <findbugs.config.path>${project.parent.parent.basedir}/filterfile.xml</findbugs.config.path> | |
36 | + <license.config.path>${project.parent.basedir}/src/licensing</license.config.path> | |
37 | + </properties> | |
38 | + | |
39 | + <!-- Gerencia as versoes dos modulos filhos --> | |
40 | + <dependencyManagement> | |
41 | + <dependencies> | |
42 | + <dependency> | |
43 | + <groupId>br.com.centralit</groupId> | |
44 | + <artifactId>cit-esi-listener-web</artifactId> | |
45 | + <version>${project.version}</version> | |
46 | + </dependency> | |
47 | + <dependency> | |
48 | + <groupId>br.com.centralit</groupId> | |
49 | + <artifactId>cit-esi-listener-api</artifactId> | |
50 | + <version>${project.version}</version> | |
51 | + </dependency> | |
52 | + </dependencies> | |
53 | + </dependencyManagement> | |
54 | + | |
55 | + <modules> | |
56 | + <module>cit-esi-listener-web</module> | |
57 | + <module>cit-esi-listener-api</module> | |
58 | + </modules> | |
59 | + | |
60 | +</project> | |
0 | 61 | \ No newline at end of file | ... | ... |