Hi All

I am using Apache-Tomcat version: 6.0.44 and my and OS is window 10.My Java 
version in jdk1.6.0_45.
 I am using Jaas Realm for Authentication. My authentication is working well 
but when I tried to get HttpServletRequest object from 
javax.security.jacc.PolicyContext in login() method of my Custom Login class 
which extends javax.security.auth.spi.LoginModule by below code:

HttpServletRequest request = (HttpServletRequest) 
PolicyContext.getContext("javax.servlet.http.HttpServletRequest")


, I am getting below error:

"javax.security.auth.login.LoginException: java.lang.IllegalArgumentException: 
unknown handler key at 
javax.security.jacc.PolicyContext.getContext(PolicyContext.java:311)"

When I printed PolicyContext.getContextID(), it is returning null and
PolicyContext.getHandlerKeys() returning Blank array.

I have already set jaas.config and configuration in context.xml. My question is 
: Do I need to set PolicyContext explicitly in Tomcat ? If yes , how?



  <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
       </dependency>

  <dependency>
        <groupId>javax.security.jacc</groupId>
        <artifactId>javax.security.jacc-api</artifactId>
        <version>1.4</version>
</dependency>


SAURABH SUMAN
Software Developer
Markets & International Banking
RBS
Block No 1, Tower A, Unitech Infospace Complex Sector 21, Gurgaon, Haryana, 
122002, India
Office: +91 124 6195699  |  Mobile: +91 9999375289

***********************************************************************************
 
The Royal Bank of Scotland plc. Registered in Scotland No 90312. 
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised by the Prudential Regulation Authority and regulated 
by the Financial Conduct Authority and Prudential Regulation Authority. 
The Royal Bank of Scotland N.V. is authorised and regulated by the 
De Nederlandsche Bank and has its seat at Amsterdam, the 
Netherlands, and is registered in the Commercial Register under 
number 33002587. Registered Office: Gustav Mahlerlaan 350, 
Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and 
The Royal Bank of Scotland plc are authorised to act as agent for each 
other in certain jurisdictions. 
  
This e-mail message is confidential and for use by the addressee only. 
If the message is received by anyone other than the addressee, please 
return the message to the sender by replying to it and then delete the 
message from your computer. Internet e-mails are not necessarily 
secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland 
N.V. including its affiliates ("RBS group") does not accept responsibility 
for changes made to this message after it was sent. For the protection
of RBS group and its clients and customers, and in compliance with
regulatory requirements, the contents of both incoming and outgoing
e-mail communications, which could include proprietary information and
Non-Public Personal Information, may be read by authorised persons
within RBS group other than the intended recipient(s). 

Whilst all reasonable care has been taken to avoid the transmission of 
viruses, it is the responsibility of the recipient to ensure that the onward 
transmission, opening or use of this message and any attachments will 
not adversely affect its systems or data. No responsibility is accepted 
by the RBS group in this regard and the recipient should carry out such 
virus and other checks as it considers appropriate. 

Visit our website at www.rbs.com 
***********************************************************************************
  

Reply via email to