private void addPlugInAuthorizationService( OperationContext context, ModelNode model, String realmName, ServiceTarget serviceTarget, List<ServiceController<?>> newControllers, ServiceBuilder<?> realmBuilder, InjectedValue<SubjectSupplementalService> injector) throws OperationFailedException { ServiceName plugInServiceName = PlugInSubjectSupplemental.ServiceUtil.createServiceName(realmName); final String pluginName = PlugInAuthorizationResourceDefinition.NAME.resolveModelAttribute(context, model).asString(); final Map<String, String> properties = resolveProperties(context, model); PlugInSubjectSupplemental plugInSubjectSupplemental = new PlugInSubjectSupplemental(realmName, pluginName, properties); ServiceBuilder<?> plugInBuilder = serviceTarget.addService(plugInServiceName, plugInSubjectSupplemental); PlugInLoaderService.ServiceUtil.addDependency( plugInBuilder, plugInSubjectSupplemental.getPlugInLoaderServiceValue(), realmName, false); final ServiceController<?> serviceController = plugInBuilder.setInitialMode(ON_DEMAND).install(); if (newControllers != null) { newControllers.add(serviceController); } SubjectSupplementalService.ServiceUtil.addDependency( realmBuilder, injector, plugInServiceName, false); }
private void addPlugInAuthenticationService( OperationContext context, ModelNode model, String realmName, SecurityRealmService registry, ServiceTarget serviceTarget, List<ServiceController<?>> newControllers, ServiceBuilder<?> realmBuilder, Injector<CallbackHandlerService> injector) throws OperationFailedException { ServiceName plugInServiceName = PlugInAuthenticationCallbackHandler.ServiceUtil.createServiceName(realmName); final String pluginName = PlugInAuthorizationResourceDefinition.NAME.resolveModelAttribute(context, model).asString(); final Map<String, String> properties = resolveProperties(context, model); String mechanismName = PlugInAuthenticationResourceDefinition.MECHANISM .resolveModelAttribute(context, model) .asString(); AuthMechanism mechanism = AuthMechanism.valueOf(mechanismName); PlugInAuthenticationCallbackHandler plugInService = new PlugInAuthenticationCallbackHandler( registry.getName(), pluginName, properties, mechanism); ServiceBuilder<CallbackHandlerService> plugInBuilder = serviceTarget.addService(plugInServiceName, plugInService); PlugInLoaderService.ServiceUtil.addDependency( plugInBuilder, plugInService.getPlugInLoaderServiceValue(), realmName, false); final ServiceController<CallbackHandlerService> sc = plugInBuilder.setInitialMode(ON_DEMAND).install(); if (newControllers != null) { newControllers.add(sc); } CallbackHandlerService.ServiceUtil.addDependency( realmBuilder, injector, plugInServiceName, false); }