How to define the CallbackHandler in programmatic authentication

Hi there,
we have an own authentication stack named "ticket" and want to trigger its checks programmatically in a servlet, serving as a kind of gatekeeper and redirecting to the proper URL if login was sucessful. According to the documentation, this is one of two options ("programmatically" vs. "configured").
Since I didn't find an appropriate code sample, I tried to figure it out on my own:
protected void doPost(
  HttpServletRequest request,
  HttpServletResponse response)
    throws ServletException, IOException {
    try {
      LoginContext lc = new LoginContext(authenticationStack);
      lc.login();                                        
     String redirectURL = getRedirectURL(request);
     response.sendRedirect(redirectURL);
    catch (LoginException le) {
When the servlet is called, we get the error:
Error: No CallbackHandler available to garner authentication information from the user. ticket
I guess that the CallbackHandler has to somehow pass the HTTP request object to the authentication layer. I have seen that there is a constructor for LoginContext having a callbackHandler as second argument. But I wonder what to fill in there.
Can someone help me what to fill in for "callbackHandler"? Is there a sample code containing an implementation of this interface for this very simple and straightforward servlet case?
Thanks and regards,
Rüdiger

The tests were positive. The above code will go productive.
Just for documentation purposes, before finally deleting unused  code parts, I copy them into this thread:
Invoking a single authentication method, not a complete stack
This can be achieved with code similar to the following:
/* Einzelne Anmeldung, kein ganzer Stack!!! */
ILogonAuthentication authenticator = UMFactory.getLogonAuthenticator();;
  try {                        
    authenticator.logon(request, response, authenticationStack);
   String redirectURL = getRedirectURL(request);
   response.sendRedirect(redirectURL);
  } catch (LoginException e) {
        response.setHeader( "WWW-Authenticate", authenticationRealm);
        response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
            "SRM-Anmeldung '" + authenticationStack + "' fehlgeschlagen");                    
A callback handler for test purposes
If you want to know which callbacks are triggered by your authentication stack, you can define your own callback handler and pass it to the login context instead. 
I worked with a local (inner) class for this purpose. I had to use reflection to dynamically call a "getName" method, since the actual callback classes where partly hidden.
/* Wird nicht mehr benötigt, wir können direkt den SAPJ2EECallbackHandler instanziieren */
private static class TheCallbackHandler implements CallbackHandler {
  private HttpServletRequest request;
  private HttpServletResponse response;
  private TheCallbackHandler(HttpServletRequest request, HttpServletResponse response) {
    this.request  = request;               
    this.response = response;               
public void handle(Callback[] callbacks)
    throws IOException, UnsupportedCallbackException {
      NameCallback nc = null;
     PrintWriter rw = response.getWriter();
     rw.println(callbacks.length + "Zeilen. <br>");
    for (int i=0;i<callbacks.length;i++) {
        rw.println( i + ":" + callbacks<i>.getClass().getName()+"<br>");
  for (int i = 0; i < callbacks.length; i++) {
// Müssen Reflection benutzen, denn die folgende Klasse ist leider unerreichbar
// com.sap.engine.lib.security.http.HttpGetterCallback
     String getName = null;
     Object retVal;
     try {
        retVal = callbacks<i>.getClass().getMethod("getName",null).invoke(callbacks<i>, null );
        getName = (String) retVal ;
        rw.println( getName + "<br>");
        } catch ( Throwable e) {
            e.printStackTrace( response.getWriter() );

Similar Messages

  • How to set the conversation id programmatically in a BPM process

    Hi all,
    I am using BPM/SOA 11g PS3.
    Is it possible to set the conversation id programmatically in a BPM process starting with a none start event?
    I know I can set it easily if I use a BPM process starting with a message start event.
    All I have to do is set it in the "wsa:MessageID" node in SOAP Header when I initiate the process instance.
    However, I have no idea how to set the conversation id programmatically in a BPM process starting with a none start event.
    I looked for if there is any appropriate method in the Java api for the process instance management, such as IInstanceManagementService and CompositeInstance, but no method seems to be appropriate.
    Does anyone know how to do this?
    Regards,
    Kenji
    Edited by: Kenji Imamura on 2011/04/20 0:10

    Hi fifty,
    Did you get a solution to the above problem you have mentioned? I have a similar issue i am trying to fix.
    I have a webservice call in a process activity and if the call does not work i get a soap fault and the fuego.lang.ComponentExecutionException . My process requires that i catch the exception infact any kind of exceptions that occur on that call and perform another activity in the process.
    I have defined an exception handler at the activity level for java.lang.Exception and java.lang.RunTimeException.
    i don't see anything in the catalog which would handle the SOAP fault OR the componentexception.

  • How to define the date format for this date string

    2006-11-13 00:00:00.0
    How to define the date format in control file for sqlldr. "yyyy-mm-dd hh24:mi:ss" or "yyyy-mm-dd hh24:mi:ss.FF1" does not work
    thanks,

    SQL> desc t
    Name                                      Null?    Type
    TS                                                 TIMESTAMP(6)
    SQL> !cat t.ctl
    load data
    into table t
    truncate
    (ts timestamp "YYYY-MM-DD HH24:MI:SS.FF1")
    SQL> !cat t.dat
    2006-11-13 00:00:00.0
    SQL> !sqlldr userid=scott/tiger control=t.ctl data=t.dat log=t.log
    SQL*Loader: Release 10.2.0.3.0 - Production on Fri Sep 7 11:19:28 2007
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 1
    SQL> select * from t;
    TS
    13-NOV-06 12.00.00.000000 AMBest regards
    Maxim

  • How to define the application parameter 'sap.xss.BaseConfigurationID'

    Hello All,
    I am developing a webdynpro ESS custom self service application. I have completed the development of the DC. But at the end when I am creating the application for the DC, I am not able to figure it out how to define the application parameter 'sap.xss.BaseConfigurationID' for the application. I have defined remaining all the parameters as specified in the following link.
    [http://help.sap.com/erp2005_ehp_03/helpdata/EN/43/3b95dab4ab1800e10000000a1553f6/content.htm]
    Could any one please detail the process to define the parameter 'sap.xss.BaseConfigurationID' ?
    Thanks a lot.
    Regards,
    Seshu.

    Pick a representative file.
    Get info. (Command-i)
    There you will see a place "Open with" where you can select the application for that file.
    Hit the "Change all..." button to do this for all files of this type.
    charlie

  • How to define the default activity for an unbounded task flow?

    In the new "Fusion Developer’s Guide for Oracle Application Development Framework 11g Release 1" documentation at the bottom of page 14-3 it states "An unbounded task flow .... contains a default activity, an activity designated as the first to run in the unbounded task flow, because an unbounded task flow does not have a single point of entry."
    What I can't find is how to define the default activity in an unbounded task flow and where this is recorded? Can we set this via the task flow diagrammer, and which configuration file is it stored?
    I note the first time I run the application with an unbounded task flow a dialog asks me which of the activities in the adfc-config.xml file to make the default, but I can't find where this is recorded.
    Anybody have any ideas?
    Thanks,
    CM.

    Chris,
    In fact this information is nothing that belongs into the taskflow meta data because unbounded taskflow have more than one entry point and there is no notion of default. Its a tools setting (JDeveloper) we had before
    Frank
    Message was edited by:
    Frank Nimphius

  • How to define the margins of a leaf in numbers 3.2

    how to define the margins of a leaf in numbers 3.2
    leaves appear without margin and not when moving from one sheet to another

    Hi Ariel,
    Numbers 3 does not show margins in normal (edit) view. Some help with layout:
    Try Alignment Guides and Rulers as suggested here:
    Print View workarounds
    Use a layout guide:
    Layout Guide for Numbers
    If you previously had Numbers 2.3 (Numbers '09) it now lives in a folder called iWork '09 inside your Applications folder. It works just as well as it used to, and has a proper Print View.
    Regards,
    Ian.

  • How to set the DFF Attribute Programmatically?

    hi
    how to set the DFF Attribute Programmatically in Process Request of CO
    thanx

    Hi
    Do u want to set the value in DFF Programmatically ?
    u can capture the VO used for DFF and set the the value in controller.
    Thanks

  • How to define the dynamic navigation between two component in web ui

    Hi All,
    I have a requirement to create a new assignment block in accounts overview screen .
    1.Created new view(Table view) in the BP_HEAD component.
    2.Created new button on the table view toolbar .
    3.If the user clicks the new button it should navigate to interaction log component(BT126H_CALL).
    Please hekp me step 3 how to do .
    I have checked planned activity assignment block in the account but is dynamic navigation.
    Please explain me how to define the dynamic navigation between two components.
    What is window delegate .
    Thanks,
    Venkyy

    Hi ,
    Kindly follow the link , this will be helpful for your issue :
    http://wiki.sdn.sap.com/wiki/display/CRM/CRM-NavigatingtoyourcustomBSP+component

  • How to define the Market Sales KF, in order to receive the desired result

    Hi all,
    I dont know how to define the Market Sales Kefigure, in order to get the following result. Any hint is more than welcome.
    Prd_ID = Product ID
    PS  =  Product Sales
    M_ID = Market ID
    MS  = Market Sales
    MS%  = Market Share ( formula in BEX PS/MS)
    <b>
    Prd_ID;PS;M_ID;MS;MS%</b>
    A00001;10;MRK1;100;10%
    A00002;20;MRK1;100;20%
    <b>SBTOT</b>;30;MRK1;100;30%
    B00001;40;MRK2;200;20%
    B00002;30;MRK2;200;15% 
    <b>SBTOT</b>;70;MRK2;200;35%
    <b>GTOTL</b>;100;MRKX;300;33,3%
    Products A00001 and A00002 compete in the same market. So the individual marketshares should be calculated against the market MRK1(200), e.g. 40/200 and 30/200.
    The totals now, of the A00001 and A00002 products(3040) should be compared against <b>the same market</b> MRK1(200),</b> and <b>not against</b> the MRK1MRK1(200+200).
    Thanks
    Vasso Siagri<b></b><b></b><b></b>

    Maik,
    thank you for your answer, but I am afraid this is not giving the desired results.
    What I want----
    >What am getting
    Prd_ID;PS;M_ID;MS;MS%
    A00001;10;MRK1;100;10%  ---> 10;MRK1;200;5%
    A00002;20;MRK1;100;20%  ---> 20;MRK1;200;10%
    SBTOT;30;MRK1;100;30%   ---> 30;MRK1;200;15%
    B00001;40;MRK2;200;20%  ---> 40;MRK2;400;10%
    B00002;30;MRK2;200;15%  ---> 30;MRK2;400;7,5%
    SBTOT;70;MRK2;200;35%   ---> 70;MRK2;400;17,5%
    GTOTL;100;MRKX;300;33,3% ---> 1000;MRKX;600;16,7%
    Neither resticted KF restricted on Market ID is working for many markets; it is working only if you analyze one market id.
    Any idea? bw idea? What actually I need is aggregation of unique records in terms on market id.

  • How to define the memory leak in stability test

    Hi
    Usually, we run our system with 70% CPU load for 72 hours for stability test (on solaris 10), because some plugin of our system is using mtmalloc, and we use prstat to monitor the memory of each plugin. But because of the complex memory usage of our application, we don't know when the application will use the Max memory, and because of the "mtmalloc", the memory showed by "prstat" will not released but continually increased.
    So fro the test point of view, there is the risk of memory leak, but actually, there may be no memory leak, so my question is how to define the memory leak in such condition.

    kevin wrote:
    Thank you for the input and all the info.
    isn't java heap the same as memory allocated to the java process in my weblogic
    starup script ?The heap is sized by the -Xmx and -Xms parameters you pass on the java
    command-line. The permanent generation is separate.
    >
    let me also download jprobe and try to run it and see what it gives me.
    I'd start by running with -verbose:gc. I'd want to know whether you're
    running out of heap or permgen space.
    -- Rob
    kevin
    Rob Woollen <[email protected]> wrote:
    Unfortunately memory leaks are not fun to track down even with tools.
    I'd first suggest determining whether you're running out of space in
    the
    permanent area (where classes are loaded), or you've exhausted the java
    help space.
    I'd start by adding -verbose:gc. Look at the gc messages right before
    you hit the OutOfMemoryError. If there's plenty of space left, I'd
    suspect you're running out of perm space. Search these newsgroups and
    the web for MaxPermSize, and you should see plenty of info.
    If you're running out of java heap, tools like jprobe and OptimizeIt
    are
    helpful. If you can tell me a little more about your application and
    how you're testing it, I can offer some more tips.
    -- Rob
    kevin wrote:
    Iam new to JAVA and weblogic. I have an application that runs out ofmemory time
    and again.
    please let me know how to pin point this problem and moreover, howto interpret
    or understand that there is a problem. I have downloaded JPROFILE tool,but it
    is very confusing to understand what is goin on in this tool.
    If somebody can let me know how to interpret and understand the memoryleak, that
    will be great !!!
    thank you.

  • How to define the size of private folder in Easy DMS?

    Hi,
    I have to ristrict the user to keep  the data in private folder after the maximum limit
    please help me how to define the private folder size in easy DMS.
    after the limit user is not able to keep data in private folder.

    Hi,
    This can be done in SAP Customization / SPRO
    Pl. check :
    Cross-Application Components>Document Management>Control Data>Define Document types
    Here the size limit can be defined.
    Also check : http://scn.sap.com/community/plm/document-management/blog/2014/06/20/how-to-create-dir-and-document-type-in-dms
    Hope this helps
    Regards,
    Remi

  • UJQ_RUN_RSDRI_QUERY: how to define the scope?

    Hi,
    I'm going to use UJQ_RUN_RSDRI_QUERY in a BADI in order to retrieve data from another application. It seems easy to use. But how to define the scope of the retrieved data, i.e. how to define the content of the it_sel parameter.
    thanks for your help,
    Romuald

    This is a selection table which contains the DIMENSION name and the selection options.  Here is how to fill the table. For example, say you wanted to select on only JAN.2012 for a certain account.
      clear ls_sel.
      ls_sel-dimension = 'ACCOUNT'.
      ls_sel-sign = 'I'.
      ls_sel-option = 'EQ'.
      ls_sel-low = 'CE40041000'.
      insert ls_sel into table lt_sel.
    clear ls_sel.
      ls_sel-dimension = 'TIME'.
      ls_sel-sign = 'I'.
      ls_sel-option = 'EQ'.
      ls_sel-low = 'JAN.2012'.
      insert ls_sel into table lt_sel.
    Cheers,
    Rich HEilman

  • How can define the cost center (department) manager?

    We are on 11.5.0.10
    Financials implementation is done(GL,AP,AR,FA,IA)
    In iAssets System, we want to set up the approval method to use "cost center-based approvals". (For cost center-based approvals to work properly, each cost center must have a manager defined.)
    How can define the cost center (department) manager? Thanks.

    I believe this is done in the organization definition screen. For each organization, we attach a classification "Company Cost Centre" (the same place where we attach the classification operating unit, inv org etc). In the others section, there are 2 additional information - GL company cost centre and reporting information. In the GL company cost, you need to attach the balancing segment value and the cost centre value. In the reporting information, you need to attach the manager for that organization. This ay the relationship between the cost centre and manager is created.
    Hope this clarifies.
    Vinit

  • Compensation Management - How to define the Compensation Area

    Dear Experts,
    We are implementing Compensation Management module for our client which contain global entities( 14 Countries.(Payroll- Country wise)
    Can you please guide me, how do define the Compensation Area for all the 14 countries.
    The following components are defined with similarities for our Client like (regionally)
    India Corporate Office:
    Salary Increase
    PMS Based Incentive(F)
    PMS Based Incentive(B)
    India Factory:
    Salary Increase
    Bonus Factory
    PMS Based Incentive(F)
    PMS Based Incentive(B)
    African Countries: (including 10 Countries having the same components)
    Salary Increase
    PMS Based Incentive(F)
    PMS Based Incentive(B)
    Bonus Africa(only)
    Europe: (3 Countries having the same components)
    Salary Increase
    PMS Based Incentive(F)
    PMS Based Incentive(B)
    Kindly guide me how to define the above business scenario into SAP and looking forward your valuable guidelines.
    Thanks in advance.
    Regards,
    Anbazhagan.N

    Hi,
    Do you mean to say you have diff payroll areas for India say Corp and Factory like wise,then you can group Compensation Area as 01-corp with Ctry Grp 40 and 02-Factory with Ctry Grp 40 so on and so forth,same with other countries depending upon their payroll.
    Also check with the Documentation of Compensation area.

  • How to define the running order of the listeners

    Hello
    I would like to know how to define the running order of the listeners in my Dialogs.
    e.g. loadcontent on each element will do different things and some depedent on others to load when you you need the generated values based on the generated values of another element
    Thank you
    Nikolas

    Hi mei
    instead of using append use modify.
    i hope this might help you.
    gs_fieldcat-fieldname = 'VRT'.
    * gs_fieldcat-ref_table =.
    gs_fieldcat-outputlen = '3'.
    gs_fieldcat-edit = 'X'.
    gs_fieldcat-key = 'X'.
    gs_fieldcat-coltext = 'VRT'.
    gs_fieldcat-col_pos = 6.
    <b>*append gs_fieldcat to gt_fieldcat.
    modify gt_fieldcat from gs_fieldcat.</b>
    clear gs_fieldcat.
    gs_fieldcat-fieldname = 'QTY'.
    gs_fieldcat-datatype = 'FLTP'.
    gs_fieldcat-outputlen = '12'.
    gs_fieldcat-DECIMALS = '3'.
    gs_fieldcat-coltext = 'QTY'.
    gs_fieldcat-edit = 'X'.
    gs_fieldcat-col_pos = 7.
    <b>*append gs_fieldcat to gt_fieldcat.
    modify gt_fieldcat from gs_fieldcat.</b>
    or u can also try this way.
    form build_fieldcat changing gt_fieldcat type lvc_t_fcat.
      data gs_fcat type lvc_s_fcat.
      call function 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name = 'TABLE NAME'
           CHANGING
                ct_fieldcat      = gt_fieldcat.
      clear gs_fcat.
      loop at gt_fieldcat into gs_fcat.
        if gs_fcat-fieldname EQ 'VRT'.
          gs_fcat-scrtext_s = 'VARIETY'.
          gs_fcat-scrtext_m = 'VARIETY'.
          gs_fcat-scrtext_l = 'VARIETY'.
          gs_fcat-reptext   = 'VARIETY'.
          gs_fcat-seltext = 'VARIETY'.
          gs_fieldcat-outputlen = '3'.
          gs_fieldcat-edit = 'X'.
          gs_fieldcat-key = 'X'.
          gs_fieldcat-col_pos = 6.
          modify gt_fieldcat from gs_fieldcat.
         endif.
        if gs_fcat-fieldname EQ 'QTY'.
          gs_fcat-scrtext_s = 'QUANTITY'.
          gs_fcat-scrtext_m = 'QUANTITY'.
          gs_fcat-scrtext_l = 'QUANTITY'.
          gs_fcat-reptext   = 'QUANTITY'.
          gs_fcat-seltext = 'QUANTITY'.
          gs_fieldcat-outputlen = '3'.
          gs_fieldcat-edit = 'X'.
          gs_fieldcat-key = 'X'.
          gs_fieldcat-col_pos = 7.
          modify gt_fieldcat from gs_fieldcat.
         endif.
    and so on.....
    endloop.
    regards,
    venu.

Maybe you are looking for

  • AC Adapter gone kaput?

    Last night I noticed the light on my power chord wasn't on, now I've looked at it my laptop won't charge, I think the AC Chord died... Does this happen often? And if so what can I do to rectify it short of buy another one? I'm thinking about running

  • Access Reports, Forms in Oracle Database

    Hi, I want to migrate one application from MS-Access to Oracle(8.1.5) Database. I know, migration of database is possible,but I want to keep the existing Access reports and forms as it is. Is it possible, Can Access reports and forms run under oracle

  • EStore and Google docs

    I am about four days into owning the C510 eStation. In the print app center, there is an app promoted for eDocs, which looks great!  I can link to a page that even shows how documents would look! The problem is that there does not appear to be any wa

  • Parameter to dropdown

    Hi there, I'm trying to pass a parameter from dropdown1 to dropdown2 and further from dropdown2 to dropdown3 and I'm using the auto-submit under first dropdown. Every dropdown has a different datasource. So the first passing works fine. coding under

  • Brand New mobo (P6NGM) with IRQ Conflicts, PLEASE help

    I've posted multiple times in another well respected PC forum and have not resolved my issue yet. Would GREATLY appreciate assistance. Here's my story and attempts: I'm building a new PC for my parents: mobo: MSI P6NGM cpu: Pentium dual core e2200 (8