简体   繁体   中英

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.

我现有的CAS应用

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.

我想要CAS身份验证的目标检票口应用程序

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM