Applied the given debug settings, this gives a whole lot of output
See below. I can see one error in trace when parsing a token but this seems to relate to user elastic, but also some succesful actions after which it seems to loop. I've put the trace output below from the point where I think the authentication attempt started.
[2023-02-15T13:06:29,262][TRACE][o.e.x.s.a.s.SecondaryAuthenticator] [ctbotaels04] no secondary authentication credentials found (the [es-secondary-authorization] header is [null])
[2023-02-15T13:06:29,262][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=elastic,roles=[superuser],fullName=null,email=null,metadata={_reserved=true}], realm={Realm[reserved.reserved] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] in request [transport request action [indices:data/write/bulk]]
[2023-02-15T13:06:29,262][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=elastic,roles=[superuser],fullName=null,email=null,metadata={_reserved=true}], realm={Realm[reserved.reserved] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] in request [transport request action [indices:data/write/bulk[s]]]
[2023-02-15T13:06:29,362][TRACE][o.e.x.s.a.s.ServiceAccountToken] [ctbotaels04] parsing token bytes 65794a30655841694f694a4b563151694c434a68624763694f694a53557a49314e694973496e673164434936496b786a5a6b68506331524b56454a4a56334935536e566f636a68534d4774574f56633056534973496d74705a434936496d743262323530595842705a5868304d44457562584e764c6d316f63334a70616d7375626d776966512e65794a705a4841694f694a586157356b6233647a4969776963335669496a6f69646e4a705a584e6c5147317a6279357461484e79615770724c6d357349697769636d39735a53493657794a435a57686c5a584a6b5a584a665331425749697769516d566f5a5756795a47567958306c4f526c4a42496c3073496d6c68644349364d5459334e6a51324d6a63324d53776961584e7a496a6f6959326c695a794973496d46315a434936496d786e5a32356e496977695a586877496a6f784e6a63324e4459304d4445784c434a75596d59694f6a45324e7a59304e6a49304f444573496d4e68644349364d5459334e6a51324d6a63344d537769644739725a5735705a434936496d5578593251354e7a41794c5755304d3249744e446b314e5330354e6a63304c5759794d44646b4d324a695a6a49344e434a392e475a66474861725947706b563532616263435376572d48623848365f363363684b66385a36517953715f71706848345a344543754f654b6170564f513243485f676e4744676b735f334849373458775530576167744334797a70477375325a6c4f68526f6a3931584d396b676149577152546f724a4962494b694b364e79755245574439414e52305a6477667a37644c51457a6b44724a30363063444c5f5a7953304d6559507a656c4c386b76716a6b326d7356306e6a42687a484d585476775467794f366d4659344b6e44674f666e75334371513941544c727669376f70785479352d64784d443378393155744a627a445059466a6370426541797474545a4b6e754836487479697534706e6e787743465337494a34666e7563343651515648505346477256784370484970564169545434415264324c7877744f53576654492d2d77704f30565256576761634377567751387267
[2023-02-15T13:06:29,363][TRACE][o.e.x.s.a.s.ServiceAccountToken] [ctbotaels04] service account token expects the 4 leading bytes to be [0, 1, 0, 1], got [123, 34, 116, 121].
[2023-02-15T13:06:29,363][DEBUG][o.e.x.s.a.TokenService ] [ctbotaels04] built in token service unable to decode token
java.io.IOException: Illegal base64 character 0x2e
at java.util.Base64$DecInputStream.read(Base64.java:1159) ~[?:?]
at org.elasticsearch.common.io.Streams.readFully(Streams.java:146) ~[elasticsearch-8.6.1.jar:?]
at org.elasticsearch.common.io.stream.InputStreamStreamInput.readBytes(InputStreamStreamInput.java:54) ~[elasticsearch-8.6.1.jar:?] ,
<---- snip snap---->
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
at java.lang.Thread.run(Thread.java:1589) ~[?:?]
[2023-02-15T13:06:29,366][TRACE][o.e.x.s.a.j.JwtAuthenticationToken] [ctbotaels04] Found allowed principal claim name [sub] with value [vriese@mso.mhsrijk.nl]
[2023-02-15T13:06:29,366][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Found authentication credentials [org.elasticsearch.xpack.security.authc.jwt.JwtAuthenticationToken] for principal [cibg/lggng/vriese@mso.mhsrijk.nl] in request [rest request uri [/_security/_authenticate]]
[2023-02-15T13:06:29,366][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Checking token of type [org.elasticsearch.xpack.security.authc.jwt.JwtAuthenticationToken] against [4] realm(s)
[2023-02-15T13:06:29,366][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Trying to authenticate [cibg/lggng/vriese@mso.mhsrijk.nl] using realm [jwt/jwt1] with token [org.elasticsearch.xpack.security.authc.jwt.JwtAuthenticationToken]
[2023-02-15T13:06:29,366][TRACE][o.e.x.s.a.j.JwtUtil ] [ctbotaels04] Accepted client. Authentication type [NONE].
[2023-02-15T13:06:29,366][TRACE][o.e.x.s.a.j.JwtRealm ] [ctbotaels04] Realm [jwt1] client authentication succeeded for token=[cibg/lggng/vriese@mso.mhsrijk.nl].
[2023-02-15T13:06:29,366][TRACE][o.e.x.s.a.j.JwtRealm ] [ctbotaels04] Realm [jwt1] JWT cache miss token=[cibg/lggng/vriese@mso.mhsrijk.nl] key=[org.elasticsearch.common.bytes.BytesArray@4f16ba5e].
[2023-02-15T13:06:29,371][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Found authentication credentials [org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken] for principal [elastic] in request [rest request uri [/_bulk]]
[2023-02-15T13:06:29,371][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Checking token of type [org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken] against [4] realm(s)
[2023-02-15T13:06:29,371][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Trying to authenticate [elastic] using realm [reserved/reserved] with token [org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken]
[2023-02-15T13:06:29,371][DEBUG][o.e.x.s.a.e.ReservedRealm] [ctbotaels04] realm [reserved] authenticated user [elastic], with roles [[superuser]] (cached)
[2023-02-15T13:06:29,371][DEBUG][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Authentication of [elastic] using realm [reserved/reserved] with token [UsernamePasswordToken] was [AuthenticationResult{status=SUCCESS, value=User[username=elastic,roles=[superuser],fullName=null,email=null,metadata={_reserved=true}], message=null, exception=null}]
[2023-02-15T13:06:29,371][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Established authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=elastic,roles=[superuser],fullName=null,email=null,metadata={_reserved=true}], realm={Realm[reserved.reserved] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] for request [rest request uri [/_bulk]]
[2023-02-15T13:06:29,371][TRACE][o.e.x.s.a.s.SecondaryAuthenticator] [ctbotaels04] no secondary authentication credentials found (the [es-secondary-authorization] header is [null])
[2023-02-15T13:06:29,372][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=elastic,roles=[superuser],fullName=null,email=null,metadata={_reserved=true}], realm={Realm[reserved.reserved] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] in request [transport request action [indices:data/write/bulk]]
[2023-02-15T13:06:29,372][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=elastic,roles=[superuser],fullName=null,email=null,metadata={_reserved=true}], realm={Realm[reserved.reserved] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] in request [transport request action [indices:data/write/bulk[s]]]
[2023-02-15T13:06:29,375][DEBUG][o.e.x.s.a.j.JwtAuthenticator] [ctbotaels04] Realm [jwt1] successfully parsed JWT token [cibg/lggng/vriese@mso.mhsrijk.nl] with header [{"x5t":"LcfHOsTJTBIWr9Juhr8R0kV9W4U","kid":"kvontapiext01.mso.mhsrijk.nl","typ":"JWT","alg":"RS256"}] and claimSet [{"sub":"vriese@mso.mhsrijk.nl","aud":"lggng","role":["Beheerder_KPV","Beheerder_INFRA"],"nbf":1676462481,"idp":"Windows","tokenid":"e1cd9702-e43b-4955-9674-f207d3bbf284","cat":1676462781,"iss":"cibg","exp":1676464011,"iat":1676462761}]
[2023-02-15T13:06:29,375][TRACE][o.e.x.s.a.j.JwtValidateUtil] [ctbotaels04] JWKs [1], JWT KID [kvontapiext01.mso.mhsrijk.nl], and JWT Algorithm [RS256] before filters.
[2023-02-15T13:06:29,375][TRACE][o.e.x.s.a.j.JwtValidateUtil] [ctbotaels04] JWKs [1] after KID [kvontapiext01.mso.mhsrijk.nl](|null) filter.
[2023-02-15T13:06:29,375][TRACE][o.e.x.s.a.j.JwtValidateUtil] [ctbotaels04] JWKs [1] after Algorithm [RS256](|null) filter.
[2023-02-15T13:06:29,375][DEBUG][o.e.x.s.a.j.JwtValidateUtil] [ctbotaels04] JWKs [1] after Algorithm [RS256] match filter.
[2023-02-15T13:06:29,375][TRACE][o.e.x.s.a.j.JwtValidateUtil] [ctbotaels04] JWT signature validation succeeded with JWK kty=[RSA], jwtAlg=[RS256], jwtKid=[kvontapiext01.mso.mhsrijk.nl], use=[sig], ops=[null]
[2023-02-15T13:06:29,376][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=_xpack_security,roles=[],fullName=null,email=null,metadata={}], realm={Realm[__attach.__attach] on Node[ctbotaels04]}, type=USER, metadata={}},type=INTERNAL]] in request [transport request action [indices:data/read/search]]
[2023-02-15T13:06:29,378][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=_xpack_security,roles=[],fullName=null,email=null,metadata={}], realm={Realm[__attach.__attach] on Node[ctbotaels04]}, type=USER, metadata={}},type=INTERNAL]] in request [transport request action [indices:data/read/scroll/clear]]
[2023-02-15T13:06:29,378][TRACE][o.e.x.s.a.s.m.NativeRoleMappingStore] [ctbotaels04] Applying role-mapping [beheeruser] to user-model [{metadata.jwt_claim_iss=cibg, metadata.jwt_claim_tokenid=e1cd9702-e43b-4955-9674-f207d3bbf284, metadata.jwt_claim_role=["Beheerder_KPV","Beheerder_INFRA"], metadata.jwt_claim_cat=1676462781, metadata.jwt_claim_idp=Windows, groups=[Beheerder_KPV, Beheerder_INFRA], metadata.jwt_claim_sub=vriese@mso.mhsrijk.nl, metadata.jwt_claim_aud=[lggng], realm.name=jwt1, username=vriese@mso.mhsrijk.nl}] produced role-names [[kibana_user, beheer]]
[2023-02-15T13:06:29,379][TRACE][o.e.x.s.a.s.m.NativeRoleMappingStore] [ctbotaels04] Applying role-mapping [beheerders_jwt] to user-model [{metadata.jwt_claim_iss=cibg, metadata.jwt_claim_tokenid=e1cd9702-e43b-4955-9674-f207d3bbf284, metadata.jwt_claim_role=["Beheerder_KPV","Beheerder_INFRA"], metadata.jwt_claim_cat=1676462781, metadata.jwt_claim_idp=Windows, groups=[Beheerder_KPV, Beheerder_INFRA], metadata.jwt_claim_sub=vriese@mso.mhsrijk.nl, metadata.jwt_claim_aud=[lggng], realm.name=jwt1, username=vriese@mso.mhsrijk.nl}] produced role-names [[beheer]]
[2023-02-15T13:06:29,379][DEBUG][o.e.x.s.a.s.m.NativeRoleMappingStore] [ctbotaels04] Mapping user [UserData{username:vriese@mso.mhsrijk.nl; dn:null; groups:[Beheerder_KPV, Beheerder_INFRA]; metadata:{jwt_claim_sub=vriese@mso.mhsrijk.nl, jwt_claim_role=["Beheerder_KPV","Beheerder_INFRA"], jwt_claim_idp=Windows, jwt_claim_tokenid=e1cd9702-e43b-4955-9674-f207d3bbf284, jwt_claim_cat=1676462781, jwt_claim_aud=[lggng], jwt_claim_iss=cibg}; realm=jwt1}] to roles [[kibana_user, beheer]]
[2023-02-15T13:06:29,379][DEBUG][o.e.x.s.a.j.JwtRealm ] [ctbotaels04] Realm [jwt1] roles [kibana_user,beheer] for principal=[vriese@mso.mhsrijk.nl].
[2023-02-15T13:06:29,379][DEBUG][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Authentication of [cibg/lggng/vriese@mso.mhsrijk.nl] using realm [jwt/jwt1] with token [JwtAuthenticationToken] was [AuthenticationResult{status=SUCCESS, value=User[username=vriese@mso.mhsrijk.nl,roles=[kibana_user,beheer],fullName=null,email=null,metadata={jwt_claim_sub=vriese@mso.mhsrijk.nl, jwt_claim_role=["Beheerder_KPV","Beheerder_INFRA"], jwt_claim_idp=Windows, jwt_claim_tokenid=e1cd9702-e43b-4955-9674-f207d3bbf284, jwt_claim_cat=1676462781, jwt_claim_aud=[lggng], jwt_claim_iss=cibg}], message=null, exception=null}]
[2023-02-15T13:06:29,379][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Established authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=vriese@mso.mhsrijk.nl,roles=[kibana_user,beheer],fullName=null,email=null,metadata={jwt_claim_sub=vriese@mso.mhsrijk.nl, jwt_claim_role=["Beheerder_KPV","Beheerder_INFRA"], jwt_claim_idp=Windows, jwt_claim_tokenid=e1cd9702-e43b-4955-9674-f207d3bbf284, jwt_claim_cat=1676462781, jwt_claim_aud=[lggng], jwt_claim_iss=cibg}], realm={Realm[jwt.jwt1] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] for request [rest request uri [/_security/_authenticate]]
[2023-02-15T13:06:29,380][TRACE][o.e.x.s.a.s.SecondaryAuthenticator] [ctbotaels04] no secondary authentication credentials found (the [es-secondary-authorization] header is [null])
[2023-02-15T13:06:29,380][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=vriese@mso.mhsrijk.nl,roles=[kibana_user,beheer],fullName=null,email=null,metadata={jwt_claim_sub=vriese@mso.mhsrijk.nl, jwt_claim_role=["Beheerder_KPV","Beheerder_INFRA"], jwt_claim_idp=Windows, jwt_claim_tokenid=e1cd9702-e43b-4955-9674-f207d3bbf284, jwt_claim_cat=1676462781, jwt_claim_aud=[lggng], jwt_claim_iss=cibg}], realm={Realm[jwt.jwt1] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] in request [transport request action [cluster:admin/xpack/security/user/authenticate]]
[2023-02-15T13:06:29,382][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Found authentication credentials [org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken] for principal [kibana_system] in request [rest request uri [/.kibana_8.6.1/_search?rest_total_hits_as_int=true]]
[2023-02-15T13:06:29,383][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Checking token of type [org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken] against [4] realm(s)
[2023-02-15T13:06:29,383][TRACE][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Trying to authenticate [kibana_system] using realm [reserved/reserved] with token [org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken]
[2023-02-15T13:06:29,383][DEBUG][o.e.x.s.a.e.ReservedRealm] [ctbotaels04] realm [reserved] authenticated user [kibana_system], with roles [[kibana_system]] (cached)
[2023-02-15T13:06:29,383][DEBUG][o.e.x.s.a.RealmsAuthenticator] [ctbotaels04] Authentication of [kibana_system] using realm [reserved/reserved] with token [UsernamePasswordToken] was [AuthenticationResult{status=SUCCESS, value=User[username=kibana_system,roles=[kibana_system],fullName=null,email=null,metadata={_reserved=true}], message=null, exception=null}]
[2023-02-15T13:06:29,383][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Established authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=kibana_system,roles=[kibana_system],fullName=null,email=null,metadata={_reserved=true}], realm={Realm[reserved.reserved] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] for request [rest request uri [/.kibana_8.6.1/_search?rest_total_hits_as_int=true]]
[2023-02-15T13:06:29,383][TRACE][o.e.x.s.a.s.SecondaryAuthenticator] [ctbotaels04] no secondary authentication credentials found (the [es-secondary-authorization] header is [null])
[2023-02-15T13:06:29,383][TRACE][o.e.x.s.a.AuthenticatorChain] [ctbotaels04] Found existing authentication [Authentication[effectiveSubject=Subject{version=8.6.1, user=User[username=kibana_system,roles=[kibana_system],fullName=null,email=null,metadata={_reserved=true}], realm={Realm[reserved.reserved] on Node[ctbotaels04]}, type=USER, metadata={}},type=REALM]] in request [transport request action [indices:data/read/search]]
[2023-02-15T13:06:29,389][TRACE][o.e.x.s.a.s.ServiceAccountToken] [ctbotaels04] parsing token byt
type or paste code here
And repeat from here.
Apart from the strange error message it seems to authenticate Ok and get's the planned roles:
[ctbotaels04] Authentication of [cibg/lggng/vriese@mso.mhsrijk.nl] using realm [jwt/jwt1] with token [JwtAuthenticationToken] was [AuthenticationResult{status=SUCCESS, value=User[username=vriese@mso.mhsrijk.nl,roles=[kibana_user,beheer],fullName=null,email=null,metadata={jwt_claim_sub=vriese@mso.mhsrijk.nl, jwt_claim_role=["Beheerder_KPV","Beheerder_INFRA"], jwt_claim_idp=Windows, jwt_claim_tokenid=e1cd9702-e43b-4955-9674-f207d3bbf284, jwt_claim_cat=1676462781, jwt_claim_aud=[lggng], jwt_claim_iss=cibg}], message=null, exception=null}]