org.jboss.msc.value.InjectedValue Java Examples

The following examples show how to use org.jboss.msc.value.InjectedValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PermissionMapperDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
static ResourceDefinition getLogicalPermissionMapper() {
    AttributeDefinition[] attributes = new AttributeDefinition[] {LOGICAL_OPERATION, LEFT, RIGHT};
    TrivialAddHandler<PermissionMapper> add = new TrivialAddHandler<PermissionMapper>(PermissionMapper.class, attributes, PERMISSION_MAPPER_RUNTIME_CAPABILITY) {

        @Override
        protected ValueSupplier<PermissionMapper> getValueSupplier(ServiceBuilder<PermissionMapper> serviceBuilder,
                OperationContext context, ModelNode model) throws OperationFailedException {

            final InjectedValue<PermissionMapper> leftPermissionMapperInjector = new InjectedValue<>();
            final InjectedValue<PermissionMapper> rightPermissionMapperInjector = new InjectedValue<>();

            LogicalMapperOperation operation = LogicalMapperOperation.valueOf(LogicalMapperOperation.class, LOGICAL_OPERATION.resolveModelAttribute(context, model).asString().toUpperCase(Locale.ENGLISH));

            serviceBuilder.addDependency(context.getCapabilityServiceName(RuntimeCapability.buildDynamicCapabilityName(PERMISSION_MAPPER_CAPABILITY, LEFT.resolveModelAttribute(context, model).asString()),
                    PermissionMapper.class), PermissionMapper.class, leftPermissionMapperInjector);

            serviceBuilder.addDependency(context.getCapabilityServiceName(RuntimeCapability.buildDynamicCapabilityName(PERMISSION_MAPPER_CAPABILITY, RIGHT.resolveModelAttribute(context, model).asString()),
                    PermissionMapper.class), PermissionMapper.class, rightPermissionMapperInjector);

            return () -> operation.create(leftPermissionMapperInjector.getValue(), rightPermissionMapperInjector.getValue());
        }
    };

    return new TrivialResourceDefinition(ElytronDescriptionConstants.LOGICAL_PERMISSION_MAPPER, add, attributes, PERMISSION_MAPPER_RUNTIME_CAPABILITY);
}
 
Example #2
Source File: KeyStoreRealmDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    ServiceTarget serviceTarget = context.getServiceTarget();
    RuntimeCapability<Void> runtimeCapability = SECURITY_REALM_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName realmName = runtimeCapability.getCapabilityServiceName(SecurityRealm.class);

    final InjectedValue<KeyStore> keyStore = new InjectedValue<KeyStore>();
    TrivialService<SecurityRealm> keyStoreRealmService = new TrivialService<SecurityRealm>(() -> new KeyStoreBackedSecurityRealm(keyStore.getValue()));

    ServiceBuilder<SecurityRealm> serviceBuilder = serviceTarget.addService(realmName, keyStoreRealmService);

    String keyStoreCapabilityName = RuntimeCapability.buildDynamicCapabilityName(KEY_STORE_CAPABILITY, KEYSTORE.resolveModelAttribute(context, model).asString());
    ServiceName keyStoreServiceName = context.getCapabilityServiceName(keyStoreCapabilityName, KeyStore.class);
    KEY_STORE_UTIL.addInjection(serviceBuilder, keyStore, keyStoreServiceName);
    commonDependencies(serviceBuilder)
        .setInitialMode(Mode.ACTIVE)
        .install();
}
 
Example #3
Source File: CachingRealmDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private TrivialService<SecurityRealm> createService(String realmName, int maxEntries, long maxAge, InjectedValue<SecurityRealm> injector) {
    return new TrivialService<>((TrivialService.ValueSupplier<SecurityRealm>) () -> {
        SecurityRealm securityRealm = injector.getValue();

        if (securityRealm instanceof CacheableSecurityRealm) {
            RealmIdentityCache cache = createRealmIdentityCache(maxEntries, maxAge);
            CacheableSecurityRealm cacheableRealm = CacheableSecurityRealm.class.cast(securityRealm);

            if (securityRealm instanceof ModifiableSecurityRealm) {
                return new CachingModifiableSecurityRealm(cacheableRealm, cache);
            }

            return new CachingSecurityRealm(cacheableRealm, cache);
        }

        throw ElytronSubsystemMessages.ROOT_LOGGER.realmDoesNotSupportCache(realmName);
    });
}
 
Example #4
Source File: DomainService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Injector<PrincipalTransformer> createPrincipalTransformerInjector(final String principalTransformerName) {
    if (principalTransformers.containsKey(principalTransformerName)) {
        return null; // i.e. should already be injected for this name.
    }

    InjectedValue<PrincipalTransformer> principalTransformerInjector = new InjectedValue<>();
    principalTransformers.put(principalTransformerName, principalTransformerInjector);
    return principalTransformerInjector;
}
 
Example #5
Source File: DirContextDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {

            RuntimeCapability<Void> runtimeCapability = DIR_CONTEXT_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
            ServiceName serviceName = runtimeCapability.getCapabilityServiceName(DirContextSupplier.class);

            final InjectedValue<ExceptionSupplier<CredentialSource, Exception>> credentialSourceSupplierInjector = new InjectedValue<>();
            final InjectedValue<AuthenticationContext> authenticationContextInjector = new InjectedValue<>();
            final InjectedValue<SSLContext> sslContextInjector = new InjectedValue<>();

            TrivialService<DirContextSupplier> service = new TrivialService<>(obtainDirContextSupplier(context, model, credentialSourceSupplierInjector, authenticationContextInjector, sslContextInjector));
            ServiceBuilder<DirContextSupplier> serviceBuilder = context.getServiceTarget().addService(serviceName, service);

            String sslContextName = SSL_CONTEXT.resolveModelAttribute(context, model).asStringOrNull();
            if (sslContextName != null) {
                String sslCapability = RuntimeCapability.buildDynamicCapabilityName(SSL_CONTEXT_CAPABILITY, sslContextName);
                ServiceName sslServiceName = context.getCapabilityServiceName(sslCapability, SSLContext.class);
                serviceBuilder.addDependency(sslServiceName, SSLContext.class, sslContextInjector);
            }

            if (CREDENTIAL_REFERENCE.resolveModelAttribute(context, model).isDefined()) {
                credentialSourceSupplierInjector.inject(CredentialReference.getCredentialSourceSupplier(context, CREDENTIAL_REFERENCE, model, serviceBuilder));
            }

            String authenticationContextName = AUTHENTICATION_CONTEXT.resolveModelAttribute(context, model).asStringOrNull();
            if (authenticationContextName != null) {
                String acCapability = RuntimeCapability.buildDynamicCapabilityName(AUTHENTICATION_CONTEXT_CAPABILITY, authenticationContextName);
                ServiceName acServiceName = context.getCapabilityServiceName(acCapability, AuthenticationContext.class);
                serviceBuilder.addDependency(acServiceName, AuthenticationContext.class, authenticationContextInjector);
            }

            serviceBuilder
                    .setInitialMode(ServiceController.Mode.ACTIVE)
                    .install();
        }
 
Example #6
Source File: RealmMapperDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    ServiceTarget serviceTarget = context.getServiceTarget();
    RuntimeCapability<Void> runtimeCapability = REALM_MAPPER_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName realmMapperName = runtimeCapability.getCapabilityServiceName(RealmMapper.class);

    final String pattern = PATTERN_CAPTURE_GROUP.resolveModelAttribute(context, model).asString();
    String delegateRealmMapper = DELEGATE_REALM_MAPPER.resolveModelAttribute(context, model).asStringOrNull();

    final InjectedValue<RealmMapper> delegateRealmMapperInjector = new InjectedValue<RealmMapper>();

    TrivialService<RealmMapper> realmMapperService = new TrivialService<RealmMapper>(() -> {
        RealmMapper delegate = delegateRealmMapperInjector.getOptionalValue();
        Pattern compiledPattern = Pattern.compile(pattern);
        if (delegate == null) {
            return new SimpleRegexRealmMapper(compiledPattern);
        } else {
            return new SimpleRegexRealmMapper(compiledPattern, delegate);
        }
    });

    ServiceBuilder<RealmMapper> realmMapperBuilder = serviceTarget.addService(realmMapperName, realmMapperService);

    if (delegateRealmMapper != null) {
        String delegateCapabilityName = RuntimeCapability.buildDynamicCapabilityName(REALM_MAPPER_CAPABILITY, delegateRealmMapper);
        ServiceName delegateServiceName = context.getCapabilityServiceName(delegateCapabilityName, RealmMapper.class);

        realmMapperBuilder.addDependency(delegateServiceName, RealmMapper.class, delegateRealmMapperInjector);
    }

    commonDependencies(realmMapperBuilder)
        .setInitialMode(Mode.LAZY)
        .install();
}
 
Example #7
Source File: SaslServerDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static ResourceDefinition getProviderSaslServerFactoryDefinition() {
    AbstractAddStepHandler add = new SaslServerAddHandler(PROVIDERS) {

        @Override
        protected ServiceBuilder<SaslServerFactory> installService(OperationContext context,
                ServiceName saslServerFactoryName, ModelNode model) throws OperationFailedException {

            String providers = PROVIDERS.resolveModelAttribute(context, model).asStringOrNull();

            final InjectedValue<Provider[]> providerInjector = new InjectedValue<Provider[]>();
            final Supplier<Provider[]> providerSupplier = providers != null ? (providerInjector::getValue) : (Security::getProviders);

            TrivialService<SaslServerFactory> saslServiceFactoryService = new TrivialService<SaslServerFactory>(() -> new SecurityProviderSaslServerFactory(providerSupplier));

            ServiceTarget serviceTarget = context.getServiceTarget();

            ServiceBuilder<SaslServerFactory> serviceBuilder = serviceTarget.addService(saslServerFactoryName, saslServiceFactoryService);

            if (providers != null) {
                serviceBuilder.addDependency(context.getCapabilityServiceName(RuntimeCapability.buildDynamicCapabilityName(PROVIDERS_CAPABILITY, providers),
                        Provider[].class), Provider[].class, providerInjector);
            }

            return serviceBuilder;
        }
    };

    return wrap(new SaslServerResourceDefinition(ElytronDescriptionConstants.PROVIDER_SASL_SERVER_FACTORY, add, PROVIDERS), SaslServerDefinitions::getSaslServerAvailableMechanisms);
}
 
Example #8
Source File: DiscoveryService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Create the DiscoveryService instance.
 *
 * @param discoveryOptions the list of discovery options
 * @param port the port number of the domain controller
 * @param isMasterDomainController whether or not the local host controller is the master
 */
private DiscoveryService(List<DiscoveryOption> discoveryOptions, List<DomainControllerManagementInterface> managementInterfaces, boolean isMasterDomainController) {
    this.discoveryOptions = discoveryOptions;
    this.managementInterfaces = managementInterfaces;
    for(DomainControllerManagementInterface managementInterface : managementInterfaces) {
        interfaceBindings.put(managementInterface.getHost(), new InjectedValue<NetworkInterfaceBinding>());
    }
    this.isMasterDomainController = isMasterDomainController;
}
 
Example #9
Source File: PrincipalDecoderDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    RuntimeCapability<Void> decoderRuntimeCapability = PRINCIPAL_DECODER_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName decoderName = decoderRuntimeCapability.getCapabilityServiceName(PrincipalDecoder.class);

    ServiceTarget serviceTarget = context.getServiceTarget();

    TrivialService<PrincipalDecoder> principalDecoderService = new TrivialService<PrincipalDecoder>();
    ServiceBuilder<PrincipalDecoder> decoderBuilder = serviceTarget.addService(decoderName, principalDecoderService);
    principalDecoderService.setValueSupplier(getValueSupplier(decoderBuilder, context, model));

    commonDependencies(decoderBuilder)
        .setInitialMode(Mode.LAZY)
        .install();

    final InjectedValue<PrincipalDecoder> injectedDecoder = new InjectedValue<>();
    TrivialService<PrincipalTransformer> transformerService = new TrivialService<>(() -> PrincipalTransformer.from(injectedDecoder.getValue().asPrincipalRewriter()));

    RuntimeCapability<Void> transformerRuntimeCapability = PRINCIPAL_TRANSFORMER_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName transformerName = transformerRuntimeCapability.getCapabilityServiceName(PrincipalTransformer.class);

    serviceTarget.addService(transformerName, transformerService)
        .addDependency(decoderName, PrincipalDecoder.class, injectedDecoder)
        .setInitialMode(Mode.LAZY)
        .install();
}
 
Example #10
Source File: CachingRealmDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    ServiceTarget serviceTarget = context.getServiceTarget();
    RuntimeCapability<Void> runtimeCapability = SECURITY_REALM_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName realmName = runtimeCapability.getCapabilityServiceName(SecurityRealm.class);
    String cacheableRealm = REALM_NAME.resolveModelAttribute(context, model).asString();
    int maxEntries = MAXIMUM_ENTRIES.resolveModelAttribute(context, model).asInt();
    long maxAge = MAXIMUM_AGE.resolveModelAttribute(context, model).asInt();
    InjectedValue<SecurityRealm> cacheableRealmValue = new InjectedValue<>();
    ServiceBuilder<SecurityRealm> serviceBuilder = serviceTarget.addService(realmName, createService(cacheableRealm, maxEntries, maxAge, cacheableRealmValue));

    addRealmDependency(context, serviceBuilder, cacheableRealm, cacheableRealmValue);
    commonDependencies(serviceBuilder).setInitialMode(Mode.ACTIVE).install();
}
 
Example #11
Source File: DomainService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Injector<RoleMapper> createRoleMapperInjector(final String roleMapperName) {
    if (roleMappers.containsKey(roleMapperName)) {
        return null; // i.e. should already be injected for this name.
    }

    InjectedValue<RoleMapper> roleMapperInjector = new InjectedValue<>();
    roleMappers.put(roleMapperName, roleMapperInjector);
    return roleMapperInjector;
}
 
Example #12
Source File: DomainService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Injector<RoleDecoder> createRoleDecoderInjector(final String roleDecoderName) {
    if (roleDecoders.containsKey(roleDecoderName)) {
        return null; // i.e. should already be injected for this name.
    }

    InjectedValue<RoleDecoder> roleDecoderInjector = new InjectedValue<>();
    roleDecoders.put(roleDecoderName, roleDecoderInjector);
    return roleDecoderInjector;
}
 
Example #13
Source File: LdapRealmDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void configureDirContext(OperationContext context, ModelNode model, LdapSecurityRealmBuilder realmBuilder, ServiceBuilder<SecurityRealm> serviceBuilder) throws OperationFailedException {
    String dirContextName = DIR_CONTEXT.resolveModelAttribute(context, model).asStringOrNull();

    String runtimeCapability = RuntimeCapability.buildDynamicCapabilityName(DIR_CONTEXT_CAPABILITY, dirContextName);
    ServiceName dirContextServiceName = context.getCapabilityServiceName(runtimeCapability, DirContextSupplier.class);

    final InjectedValue<DirContextSupplier> dirContextInjector = new InjectedValue<>();
    serviceBuilder.addDependency(dirContextServiceName, DirContextSupplier.class, dirContextInjector);

    realmBuilder.setDirContextSupplier(() -> {
        ExceptionSupplier<DirContext, NamingException> supplier = dirContextInjector.getValue();
        return supplier.get();
    });
}
 
Example #14
Source File: PrincipalDecoderDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static ResourceDefinition getConcatenatingPrincipalDecoder() {
    AttributeDefinition[] attributes = new AttributeDefinition[] { JOINER, PRINCIPAL_DECODERS };

    AbstractAddStepHandler add = new PrincipalDecoderAddHandler(attributes) {

        @Override
        protected ValueSupplier<PrincipalDecoder> getValueSupplier(ServiceBuilder<?> serviceBuilder, OperationContext context, ModelNode model) throws OperationFailedException {
            final String joiner = JOINER.resolveModelAttribute(context, model).asString();
            final List<String> decoders = PRINCIPAL_DECODERS.unwrap(context, model);

            final List<InjectedValue<PrincipalDecoder>> principalDecoderInjectors = new ArrayList<>();
            final String baseCapabilityName = PRINCIPAL_DECODER_RUNTIME_CAPABILITY.getName();
            for (String decoder : decoders) {
                InjectedValue<PrincipalDecoder> principalDecoderInjector = new InjectedValue<>();
                String runtimeCapabilityName = RuntimeCapability.buildDynamicCapabilityName(baseCapabilityName, decoder);
                ServiceName decoderServiceName = context.getCapabilityServiceName(runtimeCapabilityName, PrincipalDecoder.class);
                serviceBuilder.addDependency(decoderServiceName, PrincipalDecoder.class, principalDecoderInjector);
                principalDecoderInjectors.add(principalDecoderInjector);
            }
            return () -> {
                final ArrayList<PrincipalDecoder> principalDecoders = new ArrayList<>(principalDecoderInjectors.size());
                for (InjectedValue<PrincipalDecoder> current : principalDecoderInjectors) {
                    principalDecoders.add(current.getValue());
                }
                return PrincipalDecoder.concatenating(joiner, principalDecoders.toArray(new PrincipalDecoder[principalDecoders.size()]));
            };
        }

    };

    return new PrincipalDecoderResourceDefinition(ElytronDescriptionConstants.CONCATENATING_PRINCIPAL_DECODER, add, attributes);
}
 
Example #15
Source File: SSLDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static <T> InjectedValue<T> addDependency(String baseName, SimpleAttributeDefinition attribute,
                                                  Class<T> type, ServiceBuilder<SSLContext> serviceBuilder, OperationContext context, ModelNode model) throws OperationFailedException {

    String dynamicNameElement = attribute.resolveModelAttribute(context, model).asStringOrNull();
    InjectedValue<T> injectedValue = new InjectedValue<>();

    if (dynamicNameElement != null) {
        serviceBuilder.addDependency(context.getCapabilityServiceName(
                buildDynamicCapabilityName(baseName, dynamicNameElement), type),
                type, injectedValue);
    }
    return injectedValue;
}
 
Example #16
Source File: HttpServerDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static ResourceDefinition getProviderHttpServerMechanismFactoryDefinition() {
    AttributeDefinition[] attributes = new AttributeDefinition[] { PROVIDERS };
    AbstractAddStepHandler add = new TrivialAddHandler<HttpServerAuthenticationMechanismFactory>(HttpServerAuthenticationMechanismFactory.class, attributes, HTTP_SERVER_MECHANISM_FACTORY_RUNTIME_CAPABILITY) {

        @Override
        protected ValueSupplier<HttpServerAuthenticationMechanismFactory> getValueSupplier(
                ServiceBuilder<HttpServerAuthenticationMechanismFactory> serviceBuilder, OperationContext context,
                ModelNode model) throws OperationFailedException {

            String providers = PROVIDERS.resolveModelAttribute(context, model).asStringOrNull();
            final Supplier<Provider[]> providerSupplier;
            if (providers != null) {
                final InjectedValue<Provider[]> providersInjector = new InjectedValue<Provider[]>();
                serviceBuilder.addDependency(context.getCapabilityServiceName(
                        buildDynamicCapabilityName(PROVIDERS_CAPABILITY, providers), Provider[].class),
                        Provider[].class, providersInjector);
                providerSupplier = providersInjector::getValue;
            } else {
                providerSupplier = Security::getProviders;
            }

            Predicate<Provider.Service> serviceFilter = (Provider.Service s) -> HttpServerAuthenticationMechanismFactory.class.getSimpleName().equals(s.getType());

            return () -> {
                final Provider[] actualProviders = providerSupplier.get();
                if ( findProviderService(actualProviders, serviceFilter) == null ) {
                    throw ROOT_LOGGER.noSuitableProvider(HttpServerAuthenticationMechanismFactory.class.getSimpleName());
                }
                return new SetMechanismInformationMechanismFactory(new SecurityProviderServerMechanismFactory(actualProviders));
            };
        }

    };

    return wrapFactory(new TrivialResourceDefinition(ElytronDescriptionConstants.PROVIDER_HTTP_SERVER_MECHANISM_FACTORY, add,
            attributes, HTTP_SERVER_MECHANISM_FACTORY_RUNTIME_CAPABILITY));
}
 
Example #17
Source File: PermissionMapperDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static ResourceDefinition getConstantPermissionMapper() {
    final AttributeDefinition[] attributes = new AttributeDefinition[] { PERMISSIONS, PERMISSION_SETS };
    TrivialAddHandler<PermissionMapper>  add = new TrivialAddHandler<PermissionMapper>(PermissionMapper.class, attributes, PERMISSION_MAPPER_RUNTIME_CAPABILITY) {

        @Override
        protected ValueSupplier<PermissionMapper> getValueSupplier(ServiceBuilder<PermissionMapper> serviceBuilder,
                                                                   OperationContext context, ModelNode model) throws OperationFailedException {

            List<Permission> permissions = new ArrayList<>();
            if (model.hasDefined(ElytronDescriptionConstants.PERMISSIONS)) {
                for (ModelNode permission : model.require(ElytronDescriptionConstants.PERMISSIONS).asList()) {
                    permissions.add(new Permission(CLASS_NAME.resolveModelAttribute(context, permission).asString(),
                            MODULE.resolveModelAttribute(context, permission).asStringOrNull(),
                            TARGET_NAME.resolveModelAttribute(context, permission).asStringOrNull(),
                            ACTION.resolveModelAttribute(context, permission).asStringOrNull()));
                }
            }

            List<InjectedValue<Permissions>> permissionSetInjectors = new ArrayList<>();
            if (model.hasDefined(ElytronDescriptionConstants.PERMISSION_SETS)) {
                for (ModelNode permissionSet : model.require(ElytronDescriptionConstants.PERMISSION_SETS).asList()) {
                    InjectedValue<Permissions> permissionSetInjector = new InjectedValue<>();
                    String permissionSetName = PERMISSION_SET_NAME.resolveModelAttribute(context, permissionSet).asString();
                    String runtimeCapability = RuntimeCapability.buildDynamicCapabilityName(PERMISSION_SET_CAPABILITY, permissionSetName);
                    ServiceName permissionSetServiceName = context.getCapabilityServiceName(runtimeCapability, Permissions.class);
                    serviceBuilder.addDependency(permissionSetServiceName, Permissions.class, permissionSetInjector);
                    permissionSetInjectors.add(permissionSetInjector);
                }
            }

            return () -> createConstantPermissionMapper(permissions, permissionSetInjectors);
        }
    };

    return new TrivialResourceDefinition(ElytronDescriptionConstants.CONSTANT_PERMISSION_MAPPER, add, attributes, PERMISSION_MAPPER_RUNTIME_CAPABILITY);
}
 
Example #18
Source File: PermissionMapperDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
Mapping(Set<String> principals, Set<String> roles, List<Permission> permissions, List<InjectedValue<Permissions>> permissionSetInjectors, boolean matchAll) {
    this.principals = principals;
    this.roles = roles;
    this.permissions = permissions;
    this.permissionSetInjectors = permissionSetInjectors;
    this.matchAll = matchAll;
}
 
Example #19
Source File: PermissionMapperDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static Permissions createPermissions(List<Permission> permissionsList, List<InjectedValue<Permissions>> permissionSetInjectors) throws StartException {
    Permissions allPermissions = createPermissions(permissionsList);
    for (InjectedValue<Permissions> permissionSetInjector : permissionSetInjectors) {
        Permissions permissionSet = permissionSetInjector.getValue();
        Enumeration<java.security.Permission> permissions = permissionSet.elements();
        while (permissions.hasMoreElements()) {
            allPermissions.add(permissions.nextElement());
        }
    }
    return allPermissions;
}
 
Example #20
Source File: ProcessApplicationStartService.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public InjectedValue<ProcessEngine> getDefaultProcessEngineInjector() {
  return defaultProcessEngineInjector;
}
 
Example #21
Source File: ModuleLoadService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public InjectedValue<ModuleDefinition> getModuleDefinitionInjectedValue() {
    return moduleDefinitionInjectedValue;
}
 
Example #22
Source File: TestModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
InjectedValue<ContentRepository> getContentRepositoryInjector(){
    return injectedContentRepository;
}
 
Example #23
Source File: ProcessApplicationDeploymentService.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public InjectedValue<ComponentView> getPaComponentViewInjector() {
  return paComponentViewInjector;
}
 
Example #24
Source File: ModuleLoadService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public InjectedValue<ServiceModuleLoader> getServiceModuleLoader() {
    return serviceModuleLoader;
}
 
Example #25
Source File: ServerBootOperationsService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public InjectedValue<HostControllerClient> getClientInjector() {
    return clientInjector;
}
 
Example #26
Source File: ProcessApplicationStartService.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public InjectedValue<ComponentView> getPaComponentViewInjector() {
  return paComponentViewInjector;
}
 
Example #27
Source File: AttachedDependency.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public InjectedValue<Object> getValue() {
    return value;
}
 
Example #28
Source File: AttachedDependency.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public AttachedDependency(AttachmentKey<?> attachmentKey, boolean deploymentUnit) {
    this.attachmentKey = attachmentKey;
    this.value = new InjectedValue<Object>();
    this.deploymentUnit = deploymentUnit;
}
 
Example #29
Source File: DeploymentUnitPhaseService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
InjectedValue<DeployerChains> getDeployerChainsInjector() {
    return deployerChainsInjector;
}
 
Example #30
Source File: ServerBootOperationsService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public InjectedValue<ModelController> getServerController() {
    return serverController;
}