Back to normal programming. No more infocard stuff here.
With a typical Access Manager deployment atop a webserver or appserver, there are many instances where apart from the Access Manager services deployed, one may deploy other applications on the same server instance and may need to "protect" them. The right way of going about it is to deploy a policy agent on the same server instance. I noticed that in some cases folks choose not to deploy an agent but "embed" code in every page of their webapp to check for the validity of the SSOToken issues by AM and enable access to thise pages that they need "protected".
Well, if all one needs is to protect a few URI's that reside on the same server instance as AM, one could also use a Servlet Filter to do the same without having to embed code in every page of their application to check for it. This is a simple SSO only method and not a replacement for a policy agent.
Here's what one needs to do to enable this.
Declare the [filter] element in your web application deployment descriptor. For Sun's Webserver it would be the default-web.xml file.
Map the filter to a servlet by defining a <filter-mapping> element in the deployment descriptor. This element maps a filter name to a servlet by name or by URL pattern.
Add the URL's you would like to "protect" to the url-pattern tag element.

Now compile the attached code, build a jar file and add it to your servers classpath.
for some reason I just cannot post code on this blog. No matter what I try, the code gets converted over to HTML. I did follow Pat's advise, but that didnt help. So I'm uploading the NNAgent.java file and providing you a link to download it instead of posting code as inline text
Restart your webserver.
- Try accessing the "protected" URL without authentication.
- Try accessing the "protected" URL with authentication.
NOTE: This is NOT a replacement for a Policy Agent. This is just an FYI/example of how one could achieve SSO only using a Filter.
http://www.hulanwang.net
http://www.huojia2008.net/
http://www.huojia.name
http://www.njhuojia.com/
http://www.hulanwang.net/hl
http://www.huojia.name/hj
http://www.hulanwang.net/hlw/
http://blog.sina.com.cn/zdrack
http://www.huojia2008.net/product/601.htm
http://www.huojia2008.net/product/521.htm
http://www.huojia.name/product-14.asp.htm
http://www.huojia.name/product-15.asp.htm
http://www.njhuojia.com/Chinese/ProductShow.asp?ArticleID=156
http://www.njhuojia.com/Chinese/ProductShow.asp?ArticleID=152
http://www.huojia.name/hj/products11.asp.htm
http://www.huojia.name/hj/products_03.asp.htm
http://www.njhuojia.com/default.asp
http://www.njhuojia.com/Chinese/ProductShow.asp?ArticleID=157
http://zdrack.hisuppliers.com/product/13006.html
http://www.huojia2008.net/product/522.htm
http://www.huojia2008.net/product/21.htm
http://www.huojia.name/product-1.asp.htm
http://zdrack.machine.com.cn/
http://zdqx.photo.hexun.com/34502550_d.html
http://zdracks.atobo.com.cn/CN/ProductInfo/6/419424.html
Posted by 4752856 on July 31, 2008 at 09:46 PM EDT #
Every timberland boots man is a poet when he is in love. First ugg boots love is only a little foolishness and a lot of curiosity. Friendship is like timberland boots earthenware: once broken, it can be mended; love ugg classic boots is like a mirror: once broken, that ends it. Friendship is love ugg bailey button without his wings. http://www.inthego.com/
Posted by Retailing Online Sale on September 22, 2009 at 12:01 PM EDT #
You can't step twice into the same cheap ugg boots river, for other ugg classic cardy waters are continually flowing in. In the ugg bailey button long run men hit only what they aim at ugg australia. High expectations are the key to every ugg classic mini thing. If you wait, all that happens is that you get older. http://www.ladiesugg.com/
Posted by Cheap Ugg Boots on October 09, 2009 at 08:15 AM EDT #
<a href="www.elegantugg.com">ugg boots</a> for the whole world crazy, <a href="www.elegantugg.com">winter boots</a> become a trend, a trend. Good shoes reflect your taste, your self-cultivation. <a href="www.elegantugg.com">uggs on sale</a>, not just what you need, but also a lot of people have chosen, http://www.elegantugg.com/ welcome everyone to come take a look.
Posted by ugg boots on November 11, 2009 at 12:22 AM EST #
Good share, Attractive enough for me, thanks for your kind share, Fashionable and <a href="http://www.buddyugg.com/"><strong>cheap ugg boots</strong></a> Keeps with you at any time.<br>
Posted by bobjum on November 12, 2009 at 09:07 PM EST #