Search in sources :

Example 21 with QpidServiceLoader

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);
}
Also used : AuthenticationResultCacher(org.apache.qpid.server.security.auth.manager.AuthenticationResultCacher) QpidServiceLoader(org.apache.qpid.server.plugin.QpidServiceLoader) List(java.util.List)

Example 22 with QpidServiceLoader

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;
    }
}
Also used : QpidServiceLoader(org.apache.qpid.server.plugin.QpidServiceLoader)

Aggregations

QpidServiceLoader (org.apache.qpid.server.plugin.QpidServiceLoader)22 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)3 ManagedObject (org.apache.qpid.server.model.ManagedObject)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 List (java.util.List)2 Map (java.util.Map)2 UUID (java.util.UUID)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 ContainerType (org.apache.qpid.server.model.ContainerType)2 DynamicModel (org.apache.qpid.server.model.DynamicModel)2 Protocol (org.apache.qpid.server.model.Protocol)2 Transport (org.apache.qpid.server.model.Transport)2 ConfiguredObjectRegistration (org.apache.qpid.server.plugin.ConfiguredObjectRegistration)2 File (java.io.File)1 FileReader (java.io.FileReader)1 StringWriter (java.io.StringWriter)1 Principal (java.security.Principal)1