@Override public void start(StartContext context) throws StartException { KeycloakAdapterConfigService adapterConfigService = KeycloakAdapterConfigService.getInstance(); String config = adapterConfigService.getJSON(this.factoryName); this.httpAuthenticationFactory = new KeycloakHttpServerAuthenticationMechanismFactory(createDeploymentContext(config.getBytes())); }
static void installCapability(OperationContext context, ModelNode operation) { PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); String factoryName = pathAddress.getLastElement().getValue(); ServiceName serviceName = context.getCapabilityServiceName(HTTP_SERVER_AUTHENTICATION_CAPABILITY, factoryName, HttpServerAuthenticationMechanismFactory.class); KeycloakHttpAuthenticationFactoryService service = new KeycloakHttpAuthenticationFactoryService(factoryName); context.getServiceTarget().addService(serviceName, service).setInitialMode(ServiceController.Mode.ACTIVE).install(); } }
static void installCapability(OperationContext context, ModelNode operation) { PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); String factoryName = pathAddress.getLastElement().getValue(); ServiceName serviceName = context.getCapabilityServiceName(HTTP_SERVER_AUTHENTICATION_CAPABILITY, factoryName, HttpServerAuthenticationMechanismFactory.class); KeycloakHttpAuthenticationFactoryService service = new KeycloakHttpAuthenticationFactoryService(factoryName); ServiceTarget serviceTarget = context.getServiceTarget(); serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.ACTIVE).install(); } }
static void installCapability(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); String factoryName = pathAddress.getLastElement().getValue(); ServiceName serviceName = context.getCapabilityServiceName(HTTP_SERVER_AUTHENTICATION_CAPABILITY, factoryName, HttpServerAuthenticationMechanismFactory.class); boolean publicClient = SecureServerDefinition.PUBLIC_CLIENT.resolveModelAttribute(context, operation).asBoolean(false); if (!publicClient) { throw new OperationFailedException("Only public clients are allowed to have their configuration exposed through the management interface"); } KeycloakHttpAuthenticationFactoryService service = new KeycloakHttpAuthenticationFactoryService(factoryName); ServiceTarget serviceTarget = context.getServiceTarget(); InjectedValue<ExtensibleHttpManagement> injectedValue = new InjectedValue<>(); serviceTarget.addService(serviceName.append("http-management-context"), createHttpManagementConfigContextService(factoryName, injectedValue)) .addDependency(context.getCapabilityServiceName(HTTP_MANAGEMENT_HTTP_EXTENSIBLE_CAPABILITY, ExtensibleHttpManagement.class), ExtensibleHttpManagement.class, injectedValue).setInitialMode(Mode.ACTIVE).install(); serviceTarget.addService(serviceName, service).setInitialMode(Mode.ACTIVE).install(); } }