Package org.apache.catalina

Examples of org.apache.catalina.CredentialHandler


     * @deprecated  This will be removed in Tomcat 9.0.x as it has been replaced
     *              by the CredentialHandler
     */
    @Deprecated
    public String getDigest() {
        CredentialHandler ch = credentialHandler;
        if (ch instanceof MessageDigestCredentialHandler) {
            return ((MessageDigestCredentialHandler) ch).getAlgorithm();
        }
        return null;
    }
View Full Code Here


     * @deprecated  This will be removed in Tomcat 9.0.x as it has been replaced
     *              by the CredentialHandler
     */
    @Deprecated
    public void setDigest(String digest) {
        CredentialHandler ch = credentialHandler;
        if (ch == null) {
            ch = new MessageDigestCredentialHandler();
            credentialHandler = ch;
        }
        if (ch instanceof MessageDigestCredentialHandler) {
View Full Code Here

     * @deprecated  This will be removed in Tomcat 9.0.x as it has been replaced
     *              by the CredentialHandler
     */
    @Deprecated
    public String getDigestEncoding() {
        CredentialHandler ch = credentialHandler;
        if (ch instanceof MessageDigestCredentialHandler) {
            return ((MessageDigestCredentialHandler) ch).getEncoding();
        }
        return null;
    }
View Full Code Here

     * @deprecated  This will be removed in Tomcat 9.0.x as it has been replaced
     *              by the CredentialHandler
     */
    @Deprecated
    public void setDigestEncoding(String charset) {
        CredentialHandler ch = credentialHandler;
        if (ch == null) {
            ch = new MessageDigestCredentialHandler();
            credentialHandler = ch;
        }
        if (ch instanceof MessageDigestCredentialHandler) {
View Full Code Here

        //   or may nor support -a and may or may not supply a sensible default
        if (algorithm == null && handlerClassName == null) {
            algorithm = "SHA-512";
        }

        CredentialHandler handler = null;

        if (handlerClassName == null) {
            for (Class<? extends DigestCredentialHandlerBase> clazz : credentialHandlerClasses) {
                try {
                    handler = clazz.newInstance();
                    if (IntrospectionUtils.setProperty(handler, "algorithm", algorithm)) {
                        break;
                    }
                } catch (InstantiationException | IllegalAccessException e) {
                    // This isn't good.
                    throw new RuntimeException(e);
                }
            }
        } else {
            try {
                Class<?> clazz = Class.forName(handlerClassName);
                handler = (DigestCredentialHandlerBase) clazz.newInstance();
                IntrospectionUtils.setProperty(handler, "algorithm", algorithm);
            } catch (InstantiationException | IllegalAccessException
                    | ClassNotFoundException e) {
                throw new RuntimeException(e);
            }
        }

        if (handler == null) {
            throw new RuntimeException(new NoSuchAlgorithmException(algorithm));
        }

        IntrospectionUtils.setProperty(handler, "encoding", encoding);
        if (iterations > 0) {
            IntrospectionUtils.setProperty(handler, "iterations", Integer.toString(iterations));
        }
        if (saltLength > -1) {
            IntrospectionUtils.setProperty(handler, "saltLength", Integer.toString(saltLength));
        }
        if (keyLength > 0) {
            IntrospectionUtils.setProperty(handler, "keyLength", Integer.toString(keyLength));
        }

        for (; argIndex < args.length; argIndex++) {
            String credential = args[argIndex];
            System.out.print(credential + ":");
            System.out.println(handler.mutate(credential));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.CredentialHandler

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.