Hello there,
I'm developing a custom realm based on
The plan is for browser to kibana to be HTTPS, but kibana to elasticsearch is HTTP.
I'm attempting to authenticate with
curl -H "User-Agent: Mozilla" -H "Origin: https://tangotelecom.com" -H "Host: tangotelecom.com:5601" -H "x-proxy-user: irldf" -H "Authorization: Basic YWRtaW46dIzNDU=" -i http://tangotelecom.com:9200
HTTP/1.1 401 Unauthorized
access-control-allow-origin: https://tangotelecom.com
access-control-allow-credentials: true
WWW-Authenticate: Basic realm=tango-ims-realm
content-type: application/json; charset=UTF-8
content-length: 353
{"error":{"root_cause":[{"type":"security_exception","reason":"unable to authenticate user [admin] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=tango-ims-realm"}}],"type":"security_exception","reason":"unable to authenticate user [admin] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=tango-ims-realm"}},"status":401}
From the logs I can see that in my IMSRealm class (which extends Realm) that #authenticate method seems to be getting invoked before #token method?
[2017-04-18T09:02:06,236][DEBUG][c.t.x.r.IMSRealm ] About to process request to authenticate.
[2017-04-18T09:02:06,236][DEBUG][c.t.x.r.IMSRealm ] Tenant and User are not available in the request.
[2017-04-18T09:02:06,242][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] Failed Authentication
[2017-04-18T09:02:06,242][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] URI:
[2017-04-18T09:02:06,242][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] Headers:
[2017-04-18T09:02:06,243][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] Accept=/
[2017-04-18T09:02:06,243][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] User-Agent=Mozilla
[2017-04-18T09:02:06,243][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] Origin=https://tangotelecom.com
[2017-04-18T09:02:06,243][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] Host:5601=tangotelecom.com
[2017-04-18T09:02:06,244][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] x-proxy-user=irldf
[2017-04-18T09:02:06,244][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] Authorization=Basic YWRtaW46dIzNDU=
[2017-04-18T09:02:06,244][DEBUG][c.t.x.r.IMSAuthenticationFailureHandler] content-length=0
....
[2017-04-18T09:02:18,301][DEBUG][c.t.x.r.IMSRealm ] Received request for Tenant: null
[2017-04-18T09:02:18,302][DEBUG][c.t.x.r.IMSRealm ] Received request for Tenant: null
The #token method seems to be getting invoked periodically?
It looks like #token method doesn't get invoked at all as part of the CURL request I sent in. The #token method builds the UsernamePasswordToken that I was expecting to be passed into the #authenticate method but perhaps I've misunderstood and this is not how it is meant to work?
The log 'Tenant and User are not available in the request.' is received when it is not possible to extract a tenant and user from the AuthenticationToken.