How to set session timeout at embedd jetty xml configuration? - jetty

I have that line of codes at my jetty-servlet-context.xml
<bean id="jerseyServletCtx" class="org.eclipse.jetty.servlet.ServletContextHandler">
<property name="displayName" value="Jersey Servlet Context"/>
<property name="contextPath" value="/rest"/>
<property name="sessionHandler">
<bean class="org.eclipse.jetty.server.session.SessionHandler"/>
</property>
...
How can I add an ability to set maxInactiveInterval into my xml file? Maybe I am missing something it may be anywhere else instead of that jerseyServletCtx, but it should be at jetty-servlet-context.xml. Any ideas are welcome.
PS: I don't have a web.xml

Your question is almost a year old, but in case it might help you or someone else: you may want to review webdefault.xml and check the session-timeout element within the session configuration section.

Related

How to configure password expire time in bulk import from CSV in WSO2 Identity Server 5.3.0

Hi I am using WSO2 Identity Server 5.3.0. I want to create users by using bulk import from a CSV File. I am able to do it successfully.
Problem Statement:
Users are created successfully but in the documentation link, it is mentioned that the default password expiry for the users is 24 hours. Is there any way possible through configuration that we can turn this setting off. OR Increase the time for this password expiry.
Document Link:
I enabled the Bulk storage from user-mgt.xml file.
<Property name="MembershipAttribute">member</Property>
<Property name="BackLinksEnabled">false</Property>
<Property name="UsernameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaRegExViolationErrorMsg">Password length should be within 5 to 30 characters</Property>
<Property name="RolenameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="SCIMEnabled">true</Property>
<Property name="IsBulkImportSupported">true</Property>
<Property name="EmptyRolesAllowed">true</Property>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="MaxUserNameListLength">500</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="kdcEnabled">false</Property>
<Property name="defaultRealmName">WSO2.ORG</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ConnectionPoolingEnabled">false</Property>
<Property name="LDAPConnectionTimeout">5000</Property>
<Property name="ReadTimeout"/>
<Property name="RetryAttempts"/>
But I cannot find any configuration here to configure this time.
One other hack would be directly removing this password expiry property for all the users from the userstore database directly. You can simply set "UM_REQUIRE_CHANGE" value for all the users to make their passwords work even after 24hours.
UPDATE UM_USER SET UM_REQUIRE_CHANGE=FALSE;
Further explained in https://stackoverflow.com/a/57944771/2910841
Currently, Identity Server does not have an out-of-box configuration option for making the password validity period to increase or to turn the setting off. However, we can accomplish your requirement of not invalidating the password by writing a custom component by extending relevant UserStoreManager. For this purpose you can write a custom userstore manager extending the default JDBCUserStoreManager which will make the password to be valid for an indefinite period. Please refer [1] for more information regarding this. In this sample extension, you need to only override the method "doAddUser()" by making requestPasswordChange variable to false in order to avoid the invalidation of the password. Sample code is as follows.
public void doAddUser(String userName, Object credential, String[] roleList,
Map<String, String> claims, String profileName, boolean requirePasswordChange)
throws UserStoreException {
super.doAddUser(userName, credential, roleList, claims, profileName, false);
}
[1] https://docs.wso2.com/display/IS530/Writing+a+Custom+User+Store+Manager

WSO2 IS error when creating user store

When I try to create an LDAP Base user store in WSO2 IS 5.3.0 I always get the following error:
TID: [-1234] [] [2017-04-03 11:40:49,521] ERROR {org.wso2.carbon.identity.user.store.configuration.UserStoreConfigAdminService} - Error occurred during the transformation process of C:\WSO2IS~1.0\bin\..\repository\deployment\server\userstores\myUserStore.xml
org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException: Error occurred during the transformation process of C:\WSO2IS~1.0\bin\..\repository\deployment\server\userstores\myUserSotre.xml
I have tried previous version and it fails till 5.0.0, in which I succeed in create the user store. User store config in WSO2 ESB seems to works the same way that WSO2 IS user store, so, I configured the user store in WSO2 ESB, and copy the myUserSotre.xml generated by WSO2 ESB just in the same path where IS failed to find the file.
That worked, and result in WSO2 IS recognizing the User Store. I can see the users from the user store in WSO2 IS user store. However, if I try update the "forced" user store, it keeps throwing the error.
I am using windows 7 and jdk 8.
This is the xml from ESB and IS 5.0.0 that works if I paste it in IS 5.3
<?xml version="1.0" encoding="UTF-8"?>
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">
<Property name="ConnectionName">cn=Manager,dc=company,dc=com</Property>
<Property name="ConnectionURL">ldap://IP:HOST</Property>
<Property name="ConnectionPassword">password</Property>
<Property name="UserSearchBase">ou=People,dc=company,dc=com</Property>
<Property name="Disabled">false</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="UserNameSearchFilter">(&(objectClass=person)(uid=?))</Property>
<Property name="ReadOnly">true</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="ReadGroups">false</Property>
<Property name="GroupSearchBase">ou=system</Property>
<Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=groupOfNames)(cn=?))</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>
<Property name="MemberOfAttribute"/>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="ReplaceEscapeCharactersAtUserLogin">true</Property>
<Property name="DomainName">ldap</Property>
<Property name="Description"/>
</UserStoreManager>
Is there any issue about this? Is there extra configuration needed?
This happens in Windows because of the file path encoding. Currently this is not fixed from WSO2 side. As a work around, you can rename WSO2IS~1.0 folder not contain the '~' character. eg. rename it with WSO2IS and try.
The solution is simple. Set environment variable CARBON_HOME to the path of your wso2 IS folder.

How to handle relative paths of xsds while publishing wsdl in spring web services?

I have a Soap web services exposed through Springs...
I need to expose the WSDL for the same. My Bean definition to expose the WSDL is as shown below.
<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<description>
This bean wrap the messages.xsd (which imports types.xsd), and inlines them as a one.
</description>
<property name="xsds">
<list>
<value>/WEB-INF/classes/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201301UV02.xsd</value>
<value>/WEB-INF/classes/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201302UV02.xsd</value>
<value>/WEB-INF/classes/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201304UV02.xsd</value>
<value>/WEB-INF/classes/schema/HL7V3/NE2008/multicacheschemas/MCCI_IN000002UV01.xsd</value>
<value>/WEB-INF/classes/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201309UV02.xsd</value>
<value>/WEB-INF/classes/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201310UV02.xsd</value>
</list>
</property>
<property name="inline" value="true"/>
</bean>
<bean id="pixManager" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schemaCollection" ref ="schemaCollection"/>
<property name="portTypeName" value="PIXManager_PortType"/>
<property name="locationUri" value="/services/pixManager/"/>
</bean>
The problem I am facing here is I have child XSDs that are referred from these XSDs as shown below which is not getting resolved.
<xs:include schemaLocation="../coreschemas/infrastructureRoot.xsd"/>
I am getting the following error..
Caused by: org.springframework.xml.xsd.commons.CommonsXsdSchemaException: Schema [ServletContext resource [/WEB-INF/classes/schema/HL7V3/NE2008/multicaches
chemas/PRPA_IN201301UV02.xsd]] could not be loaded; nested exception is java.lang.IllegalArgumentException: The resource path [/../coreschemas/infrastructu
reRoot.xsd] has been normalized to [null] which is not valid
Where [/../coreschemas/infrastructu
reRoot.xsd] is the relative path of the child XSDs.
You need extract only schemas required for your interaction(s), so the folder structure will be like this:
../coreschemas
../schemas
and then "flatten" an interaction schema and related schemas into one which you may then embed into your WSDL.

Checkstyle regexp not working for annotated lines?

I try to configure a Checkstyle rule to show me Tests marked with a specific TestGroup named FIXME to identify how many of such tests there are (to keep them tracked).
A typical test method looks like this:
#Test(groups = {TestGroups.GAMEHISTORY, TestGroups.FIXME}, description = "Some descriptive text...")
public void navigateThroughGameHistory() throws Exception {
PlayerDTO player = ghHelper.createConfirmedPlayerAndPayIn(TestBase.LANGUAGE);
... some more code ...
}
I tried my very best with various CheckStyle rules (RegExp with Single & Multiline, RegExpJava etc.), but it seems the Checkstyle does not parse lines containing annotations.
The simplest way to find an occurrence of FIXME to me seems the following:
<module name="Regexp">
<property name="severity" value="warning"/>
<property name="format" value=".*FIXME.*"/>
<property name="illegalPattern" value="true"/>
<property name="duplicateLimit" value="-1"/>
<property name="errorLimit" value="100"/>
<property name="ignoreComments" value="false"/>
<property name="message" value="Keep track of the FIXME-Tests!"/>
</module>
However, this does not work. However, if I change the format line to
<property name="format" value=".*player.*"/>
, I get one occurrence. I believe Checkstyle doesn't check Annotated Lines of Code by default - but I could not find any evidence for it.
But maybe my RegEx is just incorrect (simple as it is)?
I am desperate, because I am sure there is a simple solution, but I just can't find it..
Any help greatly appreciated!
Thanks in advance,
Jan

How to call sequence in Task Scheduler in wso2 esb

I want to run a proxy(pass through) or a sequence(pass through type) repeatatively after every 60 seconds so i started with Task Scheduler but i am not able to figure out how can i achieve my requirement using Task Scheduler. I want to execute my proxy or sequence after every 60 seconds.Like in wso2 BPS we can achieve this thing using loops, Likewise is there anything in esb that can schedule run a proxy or sequence after certain interval of time? Looking forward to your answers.
Thanks in advance.
IS it possible to achieve above requirement in wso2 esb. Please Help.
You can use the task to run a proxy service which is configured in your ESB. You need to configure the task as below.
Here is a sample configuration to access the SimpleStockQuoteService sample service which comes with the ESB. You can replace the value of the "to" property to match your proxy endpoint and set the desired message.
<task class="org.apache.synapse.startup.tasks.MessageInjector" name="CheckPrice">
<property name="to" value="http://localhost:9000/services/SimpleStockQuoteService"/>
<property name="soapAction" value="urn:getQuote"/>
<property name="message">
<m0:getQuote xmlns:m0="http://services.samples">
<m0:request>
<m0:symbol>IBM</m0:symbol>
</m0:request>
</m0:getQuote>
</property>
<trigger interval="5"/>
</task>
Form WSO2 ESB version 4.7.0 new properties are added to task component. Using those we can call a proxy service or sequence from our task scheduler. Below are my sample code for calling a proxy service
<task name="DBPOller"
class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz">
<trigger count="2" interval="5"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="soapAction"
value="urn:getRequestForm"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
<p:getRequestForm xmlns:p="http://ws.wso2.org/dataservice"><!--Exactly 1 occurrence--><p:isRead>n</p:isRead>
</p:getRequestForm>
</property>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="injectTo"
value="proxy"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="proxyName"
value="DBPollerService"/>
</task>