-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Kerberos Spnego Authentication Router Issue #5706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
769faf4
73ffd71
97cab90
907bdcf
65698fe
0dfd198
2d0b3ca
922e26d
5366244
ac74b8e
0c8503f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,9 @@ | |
| import io.druid.server.router.QueryHostFinder; | ||
| import io.druid.server.router.Router; | ||
| import io.druid.server.security.AuthConfig; | ||
| import io.druid.server.security.AuthenticationResult; | ||
| import io.druid.server.security.Authenticator; | ||
| import io.druid.server.security.AuthenticatorMapper; | ||
| import org.apache.http.client.utils.URIBuilder; | ||
| import org.eclipse.jetty.client.HttpClient; | ||
| import org.eclipse.jetty.client.api.Request; | ||
|
|
@@ -113,6 +116,7 @@ private static void handleException(HttpServletResponse response, ObjectMapper o | |
| private final ServiceEmitter emitter; | ||
| private final RequestLogger requestLogger; | ||
| private final GenericQueryMetricsFactory queryMetricsFactory; | ||
| private final AuthenticatorMapper authenticatorMapper; | ||
|
|
||
| private HttpClient broadcastClient; | ||
|
|
||
|
|
@@ -126,7 +130,8 @@ public AsyncQueryForwardingServlet( | |
| @Router DruidHttpClientConfig httpClientConfig, | ||
| ServiceEmitter emitter, | ||
| RequestLogger requestLogger, | ||
| GenericQueryMetricsFactory queryMetricsFactory | ||
| GenericQueryMetricsFactory queryMetricsFactory, | ||
| AuthenticatorMapper authenticatorMapper | ||
| ) | ||
| { | ||
| this.warehouse = warehouse; | ||
|
|
@@ -138,6 +143,7 @@ public AsyncQueryForwardingServlet( | |
| this.emitter = emitter; | ||
| this.requestLogger = requestLogger; | ||
| this.queryMetricsFactory = queryMetricsFactory; | ||
| this.authenticatorMapper = authenticatorMapper; | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -313,6 +319,22 @@ protected void sendProxyRequest( | |
| // will log that on the remote node. | ||
| clientRequest.setAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED, true); | ||
|
|
||
| // Check if there is an authentication result and use it to decorate the proxy request if needed. | ||
| AuthenticationResult authenticationResult = (AuthenticationResult) clientRequest.getAttribute( | ||
| AuthConfig.DRUID_AUTHENTICATION_RESULT); | ||
| if (authenticationResult != null && authenticationResult.getAuthenticatedBy() != null) { | ||
| Authenticator authenticator = authenticatorMapper.getAuthenticatorMap() | ||
| .get(authenticationResult.getAuthenticatedBy()); | ||
| if (authenticator != null) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am not wrong user needs to make sure that he defines a property like this for every authenticator -
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is coming from the list of authenticators and injected at the Authenticator module.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds good. |
||
| authenticator.decorateProxyRequest( | ||
| clientRequest, | ||
| proxyResponse, | ||
| proxyRequest | ||
| ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you log an error here if the authenticator is not found? |
||
| } else { | ||
| log.error("Can not find Authenticator with Name [%s]", authenticationResult.getAuthenticatedBy()); | ||
| } | ||
| } | ||
| super.sendProxyRequest( | ||
| clientRequest, | ||
| proxyResponse, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new property - please add to docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is injected by the Jackson from the list of authenticators. user does not set this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good.