Skip to content
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

Bump mop version to 4.0.0-ursa-5-SNAPSHOT #1444

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mqtt-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>pulsar-protocol-handler-mqtt-parent</artifactId>
<groupId>io.streamnative.pulsar.handlers</groupId>
<version>3.4.0-SNAPSHOT</version>
<version>4.0.0-ursa-5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pulsar-protocol-handler-mqtt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class AuthenticationProviderMTls implements AuthenticationProvider {
@VisibleForTesting
private final ConcurrentHashMap<String, ExpressionCompiler> poolMap = new ConcurrentHashMap<>();
private boolean needCloseMetaData = false;
private AuthenticationMetrics metrics;

private enum ErrorCode {
UNKNOWN,
Expand All @@ -82,15 +83,29 @@ private enum ErrorCode {
}

@Override
public void initialize(ServiceConfiguration config) throws IOException {
this.metadataStore = createLocalMetadataStore(config);
public void initialize(ServiceConfiguration conf) throws IOException {
initialize(Context.builder().config(conf).build());
}

@Override
public void initialize(Context context) throws IOException {
metrics = new AuthenticationMetrics(
context.getOpenTelemetry(), getClass().getSimpleName(), "mtls");
init(context.getConfig());
}

private void init(ServiceConfiguration conf) throws MetadataStoreException {
this.metadataStore = createLocalMetadataStore(conf);
this.needCloseMetaData = true;
this.metadataStore.registerListener(this::handleMetadataChanges);
this.poolResources = new OIDCPoolResources(metadataStore);
this.loadAsync();
}

public void initialize(MetadataStore metadataStore) {
Context context = Context.builder().build();
this.metrics = new AuthenticationMetrics(
context.getOpenTelemetry(), getClass().getSimpleName(), "mtls");
this.metadataStore = metadataStore;
this.metadataStore.registerListener(this::handleMetadataChanges);
this.poolResources = new OIDCPoolResources(metadataStore);
Expand Down Expand Up @@ -219,10 +234,10 @@ public String authenticate(AuthenticationDataSource authData) throws Authenticat
errorCode = ErrorCode.NO_MATCH_POOL;
throw new AuthenticationException("No matched identity pool from the client certificate");
}
AuthenticationMetrics.authenticateSuccess(this.getClass().getSimpleName(), this.getAuthMethodName());
metrics.recordSuccess();
return principal;
} catch (AuthenticationException e) {
this.incrementFailureMetric(errorCode);
metrics.recordFailure(errorCode);
throw e;
}
}
Expand Down
Loading
Loading