I want my Domino Servlet to get an authenticated user session

后端 未结 5 1298
情歌与酒
情歌与酒 2021-01-15 02:43

It seems a like a pretty fundamental question, in a running Servlet hosted on Domino I want to access Domino resources that I have wisely protected using the the very fine s

5条回答
  •  死守一世寂寞
    2021-01-15 03:13

    Jason - I assume you basically want the same functionality you would get running a Web Query Save agent if you didn't select run as Web User selected, in other words as the signer of the code.

    You could try setting up a internet site rule to allow basic authentication for the specific application path you wanted to use - might be worth using a subdomain for this.

    Then within the Servlet call this URL, whilst setting the Basic authorization parameters (username & password).

    Something like this.

    URL url = new URL(URL_TO_CALL);
    String authStr = "USERNAME:PASSWORD";
    String authEncoded = Base64.encodeBytes(authStr.getBytes());
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("GET");
    connection.setDoOutput(true);
    connection.setRequestProperty("Authorization", "Basic " + authEncoded);
    InputStream is = connection.getInputStream();
    

提交回复
热议问题