/** * Initializes this service */ public XOWLWebModuleDirectory() { this.apiUri = PlatformHttp.getUriPrefixApi() + "/services/webapp"; }
/** * Initializes this provider */ public KernelStatisticsService() { this.apiUri = PlatformHttp.getUriPrefixApi() + "/kernel/statistics"; }
/** * Initializes this service */ public XOWLConsistencyService() { this.apiUri = PlatformHttp.getUriPrefixApi() + "/services/consistency"; }
/** * Initializes this service */ public XOWLCollaborationService() { super(); this.apiUri = PlatformHttp.getUriPrefixApi() + "/services/collaboration"; }
/** * Initializes this service */ public KernelHttpApiDiscoveryService() { this.apiUri = PlatformHttp.getUriPrefixApi() + "/kernel/discovery"; }
/** * Initializes this service */ public KernelBusinessDirectoryService() { this.apiUri = PlatformHttp.getUriPrefixApi() + "/kernel/business"; }
/** * Initializes this service */ public XOWLImpactAnalysisService() { this.apiUri = PlatformHttp.getUriPrefixApi() + "/services/impact"; }
/** * Initializes this service */ public XOWLConnectionService() { this.apiUri = PlatformHttp.getUriPrefixApi() + "/services/connection"; this.connectorsById = new HashMap<>(); }
/** * Initializes this service */ public KernelLoggingService() { super(new FileLogger(new File(System.getenv(Env.ROOT), "platform.log")), new ConsoleLogger()); this.apiUri = PlatformHttp.getUriPrefixApi() + "/kernel/log"; this.buffer = new PlatformLogBuffer(BUFFER_SIZE); this.errorsCount = new AtomicInteger(0); this.totalMessages = new AtomicInteger(0); }
if (request.getRequestURI().equals(PlatformHttp.getUriPrefixApi() + SecurityService.URI_LOGIN)) return true;
/** * Initializes this service * * @param configurationService The current configuration service * @param executionService The current execution service */ public KernelPlatformManagementService(ConfigurationService configurationService, JobExecutionService executionService) { Configuration configuration = configurationService.getConfigFor(PlatformManagementService.class.getCanonicalName()); this.apiUri = PlatformHttp.getUriPrefixApi() + "/kernel/platform"; this.bundles = new ArrayList<>(); this.product = loadProductDescriptor(); this.addons = new ArrayList<>(); this.addonsCache = new File(System.getenv(Env.ROOT), configuration.get("addonsStorage")); if (this.addonsCache.exists()) loadAddonsCache(); enforceHttpConfigFelix(PlatformHttp.instance(), executionService); }
/** * Initializes this service * * @param configurationService The configuration service */ public KernelSecurityService(ConfigurationService configurationService) { Configuration configuration = configurationService.getConfigFor(SecurityService.class.getCanonicalName()); this.apiUri = PlatformHttp.getUriPrefixApi() + "/kernel/security"; this.maxLoginFailure = Integer.parseInt(configuration.get("maxLoginFailure")); this.banLength = Integer.parseInt(configuration.get("banLength")); this.realmConfiguration = configuration.getSection("realm"); this.policyConfiguration = configuration.getSection("policy"); Mac mac = null; KeyGenerator keyGenerator = null; try { mac = Mac.getInstance("HmacSHA256"); keyGenerator = KeyGenerator.getInstance("HmacSHA256"); keyGenerator.init(256); } catch (NoSuchAlgorithmException exception) { // should not happen Logging.get().error(exception); } this.securityMAC = mac; this.securityKey = keyGenerator.generateKey(); this.securityTokenTTL = Integer.parseInt(configuration.get("tokenTTL")); this.clients = new HashMap<>(); }
int poolMin = EXECUTOR_POOL_MIN; int poolMax = EXECUTOR_POOL_MAX; this.apiUri = PlatformHttp.getUriPrefixApi() + "/kernel/jobs"; this.storage = new File(System.getenv(Env.ROOT), configuration.get("storage")); try {
/** * Responds to a request for the logout resource * * @param request The web API request to handle * @return The HTTP response */ private HttpResponse handleRequestLogout(HttpApiRequest request) { if (!HttpConstants.METHOD_POST.equals(request.getMethod())) return new HttpResponse(HttpURLConnection.HTTP_BAD_METHOD, HttpConstants.MIME_TEXT_PLAIN, "Expected POST method"); XSPReply reply = logout(); if (!reply.isSuccess()) return XSPReplyUtils.toHttpResponse(reply, null); HttpResponse response = new HttpResponse(HttpURLConnection.HTTP_OK); response.addHeader(HttpConstants.HEADER_SET_COOKIE, AUTH_TOKEN + "= " + "; Max-Age=0" + "; Path=" + PlatformHttp.getUriPrefixApi() + "; Secure" + "; HttpOnly"); return response; }
/** * Responds to a request for the login resource * * @param request The web API request to handle * @return The HTTP response */ private HttpResponse handleRequestLogin(HttpApiRequest request) { if (!HttpConstants.METHOD_POST.equals(request.getMethod())) return new HttpResponse(HttpURLConnection.HTTP_BAD_METHOD, HttpConstants.MIME_TEXT_PLAIN, "Expected POST method"); String login = request.getParameter("login"); if (login == null) return XSPReplyUtils.toHttpResponse(new XSPReplyApiError(ERROR_EXPECTED_QUERY_PARAMETERS, "'login'"), null); String password = new String(request.getContent(), IOUtils.CHARSET); XSPReply reply = login(request.getClient(), login, password); if (!reply.isSuccess()) return XSPReplyUtils.toHttpResponse(reply, null); String token = ((XSPReplyResult<String>) reply).getData(); HttpResponse response = new HttpResponse(HttpURLConnection.HTTP_OK, HttpConstants.MIME_JSON, getCurrentUser().serializedJSON()); response.addHeader(HttpConstants.HEADER_SET_COOKIE, AUTH_TOKEN + "=" + token + "; Max-Age=" + Long.toString(securityTokenTTL) + "; Path=" + PlatformHttp.getUriPrefixApi() + "; Secure" + "; HttpOnly"); return response; }