Hi,
We use the Coocoon authentication block in our web app through the following
dependency in our pom.xml:
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-auth-impl</artifactId>
<version>1.0.0</version>
</dependency>
In our Spring configuration we have declated a simple security handler and a
standard application:
<bean name="org.apache.cocoon.auth.SecurityHandler/Sublima"
class="com.computas.sublima.app.controller.admin.LoginController"
scope="singleton">
</bean>
<bean name="org.apache.cocoon.auth.Application/Sublima"
class="org.apache.cocoon.auth.impl.StandardApplication"
scope="singleton">
<property name="securityHandler"
ref="org.apache.cocoon.auth.SecurityHandler/Sublima"/>
</bean>
This is used in the sitemap in the following way:
<map:match pattern="do-login">
<map:act type="cauth-login">
<map:parameter name="application" value="Sublima"/>
<map:parameter name="name" value="{request-param:username}"/>
<map:parameter name="password" value="{request-param:password}"/>
<map:redirect-to uri="admin"/>
</map:act>
<map:redirect-to uri="{request:contextPath}/login"/>
</map:match>
The Java code to handle the login is as follows (snippet):
http://pastebin.com/m77ef2312
When ie. the username does not exist, the code throws an
AuthenticationException and the stacktrace is presented to the user. We want
the user to be directed back to the login page with the exception message as an
text explaining what went wrong. How do we do this?
- Magnus
IMPORTANT NOTICE:
This message may contain confidential information.
If you have received this e-mail in error, do not use, copy or
distribute it. Do not open any attachments. Delete it immediately from
your system and notify the sender promptly by e-mail that you
have done so. Thank you.