How can I use HTTP authorization in my program?

I'm writing full-featured proxy server in Java and want to require users to provide login and password and then use their login-name internally to provide different permissions, different quotas, etc... for different users. How can I do that with Java? I prefer to use standard HTTP method for this (classic pop-up login/password dialog in client browser). This is typical solution for all password-protected proxies.
This question sounds so simple... How to popup a standard dialog asking for login/password in client browser and get its values for farther processing. But I googled for the solution and found nothing. In the Internet, there is a lot of information about how I can use password-protected proxy but none about how I can write one myself with Java.
Thanks. I need at least some clues...

I'm asking exactly what I'm asking for in the title :) . Maybe I need to give an example with additional explanation?
I'm writing a proxy. It has different settings for each user so it must recognize user name and password. Of course, user want to use a browser or other program (possibly another proxy - for example Proxomitron or Privoxy to filter banners and ads) to make requests via my proxy. Browser (not my proxy) should pop-up a dialog asking for a login and password if my proxy server will require authorization. Of course not every program will pop-up a dialog: for example in case of Privoxy or Proxomitron user must provide login and password for parent proxy. In this example "parent proxy" is my proxy. Question is: how I can request HTTP authorization (by sending Proxy-Authenticate) and handle the input? Is there any standard API for that in Java?
There is big difference between standard HTTP authorization and custom pop-up dialog or custom web-interface login page. In first case user can use standard settings in his/her program/browser to provide password automatically (in this case user just need to enter his/her password once). HTTP authorization is the standard. My proxy need to handle Proxy-Authorization request-header field.
The Proxy-Authorization request-header field allows the client to identify itself (or its user) to my proxy which (should be able to) require authentication. The Proxy-Authorization field value consists of credentials containing the authentication information of the user agent for the proxy and/or realm of the resource being requested.
So more complete question would be: is there standard API or third-party API in Java for requesting Proxy-Authorization field from a client and process its values (for example: if password and login is correct then user is allowed to use the proxy; if not user will be asked for login and password again).
If someone knows proxy server (with source code in Java) which can use standard password protection this will be good answer to my question too.
Unfortunately it seems that I will need to write account-management code for my proxy myself. Oh, this isn't too hard but for C/C++ there is a lot of examples and ready-to-use pieces of code which I can use immediately. This is why I'm asking here this question: before I will write HTTP authorization class in Java from scratch I want to make sure there is no "ready-to-use piece of code". I don't want to "reinvent the wheel".
For now, I even cannot find a proxy server with Java source code with ability to use standard password protection to prevent access for non-authorized users. So I'm asking here if there is ready-to-use API (class) for doing HTTP authorization or I need to write one myself.
Message was edited by:
Dark_Dragon

Similar Messages

  • How can i use bapi in my report program

    hi
    am new to this forum , i have doubt in bapi's how can i call bapi into my report program and what is the difference between normal function module and bapi, and bdc plz clear my doubts
    Moderator message: please search for available information/documentation.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    Edited by: Thomas Zloch on Apr 12, 2011 7:12 PM

    i have the same problem...
    anybody can help us??
    it`s urgent...
    thanks

  • How can I use HTTP POST?

    Dear,
    I need to take a test using the object http post for calling a webservice developed in. Net.
    I have the following information from the webservice. Net:
    POST /Level3Communication.asmx HTTP/1.1
    Host: 10.110.70.129
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    SOAPAction: "http://tempuri.org/ReceiveMessageFromMES"
    How do I fit this information in HTTP POST object?
    What should I fill in the URL field?
    What should I fill in the Document to Post field?
    What should I fill in the PostData field?
    how do I declare the soap action using http post?
    I did not find any example.
    Could you help me?
    Regards,
    Sérgio Salomã

    Hi,
    check the blogs..
    for recieving..
    [Receiving E-Mail and processing it with ABAP - Version 610 and Higher]
    for Sending
    [Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface]
    Regards,
    Sathish Reddy.

  • How can eCATT used for testing of z program on DEV system &data on Quality?

    Hello All,
    Background - Custom object is (for e.g. any report program) which I want to test is present on DEV system  and required data (e.g. data that will be passed to selection screen fields of program) on Quality system.
    Question -How to do testing of program using eCATT without transporting my program to Quality box? Please anyone can give me any insights on this to fix the data availability issue. 
    My efforts - Created System data container specifying RFC connection for Quality system. Created Test Data Container with data available on Quality box. Here, I specified target system as 'Quality' for the data.  Created Test script (for SE38 tcode ) and did the parameterization(giving program name as parameter , other selection screen fields) and set the Target system for each parameter to QUALITY.  Created Test Configuration specifying with all required parameters .
    When I ran the test script from Test Configuration, test script started to run on Quality system. But failed saying program/object does not exist on quality box.
    Importance - This is required as no data available on DEV box, need to move program/object to Quality system. Hence, multiple transort requests are created.
    Edited by: Tripti on Feb 26, 2012 9:29 AM

    Thank you for your quick response, BalusC. I really appreciate your answer.
    Yes, you are right. If I manually code the same amount of those components in the JSF pages instead of generating them dynamically, the server will still run out of memory. That is to say, JSF pages might not accommodate a great deal of concurrent visiting. If I upgrade the server to just allow 1,000 teachers making their own test papers at the same time, but when over 2,000 students take the same questionnaire simultaneously, the server will need another upgrading. So I have to do what you have told me, using JS+DOM instead of upgrading the server endlessly.
    Best Regards, Ailsa

  • How can I use Java to do Seismic programming as Motif?

    One of my friend recently finished a seismic on-site data processing program using
    Motif on Solaries.He asked me if I can implement the same function to use Java language
    so that the program can run on different platforms such as Windows,Unix.
    Seismic data is usually enormous.And I don't have any experence in plotting seismic
    curves by using Java.
    Is there any seismic processing software programmed with Java available?
    I will appriciate any help.
    Thank you

    I think the point is not the word seismic than 'how to plot curves in Java.'.
    You can find many resources about plotting curves you want in Java2D.
    Refer to these URL:
    Java2D http://java.sun.com/products/java-media/2D/index.html
    Java2D Tutorial http://java.sun.com/docs/books/tutorial/2d/index.html

  • Could you please tell me, how can you, using Lookout and Field Point, program on/off relay actions using a calendar?

    It´s a on/off illuminating ssystem control. Shure the user will need a calendar programing tool to program weekdays, holidays, etc. on of functions.

    Hi Galileo,
    See the following for Lookout side of things:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000DBE90000&USEARCHCONTEXT_CATEGORY_0=_9_&USEARCHCONTEXT_CATEGORY_S=0&UCATEGORY_0=_9_&UCATEGORY_S=0
    As for FieldPoint, you can talk to it from Lookout in couple of ways -- either directly using the native FieldPoint object, or via OPC using the OPCFieldPoint object.
    Based on the timers from above, you would turn On/Off the relays (on the RLY-420 module of your FieldPoint).
    That's in a nutshell. Write back if you have specific questions.
    Good luck!
    Khalid

  • How can I use MS Word within java programming

    Hi everyone!
    I am developing a Java program that will take data
    from an Access 2000 database, and manipulate it,
    display the results graphically and in tables. The
    challenge for me is that I want the program insert the
    graphics and tables into the MS Word template and then
    prompt me to save it as a word * .doc. Do you know
    of any articles or sources of sample code on how to do
    this. The Java environment is Java2, JDK 1.3,
    JBuilder4. The OS environment is XP.
    Regards,
    Farad

    Hi, I also need that package. my e-mail is [email protected] Plese send me that. Thanks in advance
    I have a package that will do this for you. I just
    need to get your email to send an attachment and
    examples.

  • How can I authenticate and authorize with Web Service on ESB ?

    Hello,
    I want to authenticate and authorize client with Web Service published
    by HTTP/SOAP BC.
    Simply if it is an Web Service as J2EE application, I will use
    Basic Authentication with JAX-RPC and Realm.
    But I think that Web Service published by HTTP/SOAP BC is not belong
    to J2EE Application. Threre is no place to describe security role mapping
    (like web.xml).
    JBI 1.0 the section "5.5.1.1.3 Normalized Message Properties" comments
    JAAS Subject is given in the NM Properties. Really in this package
    com.sun.jbi.internal.security.*
    implements JAAS autentication and authorization (at JaasAuthenticator).
    But I can't see how to configure my Service to use this.
    How can I authenticate and authorize with Web Service on ESB ?
    I referred to the resources.
    Mutual Authentication for Web Services: A Live Example
    http://developers.sun.com/prodtech/appserver/reference/techart/mutual_auth.html
    XML and Web Services Security
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Security7.html
    JAAS Authentication Tutorial
    http://java.sun.com/j2se/1.4.2/docs/guide/security/jaas/tutorials/GeneralAcnOnly.html
    Thanks,
    Takurou
    - environment ---------------------------------------------
    OpenESB : Project Open ESB Starter Kit
    AppServer : Sun Java Systems Application Server 9.0 PE
    OS : Windows XP
    I don't assume to use SSL (if It's necessary I will try).
    User information is stored in a LDAP Server.
    -----------------------------------------------------------

    Hello,
    I read this resource.
    SecurityDesign
    http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=SecurityDesign
    Then I think [non-ssl and ssl/tls and so on] securing by basic authentication is ongoing feature at this time.
    But I can't see well why this page comments 'HTTP over SSL, TLS'.
    HTTP/SOAP Binding Component Overview
    http://download.java.net/general/open-esb/docs/jbi-components/httpsoap-bc.html
    Does BC support only "SSL server authentication" ?
    Doesn't BC support "SSL client authentication" by username/password ?
    Thanks,
    Takurou

  • How can I use 2 Apple IDs in Itunes? I have 2 IOS Devices. They each have there own AppleID. What is the proper way to sync both of them to Itunes?

    How can I use 2 Apple IDs in Itunes? I have 2 IOS Devices. They each have there own AppleID. What is the proper way to sync both of them to Itunes? I wanted my teenager's AppleID to be different from mine so that she couldn't charge stuff to my AppleID, therefore I created me another one. Now when I go to Sync either device, it tells me that this IOS device can only be synced with one AppleID. Then I get a message to erase it, not going to do that, lol. If I logout as one ID and login as the other, will it still retain all synced information on the PC from the first IOS device? If I can just log in out of the AppleID, then I have no problem doing that as long as the synced apps, music, etc stays there for both. I am not trying to copy from one to the other, just want to make sure I have a backup for the UhOh times. If logging in and out on the same PC of multiple AppleIDs is acceptible then I need to be able to authorize the PC for both devices. Thanks for the help. I am new to the iOS world.

    "Method Three
    Create a separate iTunes library for each device. Note:It is important that you make a new iTunes Library file. Do not justmake a copy of your existing iTunes Library file. If iTunes is open,quit it.
    This one may work. I searched and searched on the website for something like this, I guess I just didn't search correctly, lol. I will give this a try later. My daughter is not be back for a few weekends, therefore I will have to try the Method 3 when she comes back for the weekend again. "
    I forgot to mention that she has a PC at her house that she also syncs to. Would this cause a problem. I am already getting that pop up saying that the iPod is synced to another library (even though she is signed in with her Apple ID to iTunes) and gives the pop up to Cancel, Erase & Sync, or Transfer Purchases. My question arose because she clicked on "Erase & Sync" by mistake when she plugged the iPod to her PC the first time. When the iPod was purchased and setup, it was synced to my PC first. When she went home, she hooked it up to her PC and then she erased it by accident. I was able to restore all the missing stuff yesterday using my PC. However, even after doing that it still told me the next time I hooked it up last night that the iPod was currently synced with a different library. Hopefully, you can help me understand all this. She wants to sync her iPod and also backup her iPod at both places. Both PCs have been authorised. Thanks

  • How can I use the credit on my account instead of credit card to buy apps?

    I have a gift card credit on my account but when I want to buy an app it takes me to my credit card details. How can I use my credit on my account instead of credit card?

    You shouldn't have to put in a credit card, no, but from time to time the iTunes Store seems for some reason to try to insist on one. If just confirming your mailing address doesn't stop it from complaining, go here:
    http://www.apple.com/support/itunes/contact/
    and follow the instructions to report the issue to the iTunes Store.
    Regards.

  • How can i use one iCloud Photostream on 2 devices?

    Due to a bug (or feature) on iOS 8 i can't use the same icloud id on 2 iphones:
    https://discussions.apple.com/thread/6536998
    So how can i use ONE iCloud Photostream then on 2 devices?
    Also, on OSX i can define only one Photostream.
    So, how do you import pictures from 2 streams into iPhoto?
    Familyshare is not usefull as the pictures are not in Original-Filesize!

    Hi ..
    Yes. " iPhone 6 or 6 Plus.  iPad Air 2  or  iPad mini 3"
    Set up and use Apple Pay

  • How can I use the old Apple TV with new iTunes?  It tells me to input a code in iTunes but iTunes no longer has a spot to input this code to allow sync.  I can access the iTunes Store fine, just none of my Library

    How can I use the old Apple TV with new iTunes?  It tells me to input a code in iTunes but iTunes no longer has a spot to input this code to allow sync.  I can access the iTunes Store fine, just none of my Library

    read this
    https://discussions.apple.com/message/20429789#20429789

  • How can I use a 3rd party XML parser such as xerces with OC4J ?

    Hi all tech experts,
    I am using Oracle Application Server 10g Release 2 (10.1.2) and i have
    installed Portal and Wireless and OracleAS Infrastructure on the same
    computer.
    i tried all the solutions on this thread
    Use of Xerces Parser in out application with Oracle App Server 9.0.4
    but still fighting.
    I have also posted this query on OTN on following thread
    How can I use a 3rd party XML parser such as xerces with OC4J?
    but no reply....
    Please help me on this issue.
    Since OC4J is preconfigured to use the Oracle XML parser which is xmlparserv2.jar.
    i have read the following article which states that
    OC4J is preconfigured to use the Oracle XML parser. The Oracle XML parser is fully JAXP 1.1 compatible and will serve the needs of applications which require JAXP functionality. This approach does not require the download, installation, and configuration of additional XML parsers.
    The Oracle XML parser (xmlparserv2.jar) is configured to load as a system level library of OC4J through it's inclusion as an entry in the Class-Path entry of the oc4j.jar Manifest.mf file. This results in the Oracle XML parser being used for all common deployment and packaging situations. You are not permitted to modify the Manifest.mf file of oc4j.jar.
    It must be noted that configuring OC4J to run with any additional XML parser or JDBC library is not a supported configuration. We do know customers who have managed to successfully replace the system level XML parser and the Oracle JDBC drivers that ship with the product, but we do not support this type of configuration due to the possibility of unexpected system behavior and system errors that might occur from replacing the tested and certified libraries.
    If you absolutely must use an additional XML parser such as xerces, then you have to start OC4J such that the xerces.jar file is loaded at a level above the OC4J system classpath. This can be accomplished using the -Xbootclasspath flag of the JRE.
    i have also run the following command
    java -Xbootclasspath/a:d:\xerces\xerces.jar -jar oc4j.jar
    but no success.
    How could i utilize my jar's like xerces.jar and xalan.jar for parsing instead of OC4J in-built parser ?
    All reply will be highly appreciated.
    Thnx in advance to all.
    Neeraj Sidhaye
    try_catch_finally @ Y !

    Hi Neeraj Sidhaye,
    I am trying to deploy a sample xform application to the Oracle Application Server (10.1.3). However, I encountered the class loader issue that is similar to your stuation. I tried all the three solutions but the application is still use the Oracle xml paser class. I am wondering if you have any insight about this?
    Thanks for your help.
    Xingsheng Qian
    iPass Inc.
    Here is the error message I got.
    Message:
    java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
    Stack Trace:
    org.chiba.xml.xforms.exception.XFormsException: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
         at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
         at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
         at org.chiba.xml.xforms.Container.initModels(Unknown Source)
         at org.chiba.xml.xforms.Container.init(Unknown Source)
         at org.chiba.xml.xforms.ChibaBean.init(Unknown Source)
         at org.chiba.adapter.servlet.ServletAdapter.init(ServletAdapter.java:153)
         at org.chiba.adapter.servlet.ChibaServlet.doGet(ChibaServlet.java:303)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
         at org.chiba.xml.xforms.Instance.iterateModelItems(Unknown Source)
         at org.chiba.xml.xforms.Bind.initializeModelItems(Unknown Source)
         at org.chiba.xml.xforms.Bind.init(Unknown Source)
         at org.chiba.xml.xforms.Initializer.initializeBindElements(Unknown Source)
         at org.chiba.xml.xforms.Model.modelConstruct(Unknown Source)
         at org.chiba.xml.xforms.Model.performDefault(Unknown Source)
         at org.chiba.xml.xforms.XFormsDocument.performDefault(Unknown Source)
         at org.chiba.xml.xforms.XFormsDocument.dispatchEvent(Unknown Source)
         at org.apache.xerces.dom.NodeImpl.dispatchEvent(Unknown Source)
         ... 18 more

  • How can i use my apple ID with the itune store over my windows laptop

    how can i use my apple ID with the itune store over my windows laptop

    If you don't have iTunes installed on your laptop then you can download and install it from here : http://www.apple.com/itunes/download/
    You can then log into your account on it via the Store > Sign In menu option (on iTunes 11 on a PC you can get the menus to show via control-B) :
    And you can then select the Store on the left-hand sidebar (you can enable the sidebar via control-S), and then browse items in the store and buy them by clickin on their price.

  • How can I use my time capsule with windows7

    How can I use my time capsule with windows7?

    This is asked regularly.
    https://discussions.apple.com/message/10978060#10978060
    Look at the more like this. On the right column next to the post.
    Load airport utility for windows.. which will also load bonjour for windows.
    In windows explorer type \\TCname or \\TCipaddress (replacing with the actual values.. names with spaces will give you trouble so change all names in the TC to SMB compatible or actual ip address).

Maybe you are looking for

  • Upgrade Siebel Analytics 7.8.2 RPD to BI Applications 7.9.6.1 RPD

    We are upgrading from Siebel Analytics 7.8.2 version to BI Applications 7.9.6.1 version. The Siebel Analytics RPD is customized and having custom catalogs which are based on Pharma tables and the Core model is not at all customized. So, I have follow

  • PDF reports error on the web !!

    Hi, I have installed OAS 4.0.7, Developer Server 6, IE5 and Acrobat Reader 4.0 on WinNT workstation having SP3. I have deployed my application using the above configuration. My problem is that whenever i run a report through my application, i get an

  • InDesign CC performance ...

    Hello!  I have upgraded on Mac and Windows machines, which went well, no crashes, etc, but experiencing a few weird things.  On both platforms basic performance is quite laggy.  Just dragging a simple text box about the screen is chopppy like the old

  • Database Block Size Smaller Than Operating System Block Size

    Finding that your database block size should be in multiples of your operating system block size is easy... But what if the reverse of the image below were the case? What happens when you store an Oracle Data Block that is 2 KB in an 8 KB Operating S

  • 51 status for inbound IDOC

    Hello All, while importing an idoc am getting following error with 51 status No import record for IDoc available. anyone please tell me  where to maintain the import record and how. thx in advance Sippy.