Examples of UserHandler


Examples of org.apache.cocoon.webapps.authentication.user.UserHandler

        HandlerConfiguration config = this.getHandlerConfiguration( handlerName );
        if ( config == null ) {
            throw new ProcessingException("Unknown handler to check: " + handlerName);
        }
        // are we already logged in?
        UserHandler handler = this.getUserHandler( handlerName );
        final boolean authenticated = ( handler != null );
        if ( !authenticated ) {
            if (redirector != null) {
                // create parameters
                SourceParameters parameters = config.getRedirectParameters();
View Full Code Here

Examples of org.apache.cocoon.webapps.authentication.user.UserHandler

        HandlerConfiguration config = this.getHandlerConfiguration( handlerName );
        if ( config == null ) {
            throw new ProcessingException("Unknown handler to logout: " + handlerName);
        }
        // are we logged in?
        UserHandler handler = this.getUserHandler( handlerName );
        // we don't throw an exception if we are already logged out!
        if ( handler != null ) {
           
            // Do we save something on logout?
            /*
           
            if ( config.saveOnLogout()
                 && config.getSaveResource() != null) {
                final AuthenticationContext authContext = handler.getContext();
                try {
                    // This might not work, because of the missing state
                    authContext.saveXML("/authentication",
                                    null,
                                    ContextHelper.getObjectModel(this.context),
                                    this.resolver, this.manager);
                } catch (Exception ignore) {
                    // we don't want to stop the logout process
                    // because of errors during save
                    this.getLogger().error("Exception while saving authentication information.", ignore);
                }
            }
            // save applications (if configured)
            Iterator iter = config.getApplications().values().iterator();
            while ( iter.hasNext() ) {
                ApplicationConfiguration appConfig = (ApplicationConfiguration) iter.next();
                if ( appConfig.saveOnLogout()
                     && appConfig.getSaveResource() != null ) {
                     // ???
                }
            }
            */
            // notify the authenticator
            try {
                this.lookupAuthenticator(config).logout(handler);
            } catch (Exception ignore) {
                // we really ignore any exception!
            }
           
            List applicationContexts = handler.getApplicationContexts();
            if ( applicationContexts != null ) {
                ContextManager contextManager = null;

                try {
                    contextManager = (ContextManager)this.manager.lookup(ContextManager.ROLE);
View Full Code Here

Examples of org.apache.cocoon.webapps.authentication.user.UserHandler

    public SessionContext createApplicationContext(String name,
                                                   String loadURI,
                                                   String saveURI)
    throws ProcessingException {
        RequestState state = this.getState();
        UserHandler handler = state.getHandler();
       
        SessionContext context = null;

        if ( handler != null ) {
            ContextManager contextManager = null;
            try {
                contextManager = (ContextManager)this.manager.lookup(ContextManager.ROLE);
                // create new context
                context = contextManager.createContext(name, loadURI, saveURI);
                handler.addApplicationContext( name );

            } catch (ServiceException ce) {
                throw new ProcessingException("Unable to create session context.", ce);
            } catch (IOException ioe) {
                throw new ProcessingException("Unable to create session context.", ioe);
View Full Code Here

Examples of org.apache.cocoon.webapps.authentication.user.UserHandler

            } finally {
                this.manager.release( authManager );
            }
           
            if ( null != state ) {
                UserHandler handler = state.getHandler();
                if ( handler != null ) {
                    context = handler.getContext();
                }
            }
        }
        return context;
    }
View Full Code Here

Examples of org.apache.cocoon.webapps.authentication.user.UserHandler

                                CopletFactory copletFactory,
                                LayoutFactory layoutFactory,
                                ServiceSelector adapterSelector)
    throws Exception {
        final RequestState state = this.getRequestState();
        final UserHandler handler = state.getHandler();
        final Configuration appConf = state.getApplicationConfiguration().getConfiguration("portal");
        if ( appConf == null ) {
            throw new ProcessingException("Configuration for portal not found in application configuration.");
        }
        final Configuration config = appConf.getChild("profiles");
View Full Code Here

Examples of org.exoplatform.services.organization.UserHandler

      Collection group = uHandler.findGroupsOfUser("root");
   }

   public void testFindUserByGroup() throws Exception
   {
      UserHandler uHandler = organizationService.getUserHandler();
      PageList users = uHandler.findUsersByGroup("/platform/administrators");
      assertTrue(users.getAvailable() > 0);

      List iterator = users.getAll();
      for (Object test : iterator)
      {
View Full Code Here

Examples of org.exoplatform.services.organization.UserHandler

      }
   }

   public void testChangePassword() throws Exception
   {
      UserHandler uHandler = organizationService.getUserHandler();
      User user = uHandler.findUserByName("root");
      assertNotNull(user);
      assertTrue(uHandler.authenticate("root", "gtn"));
     
      // Test changing password
      user.setPassword("newPassword");
      uHandler.saveUser(user, false);
      user = uHandler.findUserByName("root");
      assertNotNull(user);
      assertTrue(uHandler.authenticate("root", "newPassword"));   

      // Reset to default password
      user.setPassword("gtn");
      uHandler.saveUser(user, false);

   }
View Full Code Here

Examples of org.exoplatform.services.organization.UserHandler

         {
            assertNull(storage_.getPortalConfig(PortalConfig.USER_TYPE, "user"));
            assertNull(storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien"));

            //
            UserHandler userHandler = orgService_.getUserHandler();
            User user = userHandler.createUserInstance("julien");
            user.setPassword("default");
            user.setFirstName("default");
            user.setLastName("default");
            user.setEmail("exo@exoportal.org");
            userHandler.createUser(user, true);

            //
            PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien");
            assertNotNull(cfg);
            Container container = cfg.getPortalLayout();
View Full Code Here

Examples of org.exoplatform.services.organization.UserHandler

      assertNull(group);
   }

   public void testUserLayout() throws Exception
   {
      UserHandler userHandler = org.getUserHandler();
      User user = userHandler.findUserByName("testing");
      assertNull(user);

      user = userHandler.createUserInstance("testing");
      user.setEmail("testing@gmaild.com");
      user.setFirstName("test firstname");
      user.setLastName("test lastname");
      user.setPassword("123456");

      userHandler.createUser(user, true);

      user = userHandler.findUserByName("testing");
      assertNotNull(user);

      PortalConfig pConfig = storage.getPortalConfig(PortalConfig.USER_TYPE, "testing");
      assertNotNull("the User's PortalConfig is not null", pConfig);
   }
View Full Code Here

Examples of org.exoplatform.services.organization.UserHandler

      private MembershipUser toMembershipUser(Membership membership) throws Exception
      {
         OrganizationService service = getApplicationComponent(OrganizationService.class);
         String userName = membership.getUserName();
         UserHandler handler = service.getUserHandler();
         User user = handler.findUserByName(userName);
         if (user == null)
            return null;
         return new MembershipUser(user, membership.getMembershipType(), membership.getId());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.