Package de.innovationgate.webgate.api.auth

Examples of de.innovationgate.webgate.api.auth.AuthenticationException


    }

    public AuthenticationSession login(X509Certificate cert) throws AuthenticationException {
       
        if (_status == STATUS_AUTHDB_UNKNOWN) {
            throw new AuthenticationException("Authentication was unable to collect data for valid logins yet. Please ensure that source database '" + _dbkey + "' is enabled and can be connected.");
        }
       
        if (_status == STATUS_AUTHDB_PREPARED) {
            try {
                runAuthCollector().join();
View Full Code Here


    }
   
    public AuthenticationSession login(String user, Object credentials) throws AuthenticationException {
       
        if (_status == STATUS_AUTHDB_UNKNOWN) {
            throw new AuthenticationException("Authentication was unable to collect data for valid logins yet. Please ensure that source database '" + _dbkey + "' is enabled and can be connected.");
        }
       
        if (_status == STATUS_AUTHDB_PREPARED) {
            try {
                runAuthCollector().join();
            }
            catch (InterruptedException e) {
            }
        }
       
        try {
            String password  = String.valueOf(credentials);
            Login login = (Login) getLogin(user);
            if (login != null) {
                String hashedPassword = WGUtils.hashPassword(password);
                if (login.getPassword() != null && login.getPassword().equals(hashedPassword)) {
                    return login;
                }
                else {
                    LOG.warn("Failed login for '" + user + "': Wrong password (" + getAuthenticationSource() + ")");
                }
            }
            else {
                LOG.warn("Failed login for '" + user + "': Unknown user (" + getAuthenticationSource() + ")");
            }
            return null;
        }
        catch (NoSuchAlgorithmException e) {
            throw new AuthenticationException("Neccessary password hash algorithm not available: " + e.getMessage());
        }
      
    }
View Full Code Here

            fin.close();
        }
        catch (Exception e) {
            String message = "Could not load CA '" + caFile.getPath() + "'";
            WGFactory.getLogger().error(message, e);
            throw new AuthenticationException(message, e);
        }

        // verify crl is signed by ca
        try {
            getCRL().verify(_currentCA.getPublicKey());
        }
        catch (Exception e) {
            String message = "CRL '" + caFile.getPath() + "' could not be verified against given CA.";
            WGFactory.getLogger().error(message, e);
            throw new AuthenticationException(message, e);
        }
    }
View Full Code Here

     *
     * @throws AuthenticationException
     */
    public X509Certificate getCA() throws AuthenticationException {
        if (_certCA == null) {
            throw new AuthenticationException("CA is not configured properly for auth source: " + getAuthenticationSource());
        }
        File caFile = _core.getWGAFile(_certCA);
        if (caFile.exists()) {
            // check if CA is already loaded
            if (_currentCA != null) {
                // check if CA has been changed
                if (caFile.lastModified() != _currentCALastModified) {
                    // reload ca
                    loadCA(caFile);
                }
            }
            else {
                // load ca
                loadCA(caFile);
            }
            return _currentCA;
        }
        else {
            String message = "Could not find CA '" + _certCA + "'. No such file.";
            WGFactory.getLogger().error(message);
            throw new AuthenticationException(message);
        }
    }
View Full Code Here

            fin.close();
        }
        catch (Exception e) {
            String message = "Could not load CRL '" + crlFile.getPath() + "'";
            WGFactory.getLogger().error(message, e);
            throw new AuthenticationException(message, e);
        }

        // verify crl is signed by expected ca
        try {
            _currentCRL.verify(getCA().getPublicKey());
        }
        catch (Exception e) {
            String message = "CRL '" + crlFile.getPath() + "' could not be verified against given CA.";
            WGFactory.getLogger().error(message, e);
            throw new AuthenticationException(message, e);
        }
    }
View Full Code Here

     *
     * @throws AuthenticationException
     */
    public X509CRL getCRL() throws AuthenticationException {
        if (_certCRL == null) {
            throw new AuthenticationException("CRL is not configured properly for auth source: " + getAuthenticationSource());
        }
        File crlFile = _core.getWGAFile(_certCRL);
        if (crlFile.exists()) {
            // check if CRL is already loaded
            if (_certCRL != null) {
                // check if CRL has been changed
                if (crlFile.lastModified() != _currentCRLLastModified) {
                    // reload crl
                    loadCRL(crlFile);
                }
            }
            else {
                // load crl
                loadCRL(crlFile);
            }
            return _currentCRL;
        }
        else {
            String message = "Could not find CRL '" + _certCRL + "'. No such file.";
            WGFactory.getLogger().error(message);
            throw new AuthenticationException(message);
        }
    }
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.auth.AuthenticationException

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.