Package com.google.gsa

Examples of com.google.gsa.AuthorizationProcessImpl


                patternMatch = true;
            } else {
                if (authZHost.match(url)) {

                    //Need the correct authZProcess implementation for this repository ID
                    AuthorizationProcessImpl authZProcess =
                        getAuthorizationProcess(repository);

                    if (authZProcess != null) {
                        //URL matches a pattern
                        if (repository.getId().equals("root")) {
                            //If this is a match for the root id then it's the internal host used to test valve/test.html, so should just return valid
                            logger.debug("Internal AuthZ");
                            statusCode = HttpServletResponse.SC_OK;
                            patternMatch = true;
                            rootIDExists = true;
                        } else {
                            logger.info("Authorizing with " +
                                        repository.getId());
                            patternMatch = true;

                            //Add credentials
                            try {
                                addCredentials(authZProcess, userSession);
                            } catch (Exception e) {
                                logger.error("Error during Kerberos authZ treatment : " +
                                             e.getMessage(), e);
                            }

                            try {
                                String repoID = repository.getId();
                                statusCode =
                                        authZProcess.authorize(request, response,
                                                               authCookies,
                                                               url, repoID);
                                //If statusCode is UNAUTHORIZED, then the process has to stop here
                                if (statusCode ==
                                    HttpServletResponse.SC_UNAUTHORIZED) {
View Full Code Here


     *
     * @return the authorization class
     */
    private AuthorizationProcessImpl getAuthorizationProcess(ValveRepositoryConfiguration repository) {

        AuthorizationProcessImpl authProcess = null;

        //protection
        if (repository != null) {

            try {

                String authZComponent = repository.getAuthZ();
                logger.debug("Authorization module is: " + authZComponent);

                if (authZComponent != null) {
                    authProcess =
                            (AuthorizationProcessImpl)Class.forName(authZComponent).newInstance();
                    authProcess.setValveConfiguration(valveConf);
                } else {
                    logger.debug("This repository[" + repository.getId() +
                                 "] does not cointain any Authorization class");
                }

View Full Code Here

            }
        }

        //Authorization
        AuthorizationProcessImpl authorizationProcessCls;
        try {
            authorizationProcessCls = setAuthorizationProcessImpl();
        } catch (ValveConfigurationException e) {
            logger.error("Valve configuration error: " + e.getMessage(), e);
            resultCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
            return resultCode;
        }

        if (authorizationProcessCls != null) {

            //Avoid HTML processing (URL rewriting)
            AuthorizationUtils.setProcessHTML(false);

            try {
                logger.debug("Authorization process [" + url + "]");
                //
                //Launch authorization process               
                resultCode =
                        authorizationProcessCls.authorize(httpRequest, httpResponse,
                                                          userSession.getCookies(),
                                                          url, credID);
                //Check if result is -1 (there is no pattern in the config file that matches with the URL)
                if (resultCode == -1) {
                    logger.debug("Auth pattern not found for such URL. Setting 401");
View Full Code Here

     *
     * @throws ValveConfigurationException
     */
    public AuthorizationProcessImpl setAuthorizationProcessImpl() throws ValveConfigurationException {

        AuthorizationProcessImpl authorizationProcessImpl = null;

        //Set authorizationProcessClsName if it has not been done yet
        if (authorizationProcessClsName == null) {
            //read the authorization class name from Valve Config
            if (valveConf != null) {
                authorizationProcessClsName =
                        valveConf.getAuthorizationProcessImpl();
                logger.debug("Setting authorizationProcessClsName: " +
                             authorizationProcessClsName);
            } else {
                // Throw Configuration Exception
                throw new ValveConfigurationException("Valve Configuration file has not been set correctly");
            }

        }

        // Protection
        if ((authorizationProcessClsName == null) ||
            (authorizationProcessClsName.equals(""))) {

            // Throw Configuration Exception
            throw new ValveConfigurationException("Configuration parameter [authorizationProcessImpl] has not been set correctly");

        }

        try {

            // Instantiate the authorization process class

            authorizationProcessImpl =
                    (AuthorizationProcessImpl)Class.forName(authorizationProcessClsName).newInstance();
            authorizationProcessImpl.setValveConfiguration(valveConf);

        } catch (InstantiationException ie) {

            // Throw Configuration Exception
            throw new ValveConfigurationException("Configuration parameter [authorizationProcessImpl] has not been set correctly - InstantiationException");
View Full Code Here

TOP

Related Classes of com.google.gsa.AuthorizationProcessImpl

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.