Package org.wso2.carbon.base

Examples of org.wso2.carbon.base.ServerConfiguration


    }

    private static Element decryptElement(Element encryptedToken) throws Exception {

        ServerConfiguration serverConfig = ServerConfiguration.getInstance();
        PrivateKey key = null;
        String keyStoreFile = null;
        String privateKeyPass = null;
        String privateKeyAlias = null;
        String keyStorePass = null;
        String type = null;
        byte[] content = null;

        try {

            keyStoreFile = serverConfig.getFirstProperty("Security.KeyStore.Location");
            keyStorePass = serverConfig.getFirstProperty("Security.KeyStore.Password");
            type = serverConfig.getFirstProperty("Security.KeyStore.Type");
            privateKeyAlias = serverConfig.getFirstProperty("Security.KeyStore.KeyAlias");
            privateKeyPass = serverConfig.getFirstProperty("Security.KeyStore.KeyPassword");
            CryptoUtil.getDefaultCryptoUtil();
           
            content = readBytesFromFile(keyStoreFile);

            KeyStore keyStore = KeyStore.getInstance(type);
View Full Code Here


        KeyStoreAdmin admin = null;
        KeyStoreData[] keystores = null;
        String privateKeyAlias = null;
        String keyStoreName = null;
        String issuerName = null;
        ServerConfiguration serverConfig = null;

        systemRegistry = IdentityPassiveSTSServiceComponent.getRegistry();

        if (systemRegistry == null || service == null) {
            if (log.isDebugEnabled()) {
                log.debug("systemRegistry not set or STS service is unavialable");
            }
            return null;
        }

        serverConfig = ServerConfiguration.getInstance();
        keyAlias = serverConfig.getFirstProperty("Security.KeyStore.KeyAlias");
        keyPassword = serverConfig.getFirstProperty("Security.KeyStore.KeyPassword");
        issuerName = serverConfig.getFirstProperty("HostName");

        if (issuerName == null) {
            // HostName not set :-( use wso2wsas-sts
            issuerName = "Identity-passive-sts";
        }
View Full Code Here

    }

    private void initPersistence(SynapseConfigurationService synCfgSvc, String configName)
            throws RegistryException, AxisFault {
        // Initialize the mediation persistence manager if required
        ServerConfiguration serverConf = ServerConfiguration.getInstance();
        String persistence = serverConf.getFirstProperty(ServiceBusConstants.PERSISTENCE);

        // Check whether persistence is disabled
        if (!ServiceBusConstants.DISABLED.equals(persistence)) {
            // Check registry persistence is disabled or not
            String regPersistence = serverConf.getFirstProperty(
                    ServiceBusConstants.REGISTRY_PERSISTENCE);
            UserRegistry registry = ServiceBusConstants.DISABLED.equals(regPersistence) ?
                    null : registryService.getConfigSystemRegistry();

            // Check the worker interval is set or not
            String interval = serverConf.getFirstProperty(ServiceBusConstants.WORKER_INTERVAL);
            long intervalInMillis = 5000L;
            if (interval != null && !"".equals(interval)) {
                try {
                    intervalInMillis = Long.parseLong(interval);
                } catch (NumberFormatException e) {
View Full Code Here

        }
    }

    private void setHttpsProtForConsole() {

        ServerConfiguration config = ServerConfiguration.getInstance();

        try {
            // Try to get the port information from the Carbon TransportManager
            // -- Standalone Mode --
            final String TRANSPORT_MANAGER
                    = "org.wso2.carbon.server.transports.TransportManager";
            Class transportManagerClass = Class.forName(TRANSPORT_MANAGER);
            Object transportManager = transportManagerClass.newInstance();
            Method method = transportManagerClass.getMethod("getPort", String.class);
            int httpsPort = (Integer) method.invoke(transportManager, "https");
            int httpPort = (Integer) method.invoke(transportManager, "http");

            // required to properly log the management console URL
            System.setProperty("carbon.https.port", Integer.toString(httpsPort));
            System.setProperty("carbon.http.port", Integer.toString(httpPort));

            System.setProperty("httpPort", Integer.toString(httpPort));
            System.setProperty("httpsPort", Integer.toString(httpsPort));
            // this is required for the dashboard to work
            config.setConfigurationProperty("RegistryHttpPort", Integer.toString(httpPort));

        } catch (ClassNotFoundException e) {
            // Try to get the port information from the carbon.xml
            // -- Webapp Deployment Mode --
            if (log.isDebugEnabled()) {
                log.debug("TransportManager implementation not found. Switching to " +
                        "webapp deployment mode. Reading HTTPS port from the carbon.xml.");
            }

            String serverURL = config.getFirstProperty("ServerURL");
            if (serverURL != null) {
                try {
                    URL url = new URL(serverURL);
                    if ("https".equals(url.getProtocol())) {
                        System.setProperty("carbon.https.port", String.valueOf(url.getPort()));
View Full Code Here

    private void initPersistence(String configName,
                                 ConfigurationContext configurationContext,
                                 ServerContextInformation contextInfo)
            throws RegistryException, AxisFault {
        // Initialize the mediation persistence manager if required
        ServerConfiguration serverConf = ServerConfiguration.getInstance();
        String persistence = serverConf.getFirstProperty(ServiceBusConstants.PERSISTENCE);
        org.wso2.carbon.registry.core.Registry configRegistry =
                (org.wso2.carbon.registry.core.Registry) SuperTenantCarbonContext
                        .getCurrentContext(configurationContext).
                                getRegistry(RegistryType.SYSTEM_CONFIGURATION);

        // Check whether persistence is disabled
        if (!ServiceBusConstants.DISABLED.equals(persistence)) {


            // Check registry persistence is disabled or not
            String regPersistence = serverConf.getFirstProperty(
                    ServiceBusConstants.REGISTRY_PERSISTENCE);
            UserRegistry registry = ServiceBusConstants.DISABLED.equals(regPersistence) ?
                    null : (UserRegistry) configRegistry;

            // Check the worker interval is set or not
            String interval = serverConf.getFirstProperty(ServiceBusConstants.WORKER_INTERVAL);
            long intervalInMillis = 5000L;
            if (interval != null && !"".equals(interval)) {
                try {
                    intervalInMillis = Long.parseLong(interval);
                } catch (NumberFormatException e) {
View Full Code Here

        keyStoreData = keyAdmin.getKeystoreInfo(privateStore.getKeyStoreName());
        cert = getCertificate(privateStore.getKeyStoreName(), keyStoreData.getKey()
            .getAlias());
      } else {
        // this is for UT token policy
        ServerConfiguration config = ServerConfiguration.getInstance();
        String keyalias = config.getFirstProperty("Security.KeyStore.KeyAlias");
        KeyStore store = keyMan.getPrimaryKeyStore();
        cert = (X509Certificate) store.getCertificate(keyalias);
      }

    } catch (Exception e) {
View Full Code Here

    private static Registry getRegistryForAnonymousSession(String domainName, String username)
            throws IdentityException {
        try {
            if (domainName == null && username == null) {
                ServerConfiguration serverConfig = ServerConfiguration.getInstance();
                domainName = null;
            }
            if (username == null) {
                return AnonymousSessionUtil.getSystemRegistryByDomainName(registryService,
                        realmService, domainName);
View Full Code Here

    private static UserRealm getRealmForAnonymousSession(String domainName, String username)
            throws IdentityException {
        try {
            if (domainName == null && username == null) {
                ServerConfiguration serverConfig = ServerConfiguration.getInstance();
                domainName = null;
            }

            if (username == null) {
                return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService,
View Full Code Here

        }
        return alias;
    }

    public static String getKeyStoreFileName(String fullName) {
        ServerConfiguration config = ServerConfiguration.getInstance();
        String fileName = config
                .getFirstProperty(RegistryResources.SecurityManagement.SERVER_PRIMARY_KEYSTORE_FILE);
        String name = null;
        int index = fileName.lastIndexOf("/");
        if (index != -1) {
            name = fileName.substring(index + 1);
View Full Code Here

        }
        return name;
    }

    public static boolean isPrimaryStore(String id) {
        ServerConfiguration config = ServerConfiguration.getInstance();
        String fileName = config
                .getFirstProperty(RegistryResources.SecurityManagement.SERVER_PRIMARY_KEYSTORE_FILE);
        int index = fileName.lastIndexOf("/");
        if (index != -1) {
            String name = fileName.substring(index + 1);
            if (name.equals(id)) {
View Full Code Here

TOP

Related Classes of org.wso2.carbon.base.ServerConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.