////
  Copyright 2009-2026 Roland Huss

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
////

[#config]
=== Getting the basic configuration (config)

The Jolokia command `config` is provided to get unauthenticated information about the agent.
It duplicates (a bit) the information from the `version` operation, but is meant to be more universal and generic.

It serves similar purpose as `/.well-known/openid-configuration` endpoint for OpenID Connect providers.

[#get-config]
==== GET version request

The GET URL for a config request has the following format:

----
<base-url>/config
----

[#post-config]
==== POST version request

A version POST request has only a single key
`type` which has to be set to
*`config`*.

However, GET requests are preferred for `config` operation. The reason is that it's easier to configure restricted
access in Servlet applications for GET requests (and remove the constraints for one specific URI). See https://jakarta.ee/specifications/servlet/5.0/jakarta-servlet-spec-5.0#security[Security chapter,role=externalLink,window=_blank]
of Java Servlet API specification.

[#response-config]
==== Config response

The response value for a `config` request looks like this:

[,json,subs="attributes,verbatim"]
----
{
  "request": {
    "type": "config"
  },
  "value": {
    "agent": "2.5.0-SNAPSHOT",
    "protocol": "8.1",
    "security": {
      "authentication": [
        {
          "method": "basic",
          "realm": "jolokia"
        }
      ]
    },
    "id": "jolokia-7778"
  },
  "status": 200,
  "timestamp": 1770641830
}

----

Jolokia only returns information for:

* agent version
* protocol version
* security mechanisms used (could be `basic` authentication or `mtls`)