[skip ci] Check point on token provider#25971
Conversation
|
Pinging @elastic/kibana-security |
|
@jkakavas @albertzaharovits This PR includes the functional token provider that'll depend on the token privileges from elastic/elasticsearch#35751. |
|
cc @azasypkin |
| /** | ||
| * Utility class that knows how to decorate request with proper Basic authentication headers. | ||
| */ | ||
| export class BasicCredentials { |
There was a problem hiding this comment.
Super annoying, but the linter has a rule that disallows accessing static methods on BasicCredentials before it is defined in the same file. Even though it's all static. Dumb.
Anyway, I copied and pasted BasicCredentials without changes to the top of the file so linting would stop failing
|
If anyone wants to give this a whirl or provide any preliminary feedback, please do. It has no tests yet, so it's probably a little buggy, but it should be feature complete. I also haven't yet attempted to use both basic and token providers at the same time. |
|
I discovered an unexpected behavior with this change where login attempts (and authorization header handling) are duplicated between token and basic providers when they are both enabled. I propose a solution to this problem by changing the way failures are handled in the authentication flow here: #26040 |
62348d8 to
ab788ef
Compare
|
My proposed solution to the unexpected behavior in the auth provider failure logic was accepted, so I'm going to proceed with breaking this down and issuing more bite-sized (and tested) PRs. I'm thinking in this order:
|
|
The first three PRs are in, and the final PR that introduces the token provider itself is #26997. I'm going to close this prototype PR now. |
do not merge
I'm pushing this as a testable checkpoint for the new token provider implementation.
authorizationheader contents in cookie when using basic auth headers d595fd2Kibana
You will need extra privileges on the internal server user. Either compile Elasticsearch with elastic/elasticsearch#35751 and use the built-in
kibanauser, or update kibana.yml with a new user that has thekibana_systemrole plus a new role that grants access tocluster:admin/xpack/security/token/*:Then add this to your kibana.yml:
Elasticsearch
If you're not using TLS in your dev install of Elasticsearch, you'll need to manually enable the token service (note, this won't work for production).
The default expiration for tokens is like 30 minutes or something, so you'll probably want to make that smaller while playing around with this if you want to verify the session renewal/refresh token logic: