Package org.apache.cocoon.auth

Examples of org.apache.cocoon.auth.User


            // if the user is logged in, we set the current application, data and user
            if ( appData != null ) {
                try {
                    final Application application = this.getApplication(appName);
                    final User user = (User)session.getAttribute(USER + '-' + appName);
                    final Application oldApp = (Application)objectModel.get(ApplicationManager.APPLICATION);
                    objectModel.put(ApplicationManager.APPLICATION, application);
                    objectModel.put(ApplicationManager.APPLICATION_DATA, appData);
                    objectModel.put(ApplicationManager.USER, user);
                    // notify application
View Full Code Here


    public User login(final String appName, final Map loginContext) throws Exception {
        final Map objectModel = this.processInfoProvider.getObjectModel();
        final Application application = this.getApplication(appName);
        final String securityHandlerKey = this.getKey(application.getSecurityHandler());

        User user = null;

        // first check, if we are already logged in
        if ( this.isLoggedIn(appName) ) {
            user = ApplicationUtil.getUser(objectModel);
        } else {
View Full Code Here

    /**
     * @see org.apache.cocoon.auth.SecurityHandler#login(java.util.Map)
     */
    public synchronized User login(final Map loginContext)
    throws AuthenticationException {
        final User user = new StandardUser("anonymous"+this.number);
        this.number++;
        return user;
    }
View Full Code Here

        final String password = (String)loginContext.get(ApplicationManager.LOGIN_CONTEXT_PASSWORD_KEY);
        // compare password
        if ( !StringUtils.equals(password, this.userProperties.getProperty(name)) ) {
            return null;
        }
        final User user = new StandardUser(name);
        // check for additional attributes
        final String prefix = name + '.';
        final Iterator i = this.userProperties.entrySet().iterator();
        while ( i.hasNext() ) {
            final Map.Entry current = (Map.Entry)i.next();
            if ( current.getKey().toString().startsWith(prefix) ) {
                final String key = current.getKey().toString().substring(prefix.length());
                user.setAttribute(key, current.getValue());
            }
        }
        return user;
    }
View Full Code Here

     * Create a new user.
     * @param req The current request.
     * @return A new user object.
     */
    protected User createUser(final Request req) {
        final User user = new ServletUser(req);
        return user;
    }
View Full Code Here

     * @see org.apache.cocoon.auth.SecurityHandler#login(java.util.Map)
     */
    public User login(final Map loginContext)
    throws AuthenticationException {
        final Request req = ObjectModelHelper.getRequest(this.processInfoProvider.getObjectModel());
        User user = null;
        if ( req.getRemoteUser() != null ) {
            user = this.createUser( req );
        }
        return user;
    }
View Full Code Here

        Map map = null;

        final Map loginContext = new HashMap();
        loginContext.putAll(Parameters.toProperties(par));
        final User user =
                  this.applicationManager.login( applicationName, loginContext );

        if ( user != null) {
            // success
            map = new HashMap();
            map.put("ID", user.getId());
            Iterator i = user.getAttributeNames();
            while ( i.hasNext() ) {
                final String key = (String)i.next();
                map.put(key, user.getAttribute(key));
            }
        }

        if (this.getLogger().isDebugEnabled() ) {
            this.getLogger().debug("END act map="+map);
View Full Code Here

                // this can never happen
            }
        }
        authenticationResourceName = b.toString();

        User user = null;
        Document doc = null;

        // invoke the source
        Source source = null;
        try {
View Full Code Here

        final String applicationName = par.getParameter("application");
        final String roleName = par.getParameter("role", null);

        final boolean negate = par.getParameterAsBoolean("negate-result", false);
        if (this.applicationManager.isLoggedIn(applicationName)) {
            final User user = ApplicationUtil.getUser(objectModel);
            if (roleName == null || ApplicationUtil.isUserInRole(user, roleName, objectModel)) {
                if (!negate) {
                    map = new HashMap();
                    map.put("ID", user.getId());
                    Iterator i = user.getAttributeNames();
                    while (i.hasNext()) {
                        final String key = (String) i.next();
                        map.put(key, user.getAttribute(key));
                    }
                }
            }
        } else {
            if (negate) {
View Full Code Here

            // if the user is logged in, we set the current application, data and user
            if ( appData != null ) {
                try {
                    final Application application = this.getApplication(appName);
                    final User user = (User)session.getAttribute(USER + '-' + appName);
                    final Application oldApp = (Application)objectModel.get(ApplicationManager.APPLICATION);
                    objectModel.put(ApplicationManager.APPLICATION, application);
                    objectModel.put(ApplicationManager.APPLICATION_DATA, appData);
                    objectModel.put(ApplicationManager.USER, user);
                    // notify application
View Full Code Here

TOP

Related Classes of org.apache.cocoon.auth.User

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.