Package org.mortbay.jetty.security

Examples of org.mortbay.jetty.security.FormAuthenticator$FormCredential


        Map<String, ComponentPermissions> contextIDToPermissionsMap = new HashMap<String, ComponentPermissions>();
        contextIDToPermissionsMap.put(policyContextId, componentPermissions);
        ApplicationPolicyConfigurationManager jacc = new ApplicationPolicyConfigurationManager(contextIDToPermissionsMap, null, roleDesignates, cl, null, roleMapper);
        jacc.doStart();

        FormAuthenticator formAuthenticator = new FormAuthenticator();
        formAuthenticator.setLoginPage("/auth/logon.html?param=test");
        formAuthenticator.setErrorPage("/auth/logonError.html?param=test");
        return setUpAppContext("Test JAAS Realm",
                securityRealmName,
                formAuthenticator,
                policyContextId,
                componentPermissions.getExcludedPermissions(),
View Full Code Here


                    webModuleData.setAttribute("authenticator", new BasicAuthenticator());
                } else if ("DIGEST".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new DigestAuthenticator());
                } else if ("FORM".equals(authMethod)) {

                    FormAuthenticator formAuthenticator = new FormAuthenticator();
                    webModuleData.setAttribute("authenticator", formAuthenticator);
                    if (loginConfig.isSetFormLoginConfig()) {
                        FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
                        formAuthenticator.setLoginPage(formLoginConfig.getFormLoginPage().getStringValue());
                        formAuthenticator.setErrorPage(formLoginConfig.getFormErrorPage().getStringValue());
                    }
                } else if ("CLIENT-CERT".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new ClientCertAuthenticator());
                }
            }
View Full Code Here

                    webModuleData.setAttribute("authenticator", new BasicAuthenticator());
                } else if ("DIGEST".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new DigestAuthenticator());
                } else if ("FORM".equals(authMethod)) {

                    FormAuthenticator formAuthenticator = new FormAuthenticator();
                    webModuleData.setAttribute("authenticator", formAuthenticator);
                    if (loginConfig.isSetFormLoginConfig()) {
                        FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
                        formAuthenticator.setLoginPage(formLoginConfig.getFormLoginPage().getStringValue());
                        formAuthenticator.setErrorPage(formLoginConfig.getFormErrorPage().getStringValue());
                    }
                } else if ("CLIENT-CERT".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new ClientCertAuthenticator());
                }
            }
View Full Code Here

                    webModuleData.setAttribute("authenticator", new BasicAuthenticator());
                } else if ("DIGEST".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new DigestAuthenticator());
                } else if ("FORM".equals(authMethod)) {

                    FormAuthenticator formAuthenticator = new FormAuthenticator();
                    webModuleData.setAttribute("authenticator", formAuthenticator);
                    if (loginConfig.isSetFormLoginConfig()) {
                        FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
                        formAuthenticator.setLoginPage(formLoginConfig.getFormLoginPage().getStringValue());
                        formAuthenticator.setErrorPage(formLoginConfig.getFormErrorPage().getStringValue());
                    }
                } else if ("CLIENT-CERT".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new ClientCertAuthenticator());
                }
            }
View Full Code Here

                    webModuleData.setAttribute("authenticator", new BasicAuthenticator());
                } else if ("DIGEST".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new DigestAuthenticator());
                } else if ("FORM".equals(authMethod)) {

                    FormAuthenticator formAuthenticator = new FormAuthenticator();
                    webModuleData.setAttribute("authenticator", formAuthenticator);
                    if (loginConfig.isSetFormLoginConfig()) {
                        FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
                        formAuthenticator.setLoginPage(formLoginConfig.getFormLoginPage().getStringValue());
                        formAuthenticator.setErrorPage(formLoginConfig.getFormErrorPage().getStringValue());
                    }
                } else if ("CLIENT-CERT".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new ClientCertAuthenticator());
                }
            }
View Full Code Here

        Map contextIDToPermissionsMap = new HashMap();
        contextIDToPermissionsMap.put(policyContextId, componentPermissions);
        ApplicationPolicyConfigurationManager jacc = new ApplicationPolicyConfigurationManager(contextIDToPermissionsMap, roleDesignates, cl, roleMapper);
        jacc.doStart();

        FormAuthenticator formAuthenticator = new FormAuthenticator();
        formAuthenticator.setLoginPage("/auth/logon.html?param=test");
        formAuthenticator.setErrorPage("/auth/logonError.html?param=test");
        return setUpAppContext("Test JAAS Realm",
                "demo-properties-realm",
                formAuthenticator,
                policyContextId,
                componentPermissions.getExcludedPermissions(),
View Full Code Here

    protected JettyWebAppContext setUpSecureAppContext(ConfigurationFactory configurationFactory, Map<String, SubjectInfo> roleDesignates, Map<Principal, Set<String>> principalRoleMap, ComponentPermissions componentPermissions, SubjectInfo defaultSubjectInfo, PermissionCollection checked, Set securityRoles) throws Exception {
        String policyContextId = "TEST";
        ApplicationPolicyConfigurationManager jacc = setUpJACC(roleDesignates, principalRoleMap, componentPermissions, policyContextId);

        FormAuthenticator formAuthenticator = new FormAuthenticator();
        formAuthenticator.setLoginPage("/auth/logon.html?param=test");
        formAuthenticator.setErrorPage("/auth/logonError.html?param=test");
        return setUpAppContext("Test JAAS Realm",
                configurationFactory,
                formAuthenticator,
                policyContextId,
                componentPermissions.getExcludedPermissions(),
View Full Code Here

                    webModuleData.setAttribute("authenticator", new BasicAuthenticator());
                } else if ("DIGEST".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new DigestAuthenticator());
                } else if ("FORM".equals(authMethod)) {

                    FormAuthenticator formAuthenticator = new FormAuthenticator();
                    webModuleData.setAttribute("authenticator", formAuthenticator);
                    if (loginConfig.isSetFormLoginConfig()) {
                        FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
                        formAuthenticator.setLoginPage(formLoginConfig.getFormLoginPage().getStringValue());
                        formAuthenticator.setErrorPage(formLoginConfig.getFormErrorPage().getStringValue());
                    }
                } else if ("CLIENT-CERT".equals(authMethod)) {
                    webModuleData.setAttribute("authenticator", new ClientCertAuthenticator());
                }
            }
View Full Code Here

    /* ------------------------------------------------------------ */
    protected void initLoginConfig(XmlParser.Node node)
    {
        XmlParser.Node method=node.get("auth-method");
        FormAuthenticator _formAuthenticator=null;
        if(method!=null)
        {
            Authenticator authenticator=null;
            String m=method.toString(false,true);
            if(Constraint.__FORM_AUTH.equals(m))
                authenticator=_formAuthenticator=new FormAuthenticator();
            else if(Constraint.__BASIC_AUTH.equals(m))
                authenticator=new BasicAuthenticator();
            else if(Constraint.__DIGEST_AUTH.equals(m))
                authenticator=new DigestAuthenticator();
            else if(Constraint.__CERT_AUTH.equals(m))
                authenticator=new ClientCertAuthenticator();
            else if(Constraint.__CERT_AUTH2.equals(m))
                authenticator=new ClientCertAuthenticator();
            else
                Log.warn("UNKNOWN AUTH METHOD: "+m);
            getWebAppContext().getSecurityHandler().setAuthenticator(authenticator);
        }
        XmlParser.Node name=node.get("realm-name");

        UserRealm[] realms=ContextHandler.getCurrentContext().getContextHandler().getServer().getUserRealms();

        String realm_name=name==null?"default":name.toString(false,true);

        UserRealm realm=getWebAppContext().getSecurityHandler().getUserRealm();
        for (int i=0;realm==null && realms!=null && i<realms.length; i++)
        {
            if (realms[i]!=null && realm_name.equals(realms[i].getName()))
                realm=realms[i];
        }

        if (realm==null)
        {
            String msg = "Unknown realm: "+realm_name;
            Log.warn(msg);
        }
        else
            getWebAppContext().getSecurityHandler().setUserRealm(realm);

       
        XmlParser.Node formConfig=node.get("form-login-config");
        if(formConfig!=null)
        {
            if(_formAuthenticator==null)
                Log.warn("FORM Authentication miss-configured");
            else
            {
                XmlParser.Node loginPage=formConfig.get("form-login-page");
                if(loginPage!=null)
                    _formAuthenticator.setLoginPage(loginPage.toString(false,true));
                XmlParser.Node errorPage=formConfig.get("form-error-page");
                if(errorPage!=null)
                {
                    String ep=errorPage.toString(false,true);
                    _formAuthenticator.setErrorPage(ep);
                }
            }
        }
    }
View Full Code Here

        Map contextIDToPermissionsMap = new HashMap();
        contextIDToPermissionsMap.put(policyContextId, componentPermissions);
        ApplicationPolicyConfigurationManager jacc = new ApplicationPolicyConfigurationManager(contextIDToPermissionsMap, roleDesignates, cl, roleMapper);
        jacc.doStart();

        FormAuthenticator formAuthenticator = new FormAuthenticator();
        formAuthenticator.setLoginPage("/auth/logon.html?param=test");
        formAuthenticator.setErrorPage("/auth/logonError.html?param=test");
        return setUpAppContext("Test JAAS Realm",
                "demo-properties-realm",
                formAuthenticator,
                policyContextId,
                componentPermissions.getExcludedPermissions(),
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.security.FormAuthenticator$FormCredential

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.