mirror of https://github.com/apache/druid.git
Automatically insert authenticator/authorizer names into config properties (#5071)
This commit is contained in:
parent
1c64f02574
commit
819700cbc5
|
@ -100,3 +100,15 @@ Authenticators must implement three methods related to the internal system user:
|
||||||
`createEscalatedJettyClient` is similar to `createEscalatedClient`, except that it operates on a Jetty HttpClient.
|
`createEscalatedJettyClient` is similar to `createEscalatedClient`, except that it operates on a Jetty HttpClient.
|
||||||
|
|
||||||
`createEscalatedAuthenticationResult` returns an AuthenticationResult containing the identity of the "internal system user".
|
`createEscalatedAuthenticationResult` returns an AuthenticationResult containing the identity of the "internal system user".
|
||||||
|
|
||||||
|
## Reserved Name Configuration Property
|
||||||
|
|
||||||
|
For extension implementers, please note that the following configuration properties are reserved for the names of Authenticators and Authorizers:
|
||||||
|
|
||||||
|
```
|
||||||
|
druid.auth.authenticator.<authenticator-name>.name=<authenticator-name>
|
||||||
|
druid.auth.authorizer.<authorizer-name>.name=<authorizer-name>
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
These properties provide the authenticator and authorizer names to the implementations as @JsonProperty parameters, potentially useful when multiple authenticators or authorizers of the same type are configured.
|
||||||
|
|
|
@ -108,7 +108,14 @@ public class AuthenticatorMapperModule implements DruidModule
|
||||||
Authenticator.class
|
Authenticator.class
|
||||||
);
|
);
|
||||||
|
|
||||||
authenticatorProvider.inject(props, configurator);
|
String nameProperty = StringUtils.format("druid.auth.authenticator.%s.name", authenticatorName);
|
||||||
|
Properties adjustedProps = new Properties(props);
|
||||||
|
if (adjustedProps.containsKey(nameProperty)) {
|
||||||
|
throw new IAE("Name property [%s] is reserved.", nameProperty);
|
||||||
|
} else {
|
||||||
|
adjustedProps.put(nameProperty, authenticatorName);
|
||||||
|
}
|
||||||
|
authenticatorProvider.inject(adjustedProps, configurator);
|
||||||
|
|
||||||
Supplier<Authenticator> authenticatorSupplier = authenticatorProvider.get();
|
Supplier<Authenticator> authenticatorSupplier = authenticatorProvider.get();
|
||||||
if (authenticatorSupplier == null) {
|
if (authenticatorSupplier == null) {
|
||||||
|
|
|
@ -111,7 +111,15 @@ public class AuthorizerMapperModule implements DruidModule
|
||||||
Authorizer.class
|
Authorizer.class
|
||||||
);
|
);
|
||||||
|
|
||||||
authorizerProvider.inject(props, configurator);
|
String nameProperty = StringUtils.format("druid.auth.authorizer.%s.name", authorizerName);
|
||||||
|
Properties adjustedProps = new Properties(props);
|
||||||
|
if (adjustedProps.containsKey(nameProperty)) {
|
||||||
|
throw new IAE("Name property [%s] is reserved.", nameProperty);
|
||||||
|
} else {
|
||||||
|
adjustedProps.put(nameProperty, authorizerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
authorizerProvider.inject(adjustedProps, configurator);
|
||||||
|
|
||||||
Supplier<Authorizer> authorizerSupplier = authorizerProvider.get();
|
Supplier<Authorizer> authorizerSupplier = authorizerProvider.get();
|
||||||
if (authorizerSupplier == null) {
|
if (authorizerSupplier == null) {
|
||||||
|
|
Loading…
Reference in New Issue