Sachin
Sachin

Reputation: 375

How to inegrate CAS authentication with Apache wicket application?

I am working on a project where I have to integrate CAS authentication into an Apache Wicket application. Though I am still a beginner in web-development, I know how to implement CAS authentication into simple web-app (using Spring-security), where I define a directory/files which need authentication before User can access them. Following is the example CAS application structure, I have created and tested. In the below example, access to files in "secure" directory need authentication.

My existing CAS appication

The contents of applicationContext-security.xml are as below.

    <security:http entry-point-ref="casAuthenticationEntryPoint" auto-config="true">
    <security:intercept-url pattern="/secure/**" access="ROLE_AUTHENTICATED"></security:intercept-url>
    <security:custom-filter position="CAS_FILTER" ref="casAuthenticationFilter"></security:custom-filter>
</security:http>

But if I have to secure files in apache wicket application, how can I do this? I would like to start my application by displaying "edu.vt.geoserver.HomePage.html" without authentication and to set authentication requirement to access files in "edu.vt.geoserver.securePages". Please see the attached structure of my target application.

Target wicket application where I would like CAS authentication

Let me know if anyone can help me in this regard. I have seen the Jasig's unofficial cas-client for wicket application, but still not sure what all changes I will need to do. Any help in this regard is highly appreciated.

Thanks

Sachin

Upvotes: 0

Views: 836

Answers (1)

Tom
Tom

Reputation: 4093

if everything else is set up correctly, you probably just have to mount your secure pages to the correct URLs in the init method of your Application class like this:

mountPage("/secure/GeoServerFrontPage", edu.vt.geoserver.securePages.GeoServerFrontPage.class);

Since your Spring Security is configured to secure all pages in the URL pattern "/secure/**", calling your GeoServerFrontPage should then trigger a login.

You can also have a look at the method mountPackage() to mount all pages in your securePages-Package with one line of code... .

Regards, Tom

Upvotes: 1

Related Questions