B4J Question Set username and password for my fileserver

Discussion in 'B4J Questions' started by schimanski, Jun 14, 2015.

  1. schimanski

    schimanski Well-Known Member Licensed User

    With httpjob, i can set username and password. But how can I check it on my fileserver?
    I want to set a filter to check, if username and password are correct, but how do I get the username in the filter sub?

    Code:
    Public Sub Filter(req As ServletRequest, resp As ServletResponseAs Boolean
        
    Log("Filter ausgelöst!")
       
        ???????

       
    Return True
    End Sub
    Thanks for help...
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The simplest way is to add the user name and password to the url as get parameters:
    Code:
    mylink?username=xxx&password=yyy
    Then you will be able to get them with req.GetParameter.
     
  3. schimanski

    schimanski Well-Known Member Licensed User

    Thanks, Erel!

    But for what reason do i set job.username and job.password?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You don't need to if you are adding them to the url.

    job.username and password are sent in the headers. However they will only be sent if the server first responds with 401 code.
     
  5. schimanski

    schimanski Well-Known Member Licensed User

    ok. Now i understand..Thanks for your efforts!
     
Loading...