codelipenghui commented on a change in pull request #11341:
URL: https://github.com/apache/pulsar/pull/11341#discussion_r672235245



##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/MultiRolesTokenAuthorizationProvider.java
##########
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.authorization;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwt;
+import io.jsonwebtoken.JwtParser;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.RequiredTypeException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.AuthenticationDataSource;
+import org.apache.pulsar.broker.cache.ConfigurationCacheService;
+import org.apache.pulsar.common.naming.NamespaceName;
+import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.policies.data.NamespaceOperation;
+import org.apache.pulsar.common.policies.data.PolicyName;
+import org.apache.pulsar.common.policies.data.PolicyOperation;
+import org.apache.pulsar.common.policies.data.TenantOperation;
+import org.apache.pulsar.common.policies.data.TopicOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class MultiRolesTokenAuthorizationProvider extends 
PulsarAuthorizationProvider {
+    private static final Logger log = 
LoggerFactory.getLogger(MultiRolesTokenAuthorizationProvider.class);
+
+    static final String HTTP_HEADER_NAME = "Authorization";
+    static final String HTTP_HEADER_VALUE_PREFIX = "Bearer ";
+
+    // When symmetric key is configured
+    static final String CONF_TOKEN_SETTING_PREFIX = "";
+
+    // The token's claim that corresponds to the "role" string
+    static final String CONF_TOKEN_AUTH_CLAIM = "tokenAuthClaim";
+
+    private JwtParser parser;
+    private String roleClaim;
+
+    public MultiRolesTokenAuthorizationProvider() {
+        this.roleClaim = Claims.SUBJECT;
+        this.parser = Jwts.parserBuilder().build();
+    }
+
+    @Override
+    public void initialize(ServiceConfiguration conf, 
ConfigurationCacheService configCache) throws IOException {
+        String prefix = (String) conf.getProperty(CONF_TOKEN_SETTING_PREFIX);
+        if (null == prefix) {
+            prefix = "";
+        }
+        String confTokenAuthClaimSettingName = prefix + CONF_TOKEN_AUTH_CLAIM;
+        if (conf.getProperty(confTokenAuthClaimSettingName) != null
+                && StringUtils.isNotBlank((String) 
conf.getProperty(confTokenAuthClaimSettingName))) {
+            this.roleClaim = (String) 
conf.getProperty(confTokenAuthClaimSettingName);
+        }
+
+        super.initialize(conf, configCache);
+    }
+
+    private List<String> getRoles(AuthenticationDataSource authData) {
+        String token = null;
+
+        if (authData.hasDataFromCommand()) {
+            // Authenticate Pulsar binary connection
+            token = authData.getCommandData();
+            if (StringUtils.isBlank(token)) {
+                return Collections.emptyList();
+            }
+        } else if (authData.hasDataFromHttp()) {
+            // The format here should be compliant to RFC-6750
+            // (https://tools.ietf.org/html/rfc6750#section-2.1). Eg: 
Authorization: Bearer xxxxxxxxxxxxx
+            String httpHeaderValue = authData.getHttpHeader(HTTP_HEADER_NAME);
+            if (httpHeaderValue == null || 
!httpHeaderValue.startsWith(HTTP_HEADER_VALUE_PREFIX)) {
+                return Collections.emptyList();
+            }
+
+            // Remove prefix
+            token = 
httpHeaderValue.substring(HTTP_HEADER_VALUE_PREFIX.length());
+        }
+
+        if (token == null)
+            return Collections.emptyList();
+
+        String[] splitToken = token.split("\\.");
+        String unsignedToken = splitToken[0] + "." + splitToken[1] + ".";
+
+        Jwt<?, Claims> jwt = parser.parseClaimsJwt(unsignedToken);
+        try {
+            Collections.singletonList(jwt.getBody().get(roleClaim, 
String.class));
+        } catch (RequiredTypeException requiredTypeException) {
+            List list = jwt.getBody().get(roleClaim, List.class);
+            if (list != null) {
+                return list;
+            }
+        }
+
+        return Collections.emptyList();
+    }
+
+    public CompletableFuture<Boolean> authorize(AuthenticationDataSource 
authenticationData, Function<String, CompletableFuture<Boolean>> authorizeFunc) 
{
+        List<String> roles = getRoles(authenticationData);

Review comment:
       `getRoles()` might introduce the `RequiredTypeException` if the value 
not the String type and List type. We should make sure the CompletableFuture 
can be handled correctly.

##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/MultiRolesTokenAuthorizationProvider.java
##########
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.authorization;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwt;
+import io.jsonwebtoken.JwtParser;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.RequiredTypeException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.AuthenticationDataSource;
+import org.apache.pulsar.broker.cache.ConfigurationCacheService;
+import org.apache.pulsar.common.naming.NamespaceName;
+import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.policies.data.NamespaceOperation;
+import org.apache.pulsar.common.policies.data.PolicyName;
+import org.apache.pulsar.common.policies.data.PolicyOperation;
+import org.apache.pulsar.common.policies.data.TenantOperation;
+import org.apache.pulsar.common.policies.data.TopicOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class MultiRolesTokenAuthorizationProvider extends 
PulsarAuthorizationProvider {
+    private static final Logger log = 
LoggerFactory.getLogger(MultiRolesTokenAuthorizationProvider.class);
+
+    static final String HTTP_HEADER_NAME = "Authorization";
+    static final String HTTP_HEADER_VALUE_PREFIX = "Bearer ";
+
+    // When symmetric key is configured
+    static final String CONF_TOKEN_SETTING_PREFIX = "";
+
+    // The token's claim that corresponds to the "role" string
+    static final String CONF_TOKEN_AUTH_CLAIM = "tokenAuthClaim";
+
+    private JwtParser parser;
+    private String roleClaim;
+
+    public MultiRolesTokenAuthorizationProvider() {
+        this.roleClaim = Claims.SUBJECT;
+        this.parser = Jwts.parserBuilder().build();
+    }
+
+    @Override
+    public void initialize(ServiceConfiguration conf, 
ConfigurationCacheService configCache) throws IOException {
+        String prefix = (String) conf.getProperty(CONF_TOKEN_SETTING_PREFIX);
+        if (null == prefix) {
+            prefix = "";
+        }
+        String confTokenAuthClaimSettingName = prefix + CONF_TOKEN_AUTH_CLAIM;
+        if (conf.getProperty(confTokenAuthClaimSettingName) != null
+                && StringUtils.isNotBlank((String) 
conf.getProperty(confTokenAuthClaimSettingName))) {
+            this.roleClaim = (String) 
conf.getProperty(confTokenAuthClaimSettingName);

Review comment:
       It's better to get the property first to avoid multi calls for the 
`getProperty()`

##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/MultiRolesTokenAuthorizationProvider.java
##########
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.authorization;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwt;
+import io.jsonwebtoken.JwtParser;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.RequiredTypeException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.AuthenticationDataSource;
+import org.apache.pulsar.broker.cache.ConfigurationCacheService;
+import org.apache.pulsar.common.naming.NamespaceName;
+import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.policies.data.NamespaceOperation;
+import org.apache.pulsar.common.policies.data.PolicyName;
+import org.apache.pulsar.common.policies.data.PolicyOperation;
+import org.apache.pulsar.common.policies.data.TenantOperation;
+import org.apache.pulsar.common.policies.data.TopicOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class MultiRolesTokenAuthorizationProvider extends 
PulsarAuthorizationProvider {
+    private static final Logger log = 
LoggerFactory.getLogger(MultiRolesTokenAuthorizationProvider.class);
+
+    static final String HTTP_HEADER_NAME = "Authorization";
+    static final String HTTP_HEADER_VALUE_PREFIX = "Bearer ";
+
+    // When symmetric key is configured
+    static final String CONF_TOKEN_SETTING_PREFIX = "";
+
+    // The token's claim that corresponds to the "role" string
+    static final String CONF_TOKEN_AUTH_CLAIM = "tokenAuthClaim";
+
+    private JwtParser parser;
+    private String roleClaim;
+
+    public MultiRolesTokenAuthorizationProvider() {
+        this.roleClaim = Claims.SUBJECT;
+        this.parser = Jwts.parserBuilder().build();
+    }
+
+    @Override
+    public void initialize(ServiceConfiguration conf, 
ConfigurationCacheService configCache) throws IOException {
+        String prefix = (String) conf.getProperty(CONF_TOKEN_SETTING_PREFIX);
+        if (null == prefix) {
+            prefix = "";
+        }
+        String confTokenAuthClaimSettingName = prefix + CONF_TOKEN_AUTH_CLAIM;
+        if (conf.getProperty(confTokenAuthClaimSettingName) != null
+                && StringUtils.isNotBlank((String) 
conf.getProperty(confTokenAuthClaimSettingName))) {
+            this.roleClaim = (String) 
conf.getProperty(confTokenAuthClaimSettingName);
+        }
+
+        super.initialize(conf, configCache);
+    }
+
+    private List<String> getRoles(AuthenticationDataSource authData) {
+        String token = null;
+
+        if (authData.hasDataFromCommand()) {
+            // Authenticate Pulsar binary connection
+            token = authData.getCommandData();
+            if (StringUtils.isBlank(token)) {
+                return Collections.emptyList();
+            }
+        } else if (authData.hasDataFromHttp()) {
+            // The format here should be compliant to RFC-6750
+            // (https://tools.ietf.org/html/rfc6750#section-2.1). Eg: 
Authorization: Bearer xxxxxxxxxxxxx
+            String httpHeaderValue = authData.getHttpHeader(HTTP_HEADER_NAME);
+            if (httpHeaderValue == null || 
!httpHeaderValue.startsWith(HTTP_HEADER_VALUE_PREFIX)) {
+                return Collections.emptyList();
+            }
+
+            // Remove prefix
+            token = 
httpHeaderValue.substring(HTTP_HEADER_VALUE_PREFIX.length());
+        }
+
+        if (token == null)
+            return Collections.emptyList();
+
+        String[] splitToken = token.split("\\.");
+        String unsignedToken = splitToken[0] + "." + splitToken[1] + ".";
+
+        Jwt<?, Claims> jwt = parser.parseClaimsJwt(unsignedToken);
+        try {
+            Collections.singletonList(jwt.getBody().get(roleClaim, 
String.class));
+        } catch (RequiredTypeException requiredTypeException) {
+            List list = jwt.getBody().get(roleClaim, List.class);
+            if (list != null) {
+                return list;
+            }
+        }
+
+        return Collections.emptyList();
+    }
+
+    public CompletableFuture<Boolean> authorize(AuthenticationDataSource 
authenticationData, Function<String, CompletableFuture<Boolean>> authorizeFunc) 
{
+        List<String> roles = getRoles(authenticationData);
+        List<CompletableFuture<Boolean>> futures = new 
ArrayList<>(roles.size());
+        roles.forEach(r -> futures.add(authorizeFunc.apply(r)));
+        CompletableFuture[] cfs = futures.toArray(new 
CompletableFuture[futures.size()]);
+        return CompletableFuture.allOf(cfs)
+                .thenApply(ignored -> 
futures.stream().map(CompletableFuture::join).collect(Collectors.toList()))
+                .thenApply(list -> list.stream().anyMatch(result -> result));

Review comment:
       I think we can improve the implementation here since we don't need to 
wait for all furtures to be complete right? If one `authorizeFunc` completes 
and responds for `true`, then we can complete the result future.

##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/MultiRolesTokenAuthorizationProvider.java
##########
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.authorization;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwt;
+import io.jsonwebtoken.JwtParser;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.RequiredTypeException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.AuthenticationDataSource;
+import org.apache.pulsar.broker.cache.ConfigurationCacheService;
+import org.apache.pulsar.common.naming.NamespaceName;
+import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.policies.data.NamespaceOperation;
+import org.apache.pulsar.common.policies.data.PolicyName;
+import org.apache.pulsar.common.policies.data.PolicyOperation;
+import org.apache.pulsar.common.policies.data.TenantOperation;
+import org.apache.pulsar.common.policies.data.TopicOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class MultiRolesTokenAuthorizationProvider extends 
PulsarAuthorizationProvider {
+    private static final Logger log = 
LoggerFactory.getLogger(MultiRolesTokenAuthorizationProvider.class);
+
+    static final String HTTP_HEADER_NAME = "Authorization";
+    static final String HTTP_HEADER_VALUE_PREFIX = "Bearer ";
+
+    // When symmetric key is configured
+    static final String CONF_TOKEN_SETTING_PREFIX = "";
+
+    // The token's claim that corresponds to the "role" string
+    static final String CONF_TOKEN_AUTH_CLAIM = "tokenAuthClaim";
+
+    private JwtParser parser;
+    private String roleClaim;
+
+    public MultiRolesTokenAuthorizationProvider() {
+        this.roleClaim = Claims.SUBJECT;
+        this.parser = Jwts.parserBuilder().build();
+    }
+
+    @Override
+    public void initialize(ServiceConfiguration conf, 
ConfigurationCacheService configCache) throws IOException {
+        String prefix = (String) conf.getProperty(CONF_TOKEN_SETTING_PREFIX);
+        if (null == prefix) {
+            prefix = "";
+        }
+        String confTokenAuthClaimSettingName = prefix + CONF_TOKEN_AUTH_CLAIM;
+        if (conf.getProperty(confTokenAuthClaimSettingName) != null
+                && StringUtils.isNotBlank((String) 
conf.getProperty(confTokenAuthClaimSettingName))) {
+            this.roleClaim = (String) 
conf.getProperty(confTokenAuthClaimSettingName);
+        }
+
+        super.initialize(conf, configCache);
+    }
+
+    private List<String> getRoles(AuthenticationDataSource authData) {
+        String token = null;
+
+        if (authData.hasDataFromCommand()) {
+            // Authenticate Pulsar binary connection
+            token = authData.getCommandData();
+            if (StringUtils.isBlank(token)) {
+                return Collections.emptyList();
+            }
+        } else if (authData.hasDataFromHttp()) {
+            // The format here should be compliant to RFC-6750
+            // (https://tools.ietf.org/html/rfc6750#section-2.1). Eg: 
Authorization: Bearer xxxxxxxxxxxxx
+            String httpHeaderValue = authData.getHttpHeader(HTTP_HEADER_NAME);
+            if (httpHeaderValue == null || 
!httpHeaderValue.startsWith(HTTP_HEADER_VALUE_PREFIX)) {
+                return Collections.emptyList();
+            }
+
+            // Remove prefix
+            token = 
httpHeaderValue.substring(HTTP_HEADER_VALUE_PREFIX.length());
+        }
+
+        if (token == null)
+            return Collections.emptyList();
+
+        String[] splitToken = token.split("\\.");
+        String unsignedToken = splitToken[0] + "." + splitToken[1] + ".";
+
+        Jwt<?, Claims> jwt = parser.parseClaimsJwt(unsignedToken);
+        try {
+            Collections.singletonList(jwt.getBody().get(roleClaim, 
String.class));
+        } catch (RequiredTypeException requiredTypeException) {
+            List list = jwt.getBody().get(roleClaim, List.class);
+            if (list != null) {
+                return list;
+            }
+        }
+
+        return Collections.emptyList();
+    }
+
+    public CompletableFuture<Boolean> authorize(AuthenticationDataSource 
authenticationData, Function<String, CompletableFuture<Boolean>> authorizeFunc) 
{
+        List<String> roles = getRoles(authenticationData);
+        List<CompletableFuture<Boolean>> futures = new 
ArrayList<>(roles.size());
+        roles.forEach(r -> futures.add(authorizeFunc.apply(r)));
+        CompletableFuture[] cfs = futures.toArray(new 
CompletableFuture[futures.size()]);
+        return CompletableFuture.allOf(cfs)

Review comment:
       We have a `FutureUtil.waitForAll()`.

##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/MultiRolesTokenAuthorizationProvider.java
##########
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.authorization;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwt;
+import io.jsonwebtoken.JwtParser;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.RequiredTypeException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.AuthenticationDataSource;
+import org.apache.pulsar.broker.cache.ConfigurationCacheService;
+import org.apache.pulsar.common.naming.NamespaceName;
+import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.policies.data.NamespaceOperation;
+import org.apache.pulsar.common.policies.data.PolicyName;
+import org.apache.pulsar.common.policies.data.PolicyOperation;
+import org.apache.pulsar.common.policies.data.TenantOperation;
+import org.apache.pulsar.common.policies.data.TopicOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class MultiRolesTokenAuthorizationProvider extends 
PulsarAuthorizationProvider {
+    private static final Logger log = 
LoggerFactory.getLogger(MultiRolesTokenAuthorizationProvider.class);
+
+    static final String HTTP_HEADER_NAME = "Authorization";
+    static final String HTTP_HEADER_VALUE_PREFIX = "Bearer ";
+
+    // When symmetric key is configured
+    static final String CONF_TOKEN_SETTING_PREFIX = "";
+
+    // The token's claim that corresponds to the "role" string
+    static final String CONF_TOKEN_AUTH_CLAIM = "tokenAuthClaim";
+
+    private JwtParser parser;
+    private String roleClaim;
+
+    public MultiRolesTokenAuthorizationProvider() {
+        this.roleClaim = Claims.SUBJECT;
+        this.parser = Jwts.parserBuilder().build();
+    }
+
+    @Override
+    public void initialize(ServiceConfiguration conf, 
ConfigurationCacheService configCache) throws IOException {
+        String prefix = (String) conf.getProperty(CONF_TOKEN_SETTING_PREFIX);

Review comment:
       The "CONF_TOKEN_SETTING_PREFIX" will be always an empty string?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to