Please can anyone help me with encryption namespace and schema location in Mule 3.4.
I have this Configuration XML
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<encryption:config name="Encryption_PGP" defaultEncrypter="PGP_ENCRYPTER" doc:name="Encryption_PGP">
<encryption:pgp-encrypter-config publicKeyRingFileName="./mule.gpg" secretKeyRingFileName="./secring.gpg" secretAliasId="3879972755627455806" secretPassphrase="mule1234" principal="test1"/>
</encryption:config>
<flow name="sdsd">
<encryption:encrypt config-ref="Encryption_PGP" doc:name="Encryption" using="PGP_ENCRYPTER" input-ref="#[message.payload]">
<encryption:pgp-encrypter principal="fernando.martinez <fernando.martinez#mulesoft.com>" />
</encryption:encrypt>
</flow>
</mule>
But its giving me this error: The prefix "encryption" for element "encryption:config" is not bound.
To use the the message processors from the encryption namespace you need to install the Anypoint Enterprise Security module
You can find more informations about how to use it here
That said this is an EE only feature, so if you don't have an EE license you should probably use the PGP security instead
Related
We have camel based application.
Camel Context file is
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="CamelContext" xmlns="http://camel.apache.org/schema/spring" autoStartup="true">
<properties>
<property key="http.keepAlive" value="true"/>
</properties>
<threadPoolProfile id="profile"
defaultProfile="true"
keepAliveTime="30"
maxPoolSize="1500"
rejectedPolicy="DiscardOldest"
poolSize="1000"></threadPoolProfile>
<onException>
<exception>com.fasterxml.jackson.databind.exc.InvalidFormatException</exception>
<redeliveryPolicy maximumRedeliveries="0"/>
<handled>
<constant>true</constant>
</handled>
<to uri="bean:jacksonMappingExceptionHandler" />
<process ref="httpResponseTransformer"/>
</onException>
<restConfiguration component="jetty" bindingMode="json" contextPath="/app" port="9886" apiContextPath="/v1/api-doc" enableCORS="true">
<dataFormatProperty key="include" value="NON_NULL"></dataFormatProperty>
<apiProperty key="api.title" value="Application Service"/>
<apiProperty key="api.version" value="1.0.0"/>
<apiProperty key="cors" value="true"/>
</restConfiguration>
<!-- defines the rest services using the context-path /api -->
<rest path="/v1/abc" consumes="application/json" produces="application/json">
<description>Abc</description>
<post type="com.Request" outType="com.Response">
<to uri="direct-vm:JettyHttp"/>
</post>
</rest>
<rest path="/api/status" produces="application/json">
<description>Application Status</description>
<get outType="com.StatusResponse">
<description>Get Status</description>
<to uri="direct-vm:status"/>
</get>
</rest>
</camelContext>
</beans>
Some of the configuration are getting loaded from DB. Due to security, I won't be able to post full code over here.
We have written automation scripts to check validations on request.
In single specifications, we have more then 200 scenarios.
Issue: After certain amount of http request to uri, applications stops responding. I have added keepAlive property, as well as threadpool configuration in CamelContext.
However none this is working.
Kindly suggest me some work around.
Thanks in Advance.
Sometimes I receive ERR.SWS.HOST.CONNECTOR_ERROR while invoking eTicketCouponLLSRQ and sometimes I receive valid response. What is wrong?
Thank you!
I'm working in CERT, SRW version is 2.15.2 (SDK version), PCC Z4KB, EPR 1112
RQ:
<?xml version="1.0" encoding="UTF-8"?><eTicketCouponRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" TimeStamp="2018-04-23T10:36:18.907" Version="2.0.0">
<Ticketing eTicketNumber="5552484960880"/>
</eTicketCouponRQ>
RS:
<?xml version="1.0" encoding="UTF-8"?><eTicketCouponRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" TimeStamp="2018-04-23T10:36:18.907" Version="2.0.0">
<Ticketing eTicketNumber="XXXXXXXXX0880"/>
</eTicketCouponRQ><?xml version="1.0" encoding="UTF-8" standalone="no"?><eTicketCouponRS xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:stl="http://services.sabre.com/STL/v01" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.0">
<stl:ApplicationResults status="Unknown">
<stl:Error timeStamp="2018-04-23T01:33:59-05:00" type="Application">
<stl:SystemSpecificResults>
<stl:Message>Sending request to the Host failed</stl:Message>
<stl:ShortText>ERR.SWS.HOST.CONNECTOR_ERROR</stl:ShortText>
</stl:SystemSpecificResults>
</stl:Error>
</stl:ApplicationResults>
</eTicketCouponRS>
This is likely a timeout on a Sabre backend, meaning that it was not able to process it.
If you get many of this, I recommend you to contact the Sabre API helpdesk
I'm using Elastic Search for my project activities in which I communicated to the backend ES cluster through the spring utility
spring-data-elastic-search
Following are the spring-repository descriptions for the webapp.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"
xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<elasticsearch:transport-client id="client" cluster-nodes="localhost:9300" />
<bean name="elasticsearchTemplate"
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
<constructor-arg name="client" ref="client" />
</bean>
<elasticsearch:repositories
base-package="com.customer.repositories" />
</beans>
Here I've specified the cluster node configuration as cluster-nodes="localhost:9300" and it is working fine with my local testing.
In production server we've a full functional cluster setup with host IP say (192.xx.xx.xx). So my problem is that, we have specified the cluster host in a yml file in /etc/project/es.yml file in the production server. So I need to tweak my application to take the cluster configuration from this custom location.
Since the above spring-repository xml initialized by the spring container, we are unable to override the behaviour. Is there any way to achieve it with spring-data-elastic-search ?
Finally I resolved my issue and sharing it here, so that it may be useful to some one else.
Changed YML idea to property file (es.props)
spring repository descriptions should be as follows
<?xml version="1.0" encoding="UTF-8"?>co
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"
xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch
http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:property-placeholder location="file:/etc/project/es.props" />
<elasticsearch:transport-client id="client" cluster-nodes="${es-host}:9300""/>
<bean name="elasticsearchTemplate"
class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
<constructor-arg name="client" ref="client" />
</bean>
<elasticsearch:repositories
base-package="com.customer.repositories" />
</beans>
Which used Spring PropertySourcePlaceHolder modification mechanism in 3.1+.
So it will look up for es.host in /etc/project/es.props. Local testers can override this property by starting the server with -Des.host=custom-cluser-host
Actually Mohsin(Spring-data-elastic-search developer) gave hints to arrive at this solution. Thanks Mohsin.
Can someone please tell me how to configure JNDI name in SPRING MVC? I am using jboss version7.1.1 and DB is oracle 11g. I have defined the JNDI in jBoss server. How to mention the JNDI name in spring-servlet.xml? I have tried many options its not working. I am keep getting Name Not found exception.
<jee:jndi-lookup id="dataSource"
jndi-name="java:jboss/datasources/ExampleDS"
expected-type="javax.sql.DataSource" />
Where the value of jndi-name matches what you have configured in JBoss. You need to register jee namespace something like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
I have created a login page using a nice guide that I found about Java EE6 and GlassFish3 using netbeans.
After deploying the project when I try to reach the login page I get 'HTTP Status 403 - Access to the requested resource has been denied' from GlassFish3 server.
The url I am using is : http://localhost:9999/simplewebapp/admin/admin.jsp
The guide says that I should automatically be redirected to the login page I have created.
Instead I am receiving the above error.
Looking at the glassfish3 log I am getting these two lines when I am entering the above url.
INFO: JACC Policy Provider:Failed Permission Check: context (" simplewebapp/simplewebapp ") , permission (" (javax.security.jacc.WebUserDataPermission /admin/login.jsp GET) ")
INFO: JACC Policy Provider:Failed Permission Check: context (" simplewebapp/simplewebapp ") , permission (" (javax.security.jacc.WebUserDataPermission /admin/login.jsp GET:CONFIDENTIAL) ")
Some more details :
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<security-constraint>
<display-name>Admin Pages</display-name>
<web-resource-collection>
<web-resource-name>Administrative Pages</web-resource-name>
<description/>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>admin</description>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>file</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/loginerror.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>Administrators</description>
<role-name>admin</role-name>
</security-role>
<security-role>
<description>Users</description>
<role-name>user</role-name>
</security-role>
</web-app>
glassfish-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<security-role-mapping>
<role-name>admin</role-name>
<group-name>appadmin</group-name>
</security-role-mapping>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
What am I doing wrong here?
Thank you.
Problem solved.I had to add principal names in glassfish-web.xml and a role-name in web.xml.
Correct files :
web-xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<security-constraint>
<display-name>Admin Pages</display-name>
<web-resource-collection>
<web-resource-name>Administrative Pages</web-resource-name>
<description/>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>admin</description>
<role-name>AdminRole</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>file</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/loginerror.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>Administrators</description>
<role-name>AdminRole</role-name>
</security-role>
<security-role>
<description>Users</description>
<role-name>UserRole</role-name>
</security-role>
</web-app>
glassfish-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<security-role-mapping>
<role-name>AdminRole</role-name>
<principal-name>admin</principal-name>
<group-name>appadmin</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>UserRole</role-name>
<principal-name>user</principal-name>
<group-name>appuser</group-name>
</security-role-mapping>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
Using glassfish Admin Console this worked for me:
Select ‘server-config’ listed under Configurations and access the Security page. On that page
you need to enable the ‘Default Principal to Role Mapping’ option. The benefit of enabling this option is that it enables us to use roles defined for users shortly automatically without
requiring us to make formal XML declarations in a glassfish configuration file for our project.
For keeping it "standard" I think this is the better option, because if you're using just a web container (eg. tomcat), you're not gonna have to configure nothing else that just a realm. In my case, I was using Eclipse and had to undeploy the project and redeploy it.
Thank you very much.