<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Having problem with IUser in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/having-problem-with-iuser/qaa-p/1795702#M787897</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;posted two times&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Dec 2006 06:20:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-20T06:20:12Z</dc:date>
    <item>
      <title>Having problem with IUser</title>
      <link>https://community.sap.com/t5/technology-q-a/having-problem-with-iuser/qaq-p/1795701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made the login() method but i am facing the problem while making the resource context...Because in Resource Context it takes IUser of package&lt;/P&gt;&lt;P&gt;com.sapportals.portal.security.usermanagement.IUser but I have got IUser of package com.sap.security.api.IUser ...while type Casting it with below code it is giving ClassCAstException.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public class NewSimpleServlet extends HttpServlet {&lt;/P&gt;&lt;P&gt;protected void doGet(&lt;/P&gt;&lt;P&gt;HttpServletRequest request,&lt;/P&gt;&lt;P&gt;HttpServletResponse response)&lt;/P&gt;&lt;P&gt;throws ServletException, IOException {&lt;/P&gt;&lt;P&gt;StringBuffer s = new StringBuffer();&lt;/P&gt;&lt;P&gt;try {String j_user="epuser";&lt;/P&gt;&lt;P&gt;String j_password="Abcd1234";&lt;/P&gt;&lt;P&gt;request.setAttribute("j_user", j_user);&lt;/P&gt;&lt;P&gt;request.setAttribute("j_password", j_password);&lt;/P&gt;&lt;P&gt;javax.security.auth.Subject subject;&lt;/P&gt;&lt;P&gt;Set principals = UMFactory.getLogonAuthenticator().logon(request, response, "uidpwdlogon").getPrincipals();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have problem with getting IUser object from set of principals. In javadoc is written: "In order to get an IUser object from this subject, call Subject.getPrincipals() and iterate through the returned Set of principals." so i tried to iterate but i was not able to get that IUser with any casting. Do u know how it should be? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IUser serviceUser = (IUser)subject.getPrincipals().iterator().next();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in resource Context&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ResourceContext c = new ResourceContext(User);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here resource context need IUser type object as parameter...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried st like this&lt;/P&gt;&lt;P&gt;loggedUser = UMFactory.getAuthenticator().getLoggedInUser(request, response);&lt;/P&gt;&lt;P&gt;but loggedUser is not authenticated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can Anyone Help me Out...&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rupesh Khemka&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Dec 2006 09:05:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/having-problem-with-iuser/qaq-p/1795701</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-18T09:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Having problem with IUser</title>
      <link>https://community.sap.com/t5/technology-q-a/having-problem-with-iuser/qaa-p/1795702#M787897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;posted two times&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2006 06:20:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/having-problem-with-iuser/qaa-p/1795702#M787897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-20T06:20:12Z</dc:date>
    </item>
  </channel>
</rss>

