view flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java @ 4488:5041105d2edd

Check if response code from GGInA is 200 OK Only parse the GGInA response if the status code is 200 OK. This improves the error message if GGInA is not available and shows the real reason instead of a JDOM error while parsing the response.
author Björn Ricks <bjoern.ricks@intevation.de>
date Wed, 14 Nov 2012 10:36:21 +0100
parents 2e12518ff5b4
children
line wrap: on
line source
package de.intevation.flys.client.server.auth;

import org.apache.log4j.Logger;

public class AuthenticationFactory {

    private static final Logger log =
        Logger.getLogger(AuthenticationFactory.class);

    public static Authenticator getInstance(String name)
        throws IllegalArgumentException
    {
        if (name == null) {
            throw new IllegalArgumentException("Authentication type name is null");
        }

        if (name.equalsIgnoreCase("was") ||
            name.equalsIgnoreCase("ggina")) {
            log.debug("Using GGinA authenticator.");
            return
                new de.intevation.flys.client.server.auth.was.Authenticator();
        }
        else if (name.equalsIgnoreCase("plain")) {
            log.debug("Using plain authenticator.");
            return
                new de.intevation.flys.client.server.auth.plain.Authenticator();
        }

        throw new IllegalArgumentException("Unkown Authentication " + name);
    }
}

http://dive4elements.wald.intevation.org