shibboleth idp with OpenLDAP integration / Uncaught runtime exception java.lang.NullPointerException: null - shibboleth

I got install shibboleth idp with OpenLDAP integration
, it authenticate successfully but
it return exception error
Uncaught runtime exception java.lang.NullPointerException: null
the log file contains
Attribute Resolver 'ShibbolethAttributeResolver': Removing result of attribute definition 'uid', contains no values
Attribute Resolver 'ShibbolethAttributeResolver': Removing result of attribute definition 'mail', contains no values
and
the attribute-resolver.xml file contains
<AttributeDefinition xsi:type="Simple" id="uid">
<InputDataConnector ref="myLDAP" attributeNames="uid" />
<AttributeEncoder xsi:type="SAML1String" name="urn:mace:dir:attribute-def:uid" encodeType="false" />
<AttributeEncoder xsi:type="SAML2String" name="urn:oid:0.9.2342.19200300.100.1.3" friendlyName="uid" encodeType="false" />
</AttributeDefinition>
Thanks,

I found that it's a bug in shibboleth idp 4.0 ,
it should be fixed in the next version

Related

Apache Knox Ldap Integration failed

I am using Apacheknox version 1.0.0. I have tried to authenticate knox uiusing Ldap user. I have tried with following changes in knox
In ambari --> knox-->config-->Advanced topology
<param>
<name>main.ldapRealm.userDnTemplate</name>
<value>cn=admin</value>
</param>
<param>
<name>main.ldapRealm.contextFactory.url</name>
<value>ldap://x.x.x.x:10390</value>
</param>
First Iam trying for single user only.I have tried different user search But no luck I am always getting same error like below.
2021-01-29 10:22:07,266 ERROR knox.gateway (KnoxLdapRealm.java:doGetAuthenticationInfo(206)) - Shiro unable to login: javax.naming.AuthenticationException: [LDAP: error
code 49 - INVALID_CREDENTIALS: Bind failed: Invalid authentication]
LDAP: error code 49 - INVALID_CREDENTIALS Means, three things, Username/password is incorrect or the account is locked. You are having this error for Bind user.
You need to verify you systemUsername and systemPassword in configured topology.
A tool ldapsearch can be useful to verify credentials for Bind user.
main.ldapRealm.userDnTemplate should be like following
<param>
<name>main.ldapRealm.userDnTemplate</name>
<value>cn={0},ou=hadoop,ou=personal,ou=accounts,dc=example,dc=com</value>
</param>

LDAP invalid login credentials

I installed sldap on my ubuntu 12.04 system.https://help.ubuntu.com/community/OpenLDAPServer
I can add /search records to lsdap from terminal.e.g. I can add ldif file.
ldapadd -x -D cn=admin,dc=test,dc=com -W -f ldap-add.ldif
and it ask me password .I entered pass000 and it added new entry.its working fine .i can add search records from terminal. Now I tried It from my spring application .i added dependency ldap-core to my pom .i set up bean etc. every thing is fine except it gives me error in valid credetials thouh I entered same as I entered while ading ldif file from terminal. My bean configuration is
<!-- ldap template -->
<ldap:context-source id="contextSource" url="ldap://localhost:389"
base="dc=test,dc=com" username="cn=admin" password="pass000" />
<ldap:ldap-template id="ldapTemplate"
context-source-ref="contextSource" />
<bean id="personDao" class="com.cheasyy.cofinding.dao.PersonDaoImpl">
<property name="ldapTemplate" ref="ldapTemplate" />
</bean>
It gives error
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.ldap.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:205)
com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:266)
root cause
org.springframework.ldap.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:191)
org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:356)
org.springframework.ldap.core.support.AbstractContextSource.doGetContext(AbstractContextSource.java:140)
If with same credentials I can add ldif file from terminal then why not with my spring application?is their anything missing in configuration?
The 'username' DN needs to be the full DN of the admin user, including the base; in your case:
<ldap:context-source id="contextSource" url="ldap://localhost:389"
base="dc=test,dc=com" username="cn=admin,dc=test,dc=com" password="pass000" />
It's not uncommon for the admin user to be located in a different part of the LDAP tree than the base DN from which you want your operations to originate.

org.hibernate.exception.GenericJDBCException: Cannot open connection] with root cause java.sql.SQLException:

Hello I m still new with spring and hibernate it s my first app tryin to get connected to db but I m getting this excepton HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
and in the console: org.hibernate.exception.GenericJDBCException: Cannot open connection] with root cause java.sql.SQLException:
Access denied for user 'root'#'localhost' (using password: YES)
Can anyone help me plz I cheched the connection with other java app it worked perfectly!
database.properties
database.driver=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/DAVDB
database.user=root
database.password=''
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=update
Your database.properties is not correct:
database.password=''
Should be:
database.password=
Assuming you want an empty password. Quotes have no special meaning in property files, so they will be taken as literal.

event:inbound-channel-adapter with payload-expression not able to resolve bean

I'm attempting to use the event:inbound-channel-adapter as an ApplicationEventListener to capture the ContextRefreshedEvent so I can dynamically start a file:inbound-channel-adapter like:
<file:inbound-channel-adapter id="filesIn" auto-startup="false"
directory="${input.location}" channel="fileInChannel">
<integration:poller ref="filesInPoller" />
</file:inbound-channel-adapter>
<event:inbound-channel-adapter id='appStarter' channel="nullChannel"
error-channel="errorChannel"
event-types="org.springframework.context.event.ContextRefreshedEvent"
payload-expression="#filesIn.start()"/>
But I get the following error indicating the sPel payload-expression cannot find the filesIn bean:
Exception in thread "main" org.springframework.expression.spel.SpelEvaluationException: EL1057E:(pos 1): No bean resolver registered in the context to resolve access to bean 'filesIn'
at org.springframework.expression.spel.ast.BeanReference.getValueInternal(BeanReference.java:45)
at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:49)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:72)
at org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer.sendEventAsMessage(ApplicationEventListeningMessageProducer.java:113)
at org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer.onApplicationEvent(ApplicationEventListeningMessageProducer.java:91)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
Am I correct in believing that the file:inbound-channel-adapter is able to be started in this way?
Thanks
What version of Spring Integration are you using? The ability to reference a bean #filesIn was added to this adapter in 3.0.
If you are using 2.2 or below, upgrade to the current release (or at least 3.0.4).
In any case, you can't just send that command to nullChannel, it will evaluate to null and you can't have a null payload; you'll have to send '#filesIn.start()' to a <control-bus/>.
EDIT:
Or, "#filesIn.start() == null ? 'foo' : 'bar'" will send foo to the nullChannel.

XmlRpcException during TeamCity build agent registration

I have installed the TeamCity build agent on my machine a few different ways- using Java Web Start and the manual .zip distribution. Both result in viable installations, as I have once or twice been able to connect and register properly with the TeamCity server. However, upon restarting (<install_location>/bin/agent.sh stop...<install_location>/bin/agent.sh start) I get the following error in teamcity-agent.log (with extra debugging turned on in the log4j config file).
[2013-04-03 09:05:09,870] DEBUG - jetbrains.buildServer.XMLRPC - faultStringjava.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.faultCode0
[2013-04-03 09:05:09,878] DEBUG - buildServer.AGENT.registration - jetbrains.buildServer.xmlrpc.RemoteCallException: Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
jetbrains.buildServer.xmlrpc.RemoteCallException: Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
at jetbrains.buildServer.xmlrpc.AbstractXmlRpcTarget.call(AbstractXmlRpcTarget.java:94)
at jetbrains.buildServer.agent.impl.ServerXmlRpcProxy.registerAgent3(ServerXmlRpcProxy.java:62)
at jetbrains.buildServer.agent.impl.BuildAgentImpl.doRegisterOnBuildServer(BuildAgentImpl.java:776)
at jetbrains.buildServer.agent.impl.BuildAgentImpl.registerOnBuildServer(BuildAgentImpl.java:748)
at jetbrains.buildServer.agent.impl.ServerMonitor.run(ServerMonitor.java:71)
Caused by: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeException(XmlRpcClientResponseProcessor.java:104)
at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeResponse(XmlRpcClientResponseProcessor.java:71)
at org.apache.xmlrpc.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:73)
at org.apache.xmlrpc.TCXmlRpcClient$1.execute(TCXmlRpcClient.java:89)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:194)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178)
at jetbrains.buildServer.xmlrpc.impl.CommonsXmlRpcTargetImpl$1.execute(CommonsXmlRpcTargetImpl.java:72)
at jetbrains.buildServer.xmlrpc.AbstractXmlRpcTarget.call(AbstractXmlRpcTarget.java:84)
... 4 more
[2013-04-03 09:05:09,878] WARN - buildServer.AGENT.registration - Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
[2013-04-03 09:05:09,878] WARN - buildServer.AGENT.registration - Connection to TeamCity server is probably lost. Will be trying to restore it. Take a look at logs/teamcity-agent.log for details (unless you're using custom logging).
This is the xml in question according to the logs with extra xmlrpc debugging:
<?xml version="1.0"?><methodCall><methodName>buildServer.registerAgent3</methodName><params><param><value><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<agentDetails agentName="aaronhbox_0" agentPort="9090" authToken="" osName="Linux, version 3.5.0-17-generic">
<alternativeAddresses>
<address>10.2.1.232</address>
<address>192.168.225.1</address>
<address>192.168.80.1</address>
</alternativeAddresses>
<availableRunners>
<runner runType="Ant" />
<runner runType="Duplicator" />
<runner runType="gradle-runner" />
<runner runType="Inspection" />
<runner runType="Ipr" />
<runner runType="JPS" />
<runner runType="Maven2" />
<runner runType="rake-runner" />
<runner runType="simpleRunner" />
</availableRunners>
<availableVcs>
<vcs name="perforce" />
<vcs name="mercurial" />
<vcs name="jetbrains.git" />
<vcs name="svn" />
<vcs name="cvs" />
</availableVcs>
<buildParameters>
<param name="env.COLORTERM" value="gnome-terminal" />
<param name="env.COMP_WORDBREAKS"><![CDATA["'><;|]]></value></param></params></methodCall>
Only once have I been able to restart the agent and have it connect again properly. Generally, I can install it, have it run once, then restarting it gives this error. Any ideas?
It looks like the formatting of the COMP_WORDBREAKS environment variable was messing with the xml structure and not allowing the complete generation of the xml request message.
The COMP_WORDBREAKS value on my machine is "'><;|&(:.
Placing the following line in the buildAgent.properties file fixed this problem and allows the agent to properly register.
env.COMP_WORDBREAKS=
I don't see any side-effects yet of making this change; the agent now seems to behave properly.

Resources