Wednesday, September 12, 2007

JAAS

Hard lesson learnt, playing with JAAS & Tomcat.

When using basic authentication:
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
it is NOT possible to log out programatically. You have to close the browser.

session.invalidate() will do NOTHING!!


I'm not missing anything. It's just not possible. The browser keeps the credentials in memory, and keeps re-submitting it. So calling invalidate serves no purpose, as the very next thing you try, will just end up with you being logged in again.

Sunday, September 02, 2007

Oracle - TOP N Queries

If I forget how to do Oracle TopN queries ONE more time - I swear - pig will pay!

"SELECT *
FROM (SELECT * FROM my_table ORDER BY col_name_1 DESC)
WHERE ROWNUM < N - http://orafaq.com/faq/how_does_one_select_the_top_n_rows_from_a_table