use of org.apache.qpid.server.plugin.QpidServiceLoader in project qpid-broker-j by apache.
the class OAuth2AuthenticationProviderImpl method onOpen.
@Override
protected void onOpen() {
super.onOpen();
String type = getIdentityResolverType();
_identityResolverService = new QpidServiceLoader().getInstancesByType(OAuth2IdentityResolverService.class).get(type);
_tlsProtocolWhiteList = getContextValue(List.class, ParameterizedTypes.LIST_OF_STRINGS, CommonProperties.QPID_SECURITY_TLS_PROTOCOL_WHITE_LIST);
_tlsProtocolBlackList = getContextValue(List.class, ParameterizedTypes.LIST_OF_STRINGS, CommonProperties.QPID_SECURITY_TLS_PROTOCOL_BLACK_LIST);
_tlsCipherSuiteWhiteList = getContextValue(List.class, ParameterizedTypes.LIST_OF_STRINGS, CommonProperties.QPID_SECURITY_TLS_CIPHER_SUITE_WHITE_LIST);
_tlsCipherSuiteBlackList = getContextValue(List.class, ParameterizedTypes.LIST_OF_STRINGS, CommonProperties.QPID_SECURITY_TLS_CIPHER_SUITE_BLACK_LIST);
_connectTimeout = getContextValue(Integer.class, AUTHENTICATION_OAUTH2_CONNECT_TIMEOUT);
_readTimeout = getContextValue(Integer.class, AUTHENTICATION_OAUTH2_READ_TIMEOUT);
Integer cacheMaxSize = getContextValue(Integer.class, AUTHENTICATION_CACHE_MAX_SIZE);
Long cacheExpirationTime = getContextValue(Long.class, AUTHENTICATION_CACHE_EXPIRATION_TIME);
Integer cacheIterationCount = getContextValue(Integer.class, AUTHENTICATION_CACHE_ITERATION_COUNT);
if (cacheMaxSize == null || cacheMaxSize <= 0 || cacheExpirationTime == null || cacheExpirationTime <= 0 || cacheIterationCount == null || cacheIterationCount < 0) {
LOGGER.debug("disabling authentication result caching");
cacheMaxSize = 0;
cacheExpirationTime = 1L;
cacheIterationCount = 0;
}
_authenticationResultCacher = new AuthenticationResultCacher(cacheMaxSize, cacheExpirationTime, cacheIterationCount);
}
use of org.apache.qpid.server.plugin.QpidServiceLoader in project qpid-broker-j by apache.
the class MessageStoreSerializerFactory method newInstance.
@Override
public MessageStoreSerializer newInstance(final DataInputStream data) throws IOException {
// All encodings should start 0x00 << int length of the version string>> << version string in UTF-8 >>
data.mark(50);
if (data.read() != 0) {
throw new IllegalArgumentException("Invalid format for upload");
}
int stringLength = data.readInt();
byte[] stringBytes = new byte[stringLength];
data.readFully(stringBytes);
String version = new String(stringBytes, StandardCharsets.UTF_8);
data.reset();
Map<String, MessageStoreSerializer> serializerMap = new QpidServiceLoader().getInstancesByType(MessageStoreSerializer.class);
MessageStoreSerializer serializer = serializerMap.get(version);
if (serializer == null) {
throw new IllegalArgumentException("Message store import uses version '" + version + "' which is not supported");
} else {
return serializer;
}
}
Aggregations