Package edu.monash.merc.exception

Examples of edu.monash.merc.exception.DCSecurityException


            environment = new Hashtable<String, Object>();
        }
        if (ldapFactory != null && !"".equals(ldapFactory.trim())) {
            environment.put(Context.INITIAL_CONTEXT_FACTORY, ldapFactory);
        } else {
            throw new DCSecurityException("no ldap factory class specified");
        }
        if (serverUrl != null && !"".equals(serverUrl.trim())) {
            environment.put(Context.PROVIDER_URL, serverUrl);
        } else {
            throw new DCSecurityException("no ldap server url specified");
        }
        if (baseDn != null && !"".equals(baseDn.trim())) {
            environment.put(Context.SECURITY_PRINCIPAL, baseDn);
        } else {
            throw new DCSecurityException("no ldap server base dn specified");
        }

        if (protocol != null && !"".equals(protocol.trim())) {
            environment.put(Context.SECURITY_PROTOCOL, protocol);
        }
View Full Code Here


                    logger.debug("found user dn, " + findDn);
                }
            }
        } catch (NamingException nex) {
            logger.error(nex.getMessage());
            throw new DCSecurityException(nex);
        } finally {
            if (dir != null) {
                try {
                    dir.close();
                } catch (NamingException e) {
View Full Code Here

                return usr;
            }
        } catch (NamingException nex) {
            logger.error(nex.getMessage());
            throw new DCSecurityException(nex);
        } finally {
            if (dir != null) {
                try {
                    dir.close();
                } catch (NamingException e) {
View Full Code Here

        try {
            dir = new InitialDirContext(environment);
            return true;
        } catch (Exception e) {
            logger.error(e.getMessage());
            throw new DCSecurityException(e);
        } finally {
            if (dir != null) {
                try {
                    dir.close();
                } catch (NamingException e) {
View Full Code Here

* @version 2.0
*/
public class MD5 {
    public static String hash(String str) {
        if (StringUtils.isBlank(str)) {
            throw new DCSecurityException("String to encript cannot be null or zero length");
        }
        StringBuilder hexString = new StringBuilder();
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(str.getBytes());
            byte[] hash = md.digest();

            for (byte element : hash) {
                if ((0xff & element) < 0x10) {
                    hexString.append('0').append(Integer.toHexString((0xFF & element)));
                } else {
                    hexString.append(Integer.toHexString(0xFF & element));
                }
            }
        } catch (NoSuchAlgorithmException e) {
            throw new DCSecurityException(e);
        }

        return hexString.toString();
    }
View Full Code Here

TOP

Related Classes of edu.monash.merc.exception.DCSecurityException

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.