Package org.wso2.carbon.base

Examples of org.wso2.carbon.base.ServerConfiguration


                OMElement samlConfigElem = origParam.getParameterElement().getFirstChildWithName(
                        SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG);
                SAMLTokenIssuerConfig samlConfig = new SAMLTokenIssuerConfig(samlConfigElem);
                samlConfig.setCallbackHandlerName(AttributeCallbackHandler.class.getName());

                ServerConfiguration serverConfig = ServerConfiguration.getInstance();
                String ttl = serverConfig.getFirstProperty("STSTimeToLive");

                if (ttl != null && ttl.length() > 0) {
                    try {
                        samlConfig.setTtl(Long.parseLong(ttl));
                        if (log.isDebugEnabled()) {
View Full Code Here


            throws IdentityProviderException {
        AxisConfiguration axisConfig = IdentitySTSMgtServiceComponent.getConfigurationContext()
                .getAxisConfiguration();

        try {
            ServerConfiguration serverConfig = ServerConfiguration.getInstance();
            String ksName = serverConfig.getFirstProperty("Security.KeyStore.Location");
            ksName = ksName.substring(ksName.lastIndexOf("/") + 1);

            SecurityConfigAdmin admin = new SecurityConfigAdmin(config, registry,
                    new IPPasswordCallbackHandler());
            if (log.isDebugEnabled()) {
View Full Code Here

        assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
        Conditions conditions = (Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME);
        conditions.setNotBefore(notBefore);
        conditions.setNotOnOrAfter(notAfter);

        ServerConfiguration config = ServerConfiguration.getInstance();
        String host = "http://" + config.getFirstProperty("HostName");

        Issuer issuer = (Issuer) buildXMLObject(Issuer.DEFAULT_ELEMENT_NAME);
        issuer.setValue(host);
        assertion.setIssuer(issuer);
        assertion.setIssueInstant(new DateTime());
View Full Code Here

    }

    private Element issueCard(UserCredential credential, boolean requireAppliesTo,
            String globalUserName, String tenantAwareUserName) throws IdentityProviderException {
        FileInputStream is = null;
        ServerConfiguration serverConfig = ServerConfiguration.getInstance();
        try {
            String storeFilePath = serverConfig.getFirstProperty("Security.KeyStore.Location");
            is = new FileInputStream(storeFilePath);

            KeyStore store = KeyStore.getInstance(serverConfig
                    .getFirstProperty("Security.KeyStore.Type"));
            String passwd = serverConfig.getFirstProperty("Security.KeyStore.Password");
            store.load(is, passwd.toCharArray());

            Generator gen = new Generator();

            gen.setSignatureAlgorithm(issuerConfig.getSigAlgo());
            String alias = serverConfig.getFirstProperty("Security.KeyStore.KeyAlias");
            Certificate[] certs = store.getCertificateChain(alias);
            gen.setCertChain(certs);
            gen.setPrivateKey((PrivateKey) store.getKey(alias, serverConfig.getFirstProperty(
                    "Security.KeyStore.KeyPassword").toCharArray()));

            Identity id = new Identity();
            id.setCertificate((X509Certificate) store.getCertificate(alias));
View Full Code Here

        HttpServletRequest request = null;
        CardImage img = new CardImage("image/jpeg", Base64.encode(imgBytes));
        card.setCardImage(img);
        request = (HttpServletRequest) MessageContext.getCurrentMessageContext().getProperty(
                HTTPConstants.MC_HTTP_SERVLETREQUEST);
        ServerConfiguration config = ServerConfiguration.getInstance();
        String serverUrl = getServerURL(config.getFirstProperty(CarbonConstants.SERVER_URL),
                request.getContextPath());

        EndpointReference stsEpr = null;
        Metadata mexEpr = null;
View Full Code Here

  }

  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;

    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");

    content = readBytesFromFile(keyStoreFile);

    KeyStore keyStore = KeyStore.getInstance(type);
    keyStore.load(new ByteArrayInputStream(content), keyStorePass.toCharArray());
View Full Code Here

  }

  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;

    CryptoUtil.getDefaultCryptoUtil();
    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");

    content = readBytesFromFile(keyStoreFile);

    KeyStore keyStore = KeyStore.getInstance(type);
    keyStore.load(new ByteArrayInputStream(content), keyStorePass.toCharArray());
View Full Code Here

  }

  public void init() throws IdentityProviderException, NumberFormatException, IdentityException, CarbonException {
    IdentityPersistenceManager admin = IdentityPersistenceManager.getPersistanceManager();

    ServerConfiguration serverConf = ServerConfiguration.getInstance();
    String hostName = serverConf.getFirstProperty("HostName");

    if (hostName == null) {
      hostName = "localhost";
    }
View Full Code Here

        Properties props = new Properties();

        UserRegistry govRegistry = SecurityServiceHolder.getRegistryService().
                getGovernanceSystemRegistry(((UserRegistry)registry).getTenantId());

        ServerConfiguration config = ServerConfiguration.getInstance();

        if (trustedCertStores != null) {
            StringBuffer trstString = new StringBuffer();
            for (int i = 0; i < trustedCertStores.length; i++) {
                trstString.append(trustedCertStores[i]).append(",");
View Full Code Here

                if (temp.startsWith("//")) {
                    temp = temp.substring(1);
                }
                if (temp.equals(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
                        RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)) {
                    ServerConfiguration config = ServerConfiguration.getInstance();
                    String file = new File(config.getFirstProperty(RegistryResources
                            .SecurityManagement.SERVER_PRIMARY_KEYSTORE_FILE)).getAbsolutePath();
                    String name = KeyStoreUtil.getKeyStoreFileName(file);
                    data.setPrivateStore(name);
                } else {
                    temp = temp.substring(temp.lastIndexOf("/") + 1);
                    data.setPrivateStore(temp);
                }
            }

            Association[] tstedStores = registry.getAssociations(servicePath,
                    SecurityConstants.ASSOCIATION_TRUSTED_KEYSTORE);
            String[] trustedStores = new String[tstedStores.length];
            for (int i = 0; i < tstedStores.length; i++) {
                String temp = tstedStores[i].getDestinationPath();
                if (temp.startsWith("//")) {
                    temp = temp.substring(1);
                }
                if (temp.equals(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
                        RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)) {
                    ServerConfiguration config = ServerConfiguration.getInstance();
                    String file = new File(config.getFirstProperty(RegistryResources
                            .SecurityManagement.SERVER_PRIMARY_KEYSTORE_FILE)).getAbsolutePath();
                    String name = KeyStoreUtil.getKeyStoreFileName(file);
                    trustedStores[i] = name;
                } else {
                    temp = temp.substring(temp.lastIndexOf("/") + 1);
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.