• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ServerConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.wso2.carbon.base.ServerConfiguration的典型用法代码示例。如果您正苦于以下问题:Java ServerConfiguration类的具体用法?Java ServerConfiguration怎么用?Java ServerConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ServerConfiguration类属于org.wso2.carbon.base包,在下文中一共展示了ServerConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPrivateKey

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
public Key getPrivateKey(String alias, boolean isSuperTenant) throws SecurityConfigException {
    KeyStoreData[] keystores = getKeyStores(isSuperTenant);
    KeyStore keyStore = null;
    String privateKeyPassowrd = null;

    try {

        for (int i = 0; i < keystores.length; i++) {
            if (KeyStoreUtil.isPrimaryStore(keystores[i].getKeyStoreName())) {
                KeyStoreManager keyMan = KeyStoreManager.getInstance(tenantId);
                keyStore = keyMan.getPrimaryKeyStore();
                ServerConfiguration serverConfig = ServerConfiguration.getInstance();
                privateKeyPassowrd = serverConfig
                        .getFirstProperty(RegistryResources.SecurityManagement.SERVER_PRIVATE_KEY_PASSWORD);
                return keyStore.getKey(alias, privateKeyPassowrd.toCharArray());
            }
        }
    } catch (Exception e) {
        String msg = "Error has encounted while loading the key for the given alias " + alias;
        log.error(msg, e);
        throw new SecurityConfigException(msg);
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:KeyStoreAdmin.java


示例2: activate

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
@Activate
protected void activate(ComponentContext context) {
    BundleContext bundleContext = context.getBundleContext();
    WorkflowManagementService workflowService = new WorkflowManagementServiceImpl();
    bundleContext.registerService(WorkflowManagementService.class, workflowService, null);
    WorkflowServiceDataHolder.getInstance().setWorkflowService(workflowService);
    WorkflowServiceDataHolder.getInstance().setBundleContext(bundleContext);
    ServiceRegistration serviceRegistration = context.getBundleContext().registerService(WorkflowListener.class.getName(), new WorkflowAuditLogger(), null);
    context.getBundleContext().registerService(WorkflowExecutorManagerListener.class.getName(), new WorkflowExecutorAuditLogger(), null);
    if (serviceRegistration != null) {
        if (log.isDebugEnabled()) {
            log.debug("WorkflowAuditLogger registered.");
        }
    } else {
        log.error("Workflow Audit Logger could not be registered.");
    }
    if (System.getProperty(WFConstant.KEYSTORE_SYSTEM_PROPERTY_ID) == null) {
        System.setProperty(WFConstant.KEYSTORE_SYSTEM_PROPERTY_ID, ServerConfiguration.getInstance().getFirstProperty(WFConstant.KEYSTORE_CARBON_CONFIG_PATH));
    }
    if (System.getProperty(WFConstant.KEYSTORE_PASSWORD_SYSTEM_PROPERTY_ID) == null) {
        System.setProperty(WFConstant.KEYSTORE_PASSWORD_SYSTEM_PROPERTY_ID, ServerConfiguration.getInstance().getFirstProperty(WFConstant.KEYSTORE_PASSWORD_CARBON_CONFIG_PATH));
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:24,代码来源:WorkflowMgtServiceComponent.java


示例3: getTrustedSSLSocketFactory

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
private static SSLSocketFactory getTrustedSSLSocketFactory() {
    try {
        String keyStorePassword = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Password");
        String keyStoreLocation = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Location");
        String trustStorePassword = ServerConfiguration.getInstance().getFirstProperty(
                "Security.TrustStore.Password");
        String trustStoreLocation = ServerConfiguration.getInstance().getFirstProperty(
                "Security.TrustStore.Location");
        KeyStore keyStore = loadKeyStore(keyStoreLocation,keyStorePassword,KEY_STORE_TYPE);
        KeyStore trustStore = loadTrustStore(trustStoreLocation,trustStorePassword);

        return initSSLConnection(keyStore,keyStorePassword,trustStore);
    } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException
            |CertificateException | IOException | UnrecoverableKeyException e) {
        log.error("Error while creating the SSL socket factory due to "+e.getMessage(),e);
        return null;
    }

}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:20,代码来源:Utils.java


示例4: SignKeyDataHolder

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
public SignKeyDataHolder() throws Exception {
    try {
        String keyAlias = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.KeyAlias");
        KeyStoreManager keyMan = KeyStoreManager.getInstance(MultitenantConstants.SUPER_TENANT_ID);
        Certificate[] certificates = keyMan.getPrimaryKeyStore().getCertificateChain(keyAlias);
        issuerPK = keyMan.getDefaultPrivateKey();
        issuerCerts = new X509Certificate[certificates.length];
        int i = 0;
        for (Certificate certificate : certificates) {
            issuerCerts[i++] = (X509Certificate) certificate;
        }
        signatureAlgorithm = XMLSignature.ALGO_ID_SIGNATURE_RSA;
        String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
        if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
            signatureAlgorithm = XMLSignature.ALGO_ID_SIGNATURE_DSA;
        }

    } catch (Exception e) {
        throw new Exception("Error while reading the key", e);
    }

}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:23,代码来源:SignKeyDataHolder.java


示例5: activate

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
protected void activate(ComponentContext ctxt) {
    try {
        ConfigurationContext mainConfigCtx = configContextService.getServerConfigContext();
        AxisConfiguration mainAxisConfig = mainConfigCtx.getAxisConfiguration();
        BundleContext bundleCtx = ctxt.getBundleContext();
        String enablePoxSecurity = ServerConfiguration.getInstance()
                .getFirstProperty("EnablePoxSecurity");
        if (enablePoxSecurity == null || "true".equals(enablePoxSecurity)) {
            mainAxisConfig.engageModule(POX_SECURITY_MODULE);
        } else {
            log.info("POX Security Disabled");
        }

        bundleCtx.registerService(SecurityConfigAdmin.class.getName(),
                new SecurityConfigAdmin(mainAxisConfig,
                        registryService.getConfigSystemRegistry(),
                        null),
                null);
        bundleCtx.registerService(Axis2ConfigurationContextObserver.class.getName(),
                new SecurityAxis2ConfigurationContextObserver(),
                null);
        log.debug("Security Mgt bundle is activated");
    } catch (Throwable e) {
        log.error("Failed to activate SecurityMgtServiceComponent", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:27,代码来源:SecurityMgtServiceComponent.java


示例6: IdentityApplicationManagementServiceClient

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
public IdentityApplicationManagementServiceClient(String epr) throws AxisFault {

        XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
        int autosclaerSocketTimeout = conf.getInt("autoscaler.identity.clientTimeout", 180000);
        try {
            ServerConfiguration serverConfig = CarbonUtils.getServerConfiguration();
            String trustStorePath = serverConfig.getFirstProperty("Security.TrustStore.Location");
            String trustStorePassword = serverConfig.getFirstProperty("Security.TrustStore.Password");
            String type = serverConfig.getFirstProperty("Security.TrustStore.Type");

            System.setProperty("javax.net.ssl.trustStore", trustStorePath);
            System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
            System.setProperty("javax.net.ssl.trustStoreType", type);

            stub = new IdentityApplicationManagementServiceStub(epr);
            stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, autosclaerSocketTimeout);
            stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, autosclaerSocketTimeout);
	        String username = conf.getString("autoscaler.identity.adminUser", "admin");
            Utility.setAuthHeaders(stub._getServiceClient(), username);

        } catch (AxisFault axisFault) {
            String msg = "Failed to initiate identity service client. " + axisFault.getMessage();
            log.error(msg, axisFault);
            throw new AxisFault(msg, axisFault);
        }
    }
 
开发者ID:apache,项目名称:stratos,代码行数:27,代码来源:IdentityApplicationManagementServiceClient.java


示例7: createDefaultJSch

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
@Override
protected JSch createDefaultJSch(FS fs) throws JSchException {

    JSch def = super.createDefaultJSch(fs);
    String keyName = ServerConfiguration.getInstance().
            getFirstProperty(GitDeploymentSynchronizerConstants.SSH_PRIVATE_KEY_NAME);
    String keyPath = ServerConfiguration.getInstance().
            getFirstProperty(GitDeploymentSynchronizerConstants.SSH_PRIVATE_KEY_PATH);

    if (keyName == null || keyName.isEmpty())
        keyName = GitDeploymentSynchronizerConstants.SSH_KEY;

    if (keyPath == null || keyPath.isEmpty())
        keyPath = System.getProperty("user.home") + "/" + GitDeploymentSynchronizerConstants.SSH_KEY_DIRECTORY;

    if (keyPath.endsWith("/"))
        def.addIdentity(keyPath + keyName);
    else
        def.addIdentity(keyPath + "/" + keyName);

    return def;
}
 
开发者ID:apache,项目名称:stratos,代码行数:23,代码来源:CustomJschConfigSessionFactory.java


示例8: doPaging

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
/**
 * This method is used internally to do the pagination purposes.
 *
 * @param pageNumber page Number
 * @param policySet  set of policies
 * @return PaginatedPolicySetDTO object containing the number of pages and the set of policies
 * that reside in the given page.
 */
private PaginatedPolicySetDTO doPaging(int pageNumber, PolicyDTO[] policySet) {

    PaginatedPolicySetDTO paginatedPolicySet = new PaginatedPolicySetDTO();
    if (policySet.length == 0) {
        paginatedPolicySet.setPolicySet(new PolicyDTO[0]);
        return paginatedPolicySet;
    }
    String itemsPerPage = EntitlementServiceComponent.getEntitlementConfig().
            getEngineProperties().getProperty(PDPConstants.ENTITLEMENT_ITEMS_PER_PAGE);
    if (itemsPerPage != null) {
        itemsPerPage = ServerConfiguration.getInstance().getFirstProperty("ItemsPerPage");
    }
    int itemsPerPageInt = PDPConstants.DEFAULT_ITEMS_PER_PAGE;
    if (itemsPerPage != null) {
        itemsPerPageInt = Integer.parseInt(itemsPerPage);
    }
    int numberOfPages = (int) Math.ceil((double) policySet.length / itemsPerPageInt);
    if (pageNumber > numberOfPages - 1) {
        pageNumber = numberOfPages - 1;
    }
    int startIndex = pageNumber * itemsPerPageInt;
    int endIndex = (pageNumber + 1) * itemsPerPageInt;
    PolicyDTO[] returnedPolicySet = new PolicyDTO[itemsPerPageInt];

    for (int i = startIndex, j = 0; i < endIndex && i < policySet.length; i++, j++) {
        returnedPolicySet[j] = policySet[i];
    }

    paginatedPolicySet.setPolicySet(returnedPolicySet);
    paginatedPolicySet.setNumberOfPages(numberOfPages);

    return paginatedPolicySet;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:42,代码来源:EntitlementPolicyAdminService.java


示例9: doPagingString

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
/**
 * This method is used internally to do the pagination purposes.
 *
 * @param pageNumber page Number
 * @param ids        <code>String</code>
 * @return PaginatedStringDTO object containing the number of pages and the set of policies
 * that reside in the given page.
 */
private PaginatedStringDTO doPagingString(int pageNumber, String[] ids) {

    PaginatedStringDTO paginatedStatusHolder = new PaginatedStringDTO();
    if (ids.length == 0) {
        paginatedStatusHolder.setStatusHolders(new String[0]);
        return paginatedStatusHolder;
    }

    String itemsPerPage = EntitlementServiceComponent.getEntitlementConfig().
            getEngineProperties().getProperty(PDPConstants.ENTITLEMENT_ITEMS_PER_PAGE);
    if (itemsPerPage != null) {
        itemsPerPage = ServerConfiguration.getInstance().getFirstProperty("ItemsPerPage");
    }
    int itemsPerPageInt = PDPConstants.DEFAULT_ITEMS_PER_PAGE;
    if (itemsPerPage != null) {
        itemsPerPageInt = Integer.parseInt(itemsPerPage);
    }
    int numberOfPages = (int) Math.ceil((double) ids.length / itemsPerPageInt);
    if (pageNumber > numberOfPages - 1) {
        pageNumber = numberOfPages - 1;
    }
    int startIndex = pageNumber * itemsPerPageInt;
    int endIndex = (pageNumber + 1) * itemsPerPageInt;
    String[] returnedHolders = new String[itemsPerPageInt];

    for (int i = startIndex, j = 0; i < endIndex && i < ids.length; i++, j++) {
        returnedHolders[j] = ids[i];
    }

    paginatedStatusHolder.setStatusHolders(returnedHolders);
    paginatedStatusHolder.setNumberOfPages(numberOfPages);

    return paginatedStatusHolder;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:43,代码来源:EntitlementPolicyAdminService.java


示例10: getPrivateStore

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
/**
 * Get the private key store
 *
 * If the key store is defined in the Security configuration take it from there otherwise
 * key store is taken from the Server Configuration
 *
 * @return private key store
 */
public String getPrivateStore() {

    if (privateStore == null) {
        ServerConfiguration serverConfig = ServerConfiguration.getInstance();
        String pvtStore = serverConfig.getFirstProperty("Security.KeyStore.Location");
        return pvtStore.substring(pvtStore.lastIndexOf("/") + 1);
    }
    return privateStore;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:18,代码来源:SecurityConfigParams.java


示例11: activate

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
@Activate
protected void activate(ComponentContext ctxt) {
    try {
        ConfigurationContext mainConfigCtx = configContextService.getServerConfigContext();
        AxisConfiguration mainAxisConfig = mainConfigCtx.getAxisConfiguration();
        BundleContext bundleCtx = ctxt.getBundleContext();
        String enablePoxSecurity = ServerConfiguration.getInstance()
                .getFirstProperty("EnablePoxSecurity");
        if (enablePoxSecurity == null || "true".equals(enablePoxSecurity)) {
            mainAxisConfig.engageModule(POX_SECURITY_MODULE);
        } else {
            log.info("POX Security Disabled");
        }

        bundleCtx.registerService(SecurityConfigAdmin.class.getName(),
                new SecurityConfigAdmin(mainAxisConfig,
                        registryService.getConfigSystemRegistry(),
                        null),
                null);
        bundleCtx.registerService(Axis2ConfigurationContextObserver.class.getName(),
                new SecurityAxis2ConfigurationContextObserver(),
                null);
        log.debug("Security Mgt bundle is activated");
    } catch (Throwable e) {
        log.error("Failed to activate SecurityMgtServiceComponent", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:SecurityMgtServiceComponent.java


示例12: setAuthHeaders

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
private void setAuthHeaders(MessageContext msgCtx) throws IOException {
    String serverName = ServerConfiguration.getInstance().getFirstProperty("Name");

    if (serverName == null || serverName.trim().length() == 0) {
        serverName = "WSO2 Carbon";
    }

    HttpServletResponse response = (HttpServletResponse)
            msgCtx.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
    // TODO : verify this fix. This is to handle soap fault from UT scenario
    if (msgCtx.isFault() && response == null) {
        MessageContext originalContext = (MessageContext) msgCtx.getProperty(MessageContext.IN_MESSAGE_CONTEXT);
        if (originalContext != null) {
            response = (HttpServletResponse)
                    originalContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
        }
    }
    if (response != null) {
        if (msgCtx.getProperty(MESSAGE_TYPE) != null) {
            response.setContentType(String.valueOf(msgCtx.getProperty(MESSAGE_TYPE)));
        }
        response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
        response.addHeader("WWW-Authenticate",
                "BASIC realm=\"" + serverName + "\"");
        response.flushBuffer();
    } else {
        // if not servlet transport assume it to be nhttp transport
        msgCtx.setProperty("NIO-ACK-Requested", "true");
        msgCtx.setProperty("HTTP_SC", HttpServletResponse.SC_UNAUTHORIZED);
        Map<String, String> responseHeaders = new HashMap<>();
        responseHeaders.put("WWW-Authenticate",
                "BASIC realm=\"" + serverName + "\"");
        msgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, responseHeaders);
    }

}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:37,代码来源:POXSecurityHandler.java


示例13: getDefaultRampartConfig

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
public static Policy getDefaultRampartConfig() {

        //Extract the primary keystore information from server configuration
        ServerConfiguration serverConfig = ServerConfiguration.getInstance();
        String keyStore = serverConfig.getFirstProperty("Security.KeyStore.Location");
        String keyStoreType = serverConfig.getFirstProperty("Security.KeyStore.Type");
        String keyStorePassword = serverConfig.getFirstProperty("Security.KeyStore.Password");
        String privateKeyAlias = serverConfig.getFirstProperty("Security.KeyStore.KeyAlias");
        String privateKeyPassword = serverConfig.getFirstProperty("Security.KeyStore.KeyPassword");

        //Populate Rampart Configuration
        RampartConfig rampartConfig = new RampartConfig();
        rampartConfig.setUser(privateKeyAlias);
        //TODO use a registry based callback handler
        rampartConfig.setPwCbClass("org.wso2.carbon.identity.base.InMemoryPasswordCallbackHandler");

        //Set the private key alias and private key password in the password callback handler
        InMemoryPasswordCallbackHandler.addUser(privateKeyAlias, privateKeyPassword);

        CryptoConfig sigCrypto = new CryptoConfig();
        Properties props = new Properties();
        sigCrypto.setProvider("org.apache.ws.security.components.crypto.Merlin");
        props.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", keyStoreType);
        props.setProperty("org.apache.ws.security.crypto.merlin.file", keyStore);
        props.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", keyStorePassword);

        // This property is set in order to fix IDENTITY-1931.
        // This issue is however not found in IS-4.5.0.
        // The reason for the error is unknown. Suspecting JCE provider.
        // Error occurrs when WSS4J tries to read the certificates in the JDK's cacerts store.
        props.setProperty("org.apache.ws.security.crypto.merlin.load.cacerts", "false");
        sigCrypto.setProp(props);

        rampartConfig.setSigCryptoConfig(sigCrypto);
        Policy policy = new Policy();
        policy.addAssertion(rampartConfig);

        return policy;

    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:41,代码来源:IdentityBaseUtil.java


示例14: testGetDefaultRampartConfig

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
@Test
public void testGetDefaultRampartConfig() throws Exception {
    //mock ServerConfiguration
    mockStatic(ServerConfiguration.class);
    when(ServerConfiguration.getInstance()).thenReturn(mockServerConfig);
    when(mockServerConfig.getFirstProperty(anyString())).thenReturn("mockedValue");

    Policy policy = IdentityBaseUtil.getDefaultRampartConfig();
    assertNotNull(policy);
    assertNotNull(policy.getFirstPolicyComponent());
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:12,代码来源:IdentityBaseUtilTest.java


示例15: isValidFileName

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
public static boolean isValidFileName(String fileName) {
    String fileNameRegEx = ServerConfiguration.getInstance().getFirstProperty(IdentityCoreConstants.FILE_NAME_REGEX);

    if (isBlank(fileNameRegEx)) {
        fileNameRegEx = DEFAULT_FILE_NAME_REGEX;
    }

    Pattern pattern = Pattern.compile(fileNameRegEx, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE |
            Pattern.COMMENTS);
    Matcher matcher = pattern.matcher(fileName);
    return matcher.matches();
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:13,代码来源:IdentityUtil.java


示例16: getHostName

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
/**
 * Get the host name of the server.
 *
 * @return Hostname
 */
public static String getHostName() {

    String hostName = ServerConfiguration.getInstance().getFirstProperty(IdentityCoreConstants.HOST_NAME);
    if (hostName == null) {
        try {
            hostName = NetworkUtils.getLocalHostname();
        } catch (SocketException e) {
            throw IdentityRuntimeException.error("Error while trying to read hostname.", e);
        }
    }
    return hostName;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:18,代码来源:IdentityUtil.java


示例17: setUp

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
    mockStatic(CarbonUtils.class);
    mockStatic(ServerConfiguration.class);
    mockStatic(NetworkUtils.class);
    mockStatic(IdentityCoreServiceComponent.class);
    mockStatic(IdentityConfigParser.class);
    mockStatic(CarbonUtils.class);
    mockStatic(IdentityTenantUtil.class);

    when(ServerConfiguration.getInstance()).thenReturn(mockServerConfiguration);
    when(IdentityCoreServiceComponent.getConfigurationContextService()).thenReturn(mockConfigurationContextService);
    when(mockConfigurationContextService.getServerConfigContext()).thenReturn(mockConfigurationContext);
    when(mockConfigurationContext.getAxisConfiguration()).thenReturn(mockAxisConfiguration);
    when(IdentityTenantUtil.getRealmService()).thenReturn(mockRealmService);
    when(mockRealmService.getTenantManager()).thenReturn(mockTenantManager);
    when(CarbonUtils.getCarbonHome()).thenReturn("carbon.home");
    when(mockRequest.getRemoteAddr()).thenReturn("127.0.0.1");
    when(mockUserStoreManager.getRealmConfiguration()).thenReturn(mockRealmConfiguration);
    when(mockRealmService.getBootstrapRealmConfiguration()).thenReturn(mockRealmConfiguration);
    when(mockUserRealm.getUserStoreManager()).thenReturn(mockUserStoreManager);
    try {
        when(NetworkUtils.getLocalHostname()).thenReturn("localhost");
    } catch (SocketException e) {
        // Mock behaviour, hence ignored
    }

    System.setProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTP_PROPERTY, "9763");
    System.setProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTPS_PROPERTY, "9443");
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:31,代码来源:IdentityUtilTest.java


示例18: init

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
public static void init() {
    //to initialize scim urls once.
    if (scimUserLocation == null || scimGroupLocation == null || scimServiceProviderConfig == null) {
        String portOffSet = ServerConfiguration.getInstance().getFirstProperty("Ports.Offset");
        int httpsPort = 9443 + Integer.parseInt(portOffSet);
        String scimURL = "https://" + ServerConfiguration.getInstance().getFirstProperty("HostName")
                + ":" + String.valueOf(httpsPort) + "/wso2/scim/v2/";
        scimUserLocation = scimURL + SCIMCommonConstants.USERS;
        scimGroupLocation = scimURL + SCIMCommonConstants.GROUPS;
        scimServiceProviderConfig = scimURL + SCIMCommonConstants.SERVICE_PROVIDER_CONFIG;
        scimResourceType = scimURL + SCIMCommonConstants.RESOURCE_TYPE;
    }
}
 
开发者ID:Vindulamj,项目名称:scim-inbound-provisioning-scim2,代码行数:14,代码来源:SCIMCommonUtils.java


示例19: initSSLConnection

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
/**
 * Initializes the SSL Context
 */
private SSLContext initSSLConnection(String tenantAdminUser)
        throws NoSuchAlgorithmException, UnrecoverableKeyException,
               KeyStoreException, KeyManagementException, IOException, CertificateException {
    String keyStorePassword = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Password");
    String trustStorePassword = ServerConfiguration.getInstance().getFirstProperty(
            "Security.TrustStore.Password");
    String keyStoreLocation = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Location");
    String trustStoreLocation = ServerConfiguration.getInstance().getFirstProperty(
            "Security.TrustStore.Location");

    //Call to load the keystore.
    KeyStore keyStore = loadKeyStore(keyStoreLocation, keyStorePassword.toCharArray());
    //Call to load the TrustStore.
    KeyStore trustStore = loadTrustStore(trustStoreLocation, trustStorePassword.toCharArray());

    KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KEY_MANAGER_TYPE);
    keyManagerFactory.init(keyStore, keyStorePassword.toCharArray());
    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TRUST_MANAGER_TYPE);
    trustManagerFactory.init(trustStore);

    // Create and initialize SSLContext for HTTPS communication

    SSLContext sslContext = SSLContext.getInstance(SSLV3);
    sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);
    SSLContext.setDefault(sslContext);
    return sslContext;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:31,代码来源:GeoLocationProviderServiceImpl.java


示例20: getPortOffset

import org.wso2.carbon.base.ServerConfiguration; //导入依赖的package包/类
private static int getPortOffset() {
    ServerConfiguration carbonConfig = ServerConfiguration.getInstance();
    String portOffset = System.getProperty("portOffset", carbonConfig.getFirstProperty(
            DeviceTypeConstants.CARBON_CONFIG_PORT_OFFSET));
    try {
        if ((portOffset != null)) {
            return Integer.parseInt(portOffset.trim());
        } else {
            return DeviceTypeConstants.CARBON_DEFAULT_PORT_OFFSET;
        }
    } catch (NumberFormatException e) {
        return DeviceTypeConstants.CARBON_DEFAULT_PORT_OFFSET;
    }
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:15,代码来源:DeviceTypeUtils.java



注:本文中的org.wso2.carbon.base.ServerConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CmisRuntimeException类代码示例发布时间:2022-05-22
下一篇:
Java MassData类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap