Wso2 cant write groups in external LDAP - soap

I am configuring Wso2 with a read write external LDAP.
I am using the SOAP Api provided by Wso2 for managing users n groups.
However when trying to add a user to an internal group everything works fine but when i try to add a user to an external LDAP group i get that the role does not exist. Which is weird cause i can see the roles in Wso2. I even can i add a user to an external group from there but after it is added its not showed as added even it is actually added in the LDAP.
This is the ldap connection configuration
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>
<Property name="ConnectionURL">ldaps://some-url:636</Property>
<Property name="ConnectionName">cn=admin,ou=adminGroups,dc=userstore,dc=gk</Property>
<Property name="ConnectionPassword">someAdminPass</Property>
<Property name="AnonymousBind">false</Property>
<Property name="UserSearchBase">ou=users,dc=userstore,dc=gk</Property>
<Property name="UserEntryObjectClass">inetOrgPerson</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="UserNameSearchFilter">(&(objectClass=posixAccount)(uid=?))</Property>
<Property name="UserNameListFilter">(objectClass=posixAccount)</Property>
<Property name="DisplayNameAttribute"/>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="GroupSearchBase">ou=groups,dc=userstore,dc=gk</Property>
<Property name="GroupEntryObjectClass">posixGroup</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=posixGroup)(cn=?))</Property>
<Property name="GroupNameListFilter">(objectClass=posixGroup)</Property>
<Property name="MembershipAttribute">memberOf</Property>
<Property name="BackLinksEnabled">false</Property>
<Property name="UsernameJavaRegEx">someregex stuff</Property>
<Property name="UsernameJavaScriptRegEx">someregex stuff</Property>
<Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated</Property>
<Property name="PasswordJavaRegEx">someregex stuff</Property>
<Property name="PasswordJavaScriptRegEx">someregex stuff</Property>
<Property name="PasswordJavaRegExViolationErrorMsg">Password length should be within 5 to 30 characters</Property>
<Property name="RolenameJavaRegEx">someregex stuff</Property>
<Property name="RolenameJavaScriptRegEx">someregex stuff</Property>
<Property name="SCIMEnabled">true</Property>
<Property name="IsBulkImportSupported">false</Property>
<Property name="EmptyRolesAllowed">true</Property>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="MaxUserNameListLength">100</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"/>
</UserStoreManager>
I am using SoapUi to make this call having this request body
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://service.ws.um.carbon.wso2.org">
<soap:Header/>
<soap:Body>
<ser:updateRoleListOfUser>
<!--Optional:-->
<ser:userName>username</ser:userName>
<!--Zero or more repetitions:-->
<ser:deletedRoles>?</ser:deletedRoles>
<!--Zero or more repetitions:-->
<ser:newRoles>Users</ser:newRoles>
</ser:updateRoleListOfUser>
</soap:Body>
</soap:Envelope>
Seems that some configuration has gone wrong.Is there some special configuration needed to to that ?

This was a silly mistake. I am passing <ser:deletedRoles>?</ser:deletedRoles> and that is what actually throws the error saying that group does not exist.
About the part that i say
after it is added its not showed as added even it is actually added in
the LDAP
This has to do with a different setup that i use in my LDAP server. I have created an additional thread for this configuration issue.

Related

Encoding UTF-8 problem while JPA/hibernate execute sql-script with Intelli-J

Im developing a Jee webapp using JPA/Hibernate as ORM framework, PostgreSQL as db, and Tomcat as server.
When i start the app i want entitymanager to inject some data in my db.
I do that whith
<property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql"/>
in persistence.xml
Everything works fine except that i get some bad encoding like "Ardèche" instead of "Ardèche".
My whole project is in utf-8, my database too.
I had encoding output problems in Intelli-j terminal with tomcat, that i managed to resolve using -Dfile.encoding=UTF-8 in Help | Edit Custom VM Options.
But my data in my db is still wrong, even if in Intelli-J output i get the good result.
If i execute the script straight into pgadmin there is no problem.
I tried everything i could find to solve that, but nothing worked.
I probably have conflict in the configuration now, cause i tried too many different stuff.
My persistence.xml
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/DB" />
<property name="javax.persistence.jdbc.user" value="db" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
<property name="hibernate.connection.charSet" value="UTF-8"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
<property name="hibernate.connection.autocommit" value="true" />
</properties>
It's my first message on stackoverflow so i hope i did everything properly !
Thanks !
thanks for your answer, i just managed to fix it by adding <property name="hibernate.hbm2ddl.charset_name" value="UTF-8"/> to persistence.xml. I didn't check enough the hibernate doc !

How to add custom JNDI resources into wildfly-10 similar like <custom-resource> of glassfish server?

This is the code which is use to add custom resources in glassfish server but my requirement is to achieve this in wildfly-10 server but i don't know how to do it,so please help me with this
<custom-resource
factory-class="org.glassfish.resources.custom.factory.PropertiesFactory" res-
type="java.util.Properties" jndi-name="docdokuplm.config">
<property name="codebase" value="http://localhost:9001"></property>
<property name="vaultPath" value="/var/lib/docdoku"></property>
</custom-resource>
<custom-resource
factory-class="org.glassfish.resources.custom.factory.PropertiesFactory" res-
type="java.util.Properties" jndi-name="auth.config">
<property name="basic.header.enabled" value="true"></property>
<property name="session.enabled" value="true"></property>
<property name="jwt.key" value="singh20111995"></property>
<property name="jwt.enabled" value="true"></property>
</custom-resource>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<object-factory name="java:/docdokuplm.config" module="net.flexoptix.jbossTools" class="net.flexoptix.jbossTools.PropertiesFactory">
<environment>
<property name="vaultPath" value="/var/lib/docdoku"/>
<property name="codebase" value="http://localhost:8080"/>
</environment>
</object-factory>
you can add subsystem to add custom JNDI in wildfly.

Getting exceptions (Missing descriptor / No [EntityType] was found for the key class) on the below scenario

Getting exceptions (Missing descriptor / No [EntityType] was found for the key class) on below scenario.
Start the weblogic server
Deploy the WAR
Test the application ‘n’ of times
Delete the WAR from web logic admin console
Re deploy the same WAR
Basically, if we do redeploy we will got the above exception. This issue will get resolved if you restart the server.
Persistence.xml
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>DEV</jta-data-source>
<class>com.Class1</class>
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="eclipselink.allow-zero-id" value="true"/>
<property name="eclipselink.logging.level" value="FINE" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.target-server" value="WebLogic"/>
<property name="javax.persistence.query.timeout" value="120000"/>
<property name="javax.persistence.lock.timeout" value="120000"/>
</properties>
</persistence-unit>
Bean Configuration to handle spring transaction
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath*:META-INF/persistence.xml"/>
<property name="persistenceUnitManager" ref="persistenceUnitManager" />
</bean>
<bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="persistenceXmlLocations">
<list>
<value>classpath*:META-INF/persistence.xml</value>
</list>
</property>
<property name="loadTimeWeaver" ref="loadTimeWeaver"/>
</bean>
<bean id="loadTimeWeaver" class="org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver"/>
<bean id="em" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
The WL Server throwing this error because of the ServerSession is cached in the EntityManagerSetupImpl static, so on createEntityManagerFactory() the old one is used with the old descriptors/class before the redeployment.
**
We managed to take the EntityManagerFactory Object and closed the same
in the destroy method in one of the InitializerServlet.
**

How do I properly setup SQL logging for EclipseLink?

I want to see the generated SQL statements from EclipseLink. The persistence.xml contains the following properties:
<properties>
<property name="eclipselink.logging.file" value="/workspace/logs/JPA.log" />
<property name="eclipselink.logging.level" value="ALL" />
<property name="eclipselink.logging.level.sql" value="ALL" />
<property name="eclipselink.logging.logger" value="JavaLogger"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mariadb://192.168.178.42:3306/halsol" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="pw" />
<property name="jdbc.persistence.logging" value="true" />
<property name="jdbc.persistence.logfile" value="/workspace/logs/JDBC.log" />
</properties>
The file "JPA.log" gets generated (as well as JDBC.log) but is has no contents after loading some rows from the database. I'm using EclipseLink 2.5.
I tried the same properties you have, it should work if you remove the following line:
<property name="eclipselink.logging.logger" value="JavaLogger"/>
The eclipselink.logging.logger parameter is provided for overriding default eclipselink logger.
Try either not setting this property or setting up java.util.logging within your application.

BIRT- format parameter

I am using Eclipse BIRT Designer Version 4.3.2.v20140211-1400 Build 4.3.2.v20140211-1526 against Sybase ASE. I want the user prompt for two date parameters to format as 7-30-14. Currently the default is showing 2014-7-30.
Per recommendations from other postings I chose Properties for the Parameter from the Eclipse Outline view. In the Edit Properties under Display As it shows the Custom Format I selected M/d/yy and the Preview shows 7/30/14. However, when I run the report it still requires me to enter it as yyyy-mm-dd and errors out with a bad date any other way.
Am I missing something else?
Here is the xml for the parameters
<parameters>
<scalar-parameter name="report_dt" id="85">
<text-property name="promptText">Enter Date as MM/dd/yy</text-property>
<property name="valueType">static</property>
<property name="isRequired">true</property>
<property name="dataType">date</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="javascript">params["end_dt"].value</value>
</simple-property-list>
<list-property name="selectionList"/>
<property name="paramType">simple</property>
<property name="controlType">text-box</property>
<structure name="format">
<property name="category">Custom</property>
<property name="pattern">M/d/yy</property>
</structure>
</scalar-parameter>
<scalar-parameter name="end_dt" id="88">
<text-property name="promptText">Enter the end of the range. By default this will be the same as the start date</text-property>
<property name="valueType">static</property>
<property name="isRequired">true</property>
<property name="dataType">date</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="javascript">params["report_dt"].value</value>
</simple-property-list>
<list-property name="selectionList"/>
<property name="paramType">simple</property>
<property name="controlType">text-box</property>
<structure name="format">
<property name="category">Custom</property>
<property name="pattern">M/d/yy</property>
</structure>
</scalar-parameter>
</parameters>