Package framework.beans.config.server

Examples of framework.beans.config.server.ServConfig


     * @param ldapName
     * @param tryPasswdHash
     */
    private void checkLDAP(String ldapName, byte[] tryPasswdHash) throws ClipsServerException {
        Hashtable<String, String> env = new Hashtable<String, String>();
        ServConfig sc = manager.find(ServConfig.class, ConfigParametrAbstract.ID_LDAP_URL);
        String url = (sc == null) ? "" : sc.getStrvalue();

        ServConfig scSSL = manager.find(ServConfig.class, ConfigParametrAbstract.ID_LDAP_USE_SSL);
        Boolean ssl = (scSSL == null) ? false : Boolean.parseBoolean(scSSL.getStrvalue());

        ServConfig scMask = manager.find(ServConfig.class, ConfigParametrAbstract.ID_LDAP_SEARCH_MASK);
        String mask = (scMask == null) ? "$1" : scMask.getStrvalue();
        mask = mask.replaceAll("\\$1", "%s");
        mask = String.format(mask, ldapName);

        ServConfig scType = manager.find(ServConfig.class, ConfigParametrAbstract.ID_LDAP_CRYPTO_SCHEME);
        String crypt = (scType == null) ? "simple" : scType.getStrvalue();

        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, url);
        env.put(Context.SECURITY_AUTHENTICATION, crypt);
        env.put(Context.SECURITY_PRINCIPAL, mask);
View Full Code Here


     * @return - случа
     */
    @Override
    public PasswordEncryptor getEncryptor() {
        if(sessionPassword == null) {
            ServConfig sc = manager.find(ServConfig.class,
                    ConfigParametrAbstract.ID_LDAP_USE);
            String use = (sc == null) ? "false" : sc.getStrvalue();
            useLDAP = Boolean.parseBoolean(use);
            sessionPassword = new SessionPassword(useLDAP);
        }
        return sessionPassword.getEncryptor();
    }
View Full Code Here

        if (sessionPassword == null) {
            throw new ESecurity("Внутренняя ошибка: Перед вызовом login должен быть вызван getEncryptor ");
        }

        //check is admin or not
        ServConfig sc = manager.find(ServConfig.class, ConfigParametrAbstract.ID_ADMIN_PASSWORD_HASH);
        String adminPassword = (sc == null) ? null : sc.getStrvalue();

        boolean isSuperUser = false;
        if (adminPassword != null && !adminPassword.isEmpty()) {
            isSuperUser = sessionPassword.verifyHash(tryPasswdHash,
                    SessionPassword.char2byte(adminPassword.toCharArray()));
View Full Code Here

TOP

Related Classes of framework.beans.config.server.ServConfig

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.