Enabling NCSA logging in pax.web does not display user name in Jetty logs

Description

After enabling Jetty NCSA log - e.g. using org.ops4j.pax.web.cfg like this:

org.ops4j.pax.web.log.ncsa.enabled = true org.ops4j.pax.web.log.ncsa.directory = ${karaf.data}/log org.ops4j.pax.web.log.ncsa.extended = true

request logs are generated:

# curl -u admin:admin http://127.0.0.1:8181/rests/data/network-topology:network-topology {"network-topology:network-topology": {"topology":[ {"topology-id":"topology-netconf"} ]}}   # cat ./data/log/2024-07-13.request.log 127.0.0.1 - - [13/Jul/2024:01:33:35 +0000] "GET /rests/data/network-topology:network-topology HTTP/1.1" 200 87 "-" "curl/7.61.1"

Instead of:

127.0.0.1 - admin [13/Jul/2024:01:33:35 +0000] "GET /rests/data/network-topology:network-topology HTTP/1.1" 200 87 "-" "curl/7.61.1"

There was an issue (https://github.com/ops4j/org.ops4j.pax.web/issues/1907) in Pax Web that prevented logging of the authenticated user, but it has been fixed in 8.0.23

However, we are not setting user information into the request with AAA. When AAA starts to authenticate the user, the code provided in Pax Web issue #1907 has already been executed.

The first place where we can update the Authentication in the Jetty request is in the https://github.com/opendaylight/aaa/blob/v0.20.0/aaa-filterchain/src/main/java/org/opendaylight/aaa/filterchain/filters/CustomFilterAdapter.java#L65. Here, we have the Jetty server Request provided as a parameter, along with headers from the request that contain user information.

Environment

None

Activity

Robert Varga November 27, 2024 at 1:22 AM

just what sort of a bot are you? any preferences around where we place you?

Ivan Hraško September 18, 2024 at 7:29 AM

As in “However, we are not setting user information into the request with AAA. When AAA starts to authenticate the user, the code provided in Pax Web issue #1907 has already been executed.“ means that we need additional filter to set user despite we are using fixed Pax Web version.

Ivan Hraško September 17, 2024 at 7:47 AM
Edited

Karaf 4.4.6 is using Pax Web 8.0.27 (https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12311140&version=12354057). This version of Karaf is used in all supported odlparent versions 14.0.x and 13.1.x.

Done

Details

Assignee

Reporter

Labels

Components

Fix versions

Priority

Created August 7, 2024 at 9:36 AM
Updated November 27, 2024 at 1:22 AM
Resolved November 22, 2024 at 10:35 AM