Package org.apache.jetspeed.audit

Examples of org.apache.jetspeed.audit.AuditActivity


                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "start", pa, pab))
                    {
                        try
                        {
                            ApplicationServerManagerResult result = asm.start(pa.getContextPath());
                           
                            if (!result.isOk())
                            {
                                throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
                            }
                            else
                            {
                                StringResourceModel resModel = new StringResourceModel("pam.details.action.status.startOK", this, null, new Object [] { pab.getPath() } );
                                feed.info(resModel.getString());
                                auditActivity.logAdminRegistryActivity(
                                                                       ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                       ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                       AuditActivity.REGISTRY_START,
                                                                       PORTLET_REGISTRY_MANAGER
                                                                       );
                            }
                        }
                        catch (Exception e)
                        {
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.startFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
                            feed.error(resModel.getString());
                        }
                    }
                }
            };

            Link<String> stop = new Link<String>("stop")
            {
                private static final long serialVersionUID = 1L;

                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "stop", pa, pab))
                    {
                        try
                        {
                            ApplicationServerManagerResult result = asm.stop(pa.getContextPath());
                           
                            if (!result.isOk())
                            {
                                throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
                            }
                            else
                            {
                                StringResourceModel resModel = new StringResourceModel("pam.details.action.status.stopOK", this, null, new Object [] { pab.getPath() } );
                                feed.info(resModel.getString());
                               
                                auditActivity.logAdminRegistryActivity(
                                                                       ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                       ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                       AuditActivity.REGISTRY_STOP,
                                                                       PORTLET_REGISTRY_MANAGER
                                                                       );
                            }
                        }
                        catch (Exception e)
                        {
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.stopFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
                            feed.error(resModel.getString());
                        }
                    }
                }
            };
           
            Link<String> undeploy = new Link<String>("undeploy")
            {
                private static final long serialVersionUID = 1L;

                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "undeploy", pa, pab))
                    {
                        try
                        {
                            ApplicationServerManagerResult result = asm.undeploy(pa.getContextPath());
                           
                            if (!result.isOk())
                            {
                                throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
                            }
                            else
                            {
                                StringResourceModel resModel = new StringResourceModel("pam.details.action.status.undeployOK", this, null, new Object [] { pab.getPath() } );
                                feed.info(resModel.getString());
                                auditActivity.logAdminRegistryActivity(
                                                                       ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                       ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                       AuditActivity.REGISTRY_UNDEPLOY,
                                                                       PORTLET_REGISTRY_MANAGER
                                                                       );
                            }
                        }
                        catch (Exception e)
                        {
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.undeployFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
                            feed.error(resModel.getString());
                        }
                    }
                }
            };

            Link<String> del = new Link<String>("delete")
            {
                private static final long serialVersionUID = 1L;

                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();
                    PortletApplicationManagement pam = locator.getPortletApplicationManager();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "remove from registry", pa, pab))
                    {
                        try
                        {
                            pam.unregisterPortletApplication(pa.getName());
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.deleteOK", this, null, new Object [] { pab.getPath() } );
                            feed.info(resModel.getString());
                            auditActivity.logAdminRegistryActivity(
                                                                   ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                   ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                   AuditActivity.REGISTRY_DELETE,
                                                                   PORTLET_REGISTRY_MANAGER
                                                                   );
View Full Code Here


            String username = request.getParameter(LoginConstants.USERNAME);
            String password = request.getParameter(LoginConstants.PASSWORD);           
            if (username != null)
            {
                UserManager userManager = (UserManager)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.UserManager");
                AuditActivity audit = (AuditActivity)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity");               
                boolean success = userManager.authenticate(username, password);
                if (success)
                {
                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "PortalFilter");
                    PortalAuthenticationConfiguration authenticationConfiguration = (PortalAuthenticationConfiguration)
                        Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.administration.PortalAuthenticationConfiguration");
                    if (authenticationConfiguration.isCreateNewSessionOnLogin())
                    {
                        request.getSession().invalidate();
                    }
                    Subject subject = null;
                    try
                    {
                        // load the user principals (roles, groups, credentials)
                        User user = userManager.getUser(username);
                        if ( user != null )
                        {
                            subject = user.getSubject();
                        }
                    }
                    catch (SecurityException sex)
                    {
                    }      
                    if (subject == null)
                    {
                        Set principals = new PrincipalsSet();
                        UserSubjectPrincipalImpl userPrincipal = new UserSubjectPrincipalImpl(username);
                        principals.add(userPrincipal);
                        subject = new Subject(true, principals, new HashSet(), new HashSet());
                        userPrincipal.setSubject(subject);
                    }
                    Principal principal = SecurityHelper.getPrincipal(subject, UserPrincipal.class);
                    sRequest = wrapperRequest(request, subject, principal);
                    request.getSession().removeAttribute(LoginConstants.ERRORCODE);
                    HttpSession session = request.getSession(true);
                    session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
                    //System.out.println("*** login session = " + session);
                }
                else
                {
                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "PortalFilter");                   
                    request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);                   
                }
            }
            else
            {
View Full Code Here

            String username = request.getParameter(LoginConstants.USERNAME);
            String password = request.getParameter(LoginConstants.PASSWORD);           
            if (username != null)
            {
                UserManager userManager = (UserManager)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.UserManager");
                AuditActivity audit = (AuditActivity)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity");               
                boolean success = userManager.authenticate(username, password);
                if (success)
                {
                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "PortalFilter");
                    PortalAuthenticationConfiguration authenticationConfiguration = (PortalAuthenticationConfiguration)
                        Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.administration.PortalAuthenticationConfiguration");
                    if (authenticationConfiguration.isCreateNewSessionOnLogin())
                    {
                        request.getSession().invalidate();
                    }
                    Subject subject = null;
                    try
                    {
                        // load the user principals (roles, groups, credentials)
                        User user = userManager.getUser(username);
                        if ( user != null )
                        {
                            subject = user.getSubject();
                        }
                    }
                    catch (SecurityException sex)
                    {
                        subject = null;
                    }      
                    if (subject == null)
                    {
                        Set principals = new PrincipalsSet();
                        subject = new Subject(true, principals, new HashSet(), new HashSet());
                        UserPrincipal userPrincipal = new UserSubjectPrincipalImpl(username, subject);
                        principals.add(userPrincipal);
                    }
                    Principal principal = SecurityHelper.getPrincipal(subject, UserPrincipal.class);
                    sRequest = wrapperRequest(request, subject, principal);
                    request.getSession().removeAttribute(LoginConstants.ERRORCODE);
                    HttpSession session = request.getSession(true);
                    session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
                    //System.out.println("*** login session = " + session);
                }
                else
                {
                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "PortalFilter");                   
                    request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);                   
                }
            }
            else
            {
View Full Code Here

        else
            retryCount = new Integer(retryCount.intValue() + 1);
        session.setAttribute(LoginConstants.RETRYCOUNT, retryCount);

        String username = (String)session.getAttribute(LoginConstants.USERNAME);       
        AuditActivity audit = (AuditActivity)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity");
        if (audit != null)
        {
            audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "Active Authentication");
        }       
        response.sendRedirect(response.encodeURL(destination));
    }
View Full Code Here

        session.removeAttribute(LoginConstants.USERNAME);
        session.removeAttribute(LoginConstants.PASSWORD);
        session.removeAttribute(LoginConstants.RETRYCOUNT);
        session.removeAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE);

        AuditActivity audit = (AuditActivity)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity");
        if (audit != null)
        {
            audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "Active Authentication");
        }
        response.sendRedirect(response.encodeURL(destination));
    }
View Full Code Here

                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "start", pa, pab))
                    {
                        try
                        {
                            ApplicationServerManagerResult result = asm.start(pa.getContextPath());
                           
                            if (!result.isOk())
                            {
                                throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
                            }
                            else
                            {
                                StringResourceModel resModel = new StringResourceModel("pam.details.action.status.startOK", this, null, new Object [] { pab.getPath() } );
                                feed.info(resModel.getString());
                                auditActivity.logAdminRegistryActivity(
                                                                       ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                       ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                       AuditActivity.REGISTRY_START,
                                                                       PORTLET_REGISTRY_MANAGER
                                                                       );
                            }
                        }
                        catch (Exception e)
                        {
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.startFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
                            feed.error(resModel.getString());
                        }
                    }
                }
            };

            Link<String> stop = new Link<String>("stop")
            {
                private static final long serialVersionUID = 1L;

                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "stop", pa, pab))
                    {
                        try
                        {
                            ApplicationServerManagerResult result = asm.stop(pa.getContextPath());
                           
                            if (!result.isOk())
                            {
                                throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
                            }
                            else
                            {
                                StringResourceModel resModel = new StringResourceModel("pam.details.action.status.stopOK", this, null, new Object [] { pab.getPath() } );
                                feed.info(resModel.getString());
                               
                                auditActivity.logAdminRegistryActivity(
                                                                       ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                       ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                       AuditActivity.REGISTRY_STOP,
                                                                       PORTLET_REGISTRY_MANAGER
                                                                       );
                            }
                        }
                        catch (Exception e)
                        {
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.stopFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
                            feed.error(resModel.getString());
                        }
                    }
                }
            };
           
            Link<String> undeploy = new Link<String>("undeploy")
            {
                private static final long serialVersionUID = 1L;

                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "undeploy", pa, pab))
                    {
                        try
                        {
                            ApplicationServerManagerResult result = asm.undeploy(pa.getContextPath());
                           
                            if (!result.isOk())
                            {
                                throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
                            }
                            else
                            {
                                StringResourceModel resModel = new StringResourceModel("pam.details.action.status.undeployOK", this, null, new Object [] { pab.getPath() } );
                                feed.info(resModel.getString());
                                auditActivity.logAdminRegistryActivity(
                                                                       ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                       ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                       AuditActivity.REGISTRY_UNDEPLOY,
                                                                       PORTLET_REGISTRY_MANAGER
                                                                       );
                            }
                        }
                        catch (Exception e)
                        {
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.undeployFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
                            feed.error(resModel.getString());
                        }
                    }
                }
            };

            Link<String> del = new Link<String>("delete")
            {
                private static final long serialVersionUID = 1L;

                public void onClick()
                {
                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                    PortletRegistry registry = locator.getPortletRegistry();
                    ApplicationServerManager asm = locator.getApplicationServerManager();
                    AuditActivity auditActivity = locator.getAuditActivity();
                    PortletApplicationManagement pam = locator.getPortletApplicationManager();

                    ApplicationBean pab = (ApplicationBean) model.getObject();
                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    if (isServerReady(asm, feed, "remove from registry", pa, pab))
                    {
                        try
                        {
                            pam.unregisterPortletApplication(pa.getName());
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.deleteOK", this, null, new Object [] { pab.getPath() } );
                            feed.info(resModel.getString());
                            auditActivity.logAdminRegistryActivity(
                                                                   ((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
                                                                   ((AbstractAdminWebApplication) getApplication()).getIPAddress(),
                                                                   AuditActivity.REGISTRY_DELETE,
                                                                   PORTLET_REGISTRY_MANAGER
                                                                   );
View Full Code Here

            String password = request.getParameter(LoginConstants.PASSWORD);           
            if (username != null)
            {
                ComponentManager cm = Jetspeed.getComponentManager();
                UserManager userManager = (UserManager)cm.getComponent("org.apache.jetspeed.security.UserManager");
                AuditActivity audit = (AuditActivity)cm.getComponent("org.apache.jetspeed.audit.AuditActivity");
                AuthenticationProvider authProvider = (AuthenticationProvider)cm.getComponent("org.apache.jetspeed.security.AuthenticationProvider");
               
                // Commenting out for the using latest securty API's
                //boolean success = userManager.authenticate(username, password);
                //if (success)
                AuthenticatedUser authUser = null;
                try{
                  authUser = authProvider.authenticate(username, password)
                }
                catch (SecurityException e)
                {
                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "PortalFilter");                   
                    request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
        }
                if (authUser != null)
                {
                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "PortalFilter");
                    PortalAuthenticationConfiguration authenticationConfiguration = (PortalAuthenticationConfiguration)
                        cm.getComponent("org.apache.jetspeed.administration.PortalAuthenticationConfiguration");
                    if (authenticationConfiguration.isCreateNewSessionOnLogin())
                    {
                        request.getSession().invalidate();
                    }
                    else
                    {
                        UserContentCacheManager userContentCacheManager = (UserContentCacheManager)cm.getComponent("userContentCacheManager");
                        userContentCacheManager.evictUserContentCache(username, request.getSession().getId());
                    }
                    if (authUser.getUser() == null)
                    {
                        try
                        {
                            // load the user principals (roles, groups, credentials)
                            User user = userManager.getUser(username);
                            if ( user != null )
                            {
                              authUser = new AuthenticatedUserImpl(user, authUser.getPublicCredentials(), authUser.getPrivateCredentials() );
                            }
                        }
                        catch (SecurityException sex)
                        {
                          // TODO: maybe some better handling required here
                          throw new ServletException(sex);
                        }      
                    }
                    Subject subject;
          try
          {
            // default solution using the build-in UserManager
            subject = userManager.getSubject(authUser);
           
            // alternate DIY solution not using the build-in UserManager:
                      //subject = JetspeedSubjectFactory.createSubject(authUser.getUser(),authUser.getPrivateCredentials(),authUser.getPublicCredentials(),null);
          }
          catch (SecurityException e)
          {
                      // TODO: maybe some better handling required here
                      throw new ServletException(e);
          }
                    sRequest = wrapperRequest(request, subject, authUser.getUser());
                    request.getSession().removeAttribute(LoginConstants.ERRORCODE);
                    HttpSession session = request.getSession(true);
                    session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
                    //System.out.println("*** login session = " + session);
                }
                else
                {
                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "PortalFilter");                   
                    request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);                   
                }
            }
            else
            {
View Full Code Here

              }
            }
          }
        }
        UserManager userManager = (UserManager) cm.getComponent("org.apache.jetspeed.security.UserManager");
        AuditActivity audit = (AuditActivity) cm.getComponent("org.apache.jetspeed.audit.AuditActivity");
        ShibbolethConfiguration config = (ShibbolethConfiguration) cm.getComponent(
            "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
        boolean success = false;
        if (config.isAuthenticate())
        {
          try
          {
            authProvider.authenticate(username, username);
            success = true;
          }
          catch (SecurityException e)
          {
            throw new ServletException();
          }
        }
        else
        {
          try
          {
            // load the user principals (roles, groups, credentials)
            User user = userManager.getUser(username);
            if (user != null)
            {
              subject = userManager.getSubject(user);
            }
            success = true;
          }
          catch (SecurityException sex)
          {
            success = false;
          }
        }
        if (success)
        {
          audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "ShibbolethFilter");
          PortalAuthenticationConfiguration authenticationConfiguration = (PortalAuthenticationConfiguration)
              cm.getComponent("org.apache.jetspeed.administration.PortalAuthenticationConfiguration");
          if (authenticationConfiguration.isCreateNewSessionOnLogin())
          {
            request.getSession().invalidate();
          }
          else
          {
                        UserContentCacheManager userContentCacheManager = (UserContentCacheManager)cm.getComponent("userContentCacheManager");
                        userContentCacheManager.evictUserContentCache(username, request.getSession().getId());
          }
          subject = null;
          try
          {
            // load the user principals (roles, groups, credentials)
            User user = userManager.getUser(username);
            if (user != null)
            {
              subject = userManager.getSubject(user);
            }
          }
          catch (SecurityException sex)
          {
          }
          Principal principal = SubjectHelper.getPrincipal(subject, User.class);
          sRequest = wrapperRequest(request, subject, principal);
          request.getSession().removeAttribute(LoginConstants.ERRORCODE);
          HttpSession session = request.getSession(true);
          session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
        }
        else
        {
          audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "ShibbolethFilter");
          request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
        }
      }
      else
      {
View Full Code Here

        session.removeAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE);

        ComponentManager cm = Jetspeed.getComponentManager();
        UserContentCacheManager userContentCacheManager = (UserContentCacheManager)cm.getComponent("userContentCacheManager");
        userContentCacheManager.evictUserContentCache(username, session.getId());
        AuditActivity audit = (AuditActivity)cm.getComponent("org.apache.jetspeed.audit.AuditActivity");
        if (audit != null)
        {
            audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "Active Authentication");
        }
       
        response.sendRedirect(response.encodeURL(destination));
    }
View Full Code Here

              }
            }
          }
        }
        UserManager userManager = (UserManager) cm.getComponent("org.apache.jetspeed.security.UserManager");
        AuditActivity audit = (AuditActivity) cm.getComponent("org.apache.jetspeed.audit.AuditActivity");
        ShibbolethConfiguration config = (ShibbolethConfiguration) cm.getComponent(
            "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
        boolean success = false;
        if (config.isAuthenticate())
        {
          try
          {
            authProvider.authenticate(username, username);
            success = true;
          }
          catch (SecurityException e)
          {
            throw new ServletException();
          }
        }
        else
        {
          try
          {
            // load the user principals (roles, groups, credentials)
            User user = userManager.getUser(username);
            if (user != null)
            {
              subject = userManager.getSubject(user);
            }
            success = true;
          }
          catch (SecurityException sex)
          {
            success = false;
          }
        }
        if (success)
        {
          audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "ShibbolethFilter");
          PortalAuthenticationConfiguration authenticationConfiguration = (PortalAuthenticationConfiguration)
              cm.getComponent("org.apache.jetspeed.administration.PortalAuthenticationConfiguration");
          if (authenticationConfiguration.isCreateNewSessionOnLogin() && httpSession != null && !httpSession.isNew())
          {
            request.getSession().invalidate();
          }
          else
          {
                        UserContentCacheManager userContentCacheManager = (UserContentCacheManager)cm.getComponent("userContentCacheManager");
                        userContentCacheManager.evictUserContentCache(username, request.getSession().getId());
          }
          subject = null;
          try
          {
            // load the user principals (roles, groups, credentials)
            User user = userManager.getUser(username);
            if (user != null)
            {
              subject = userManager.getSubject(user);
            }
          }
          catch (SecurityException sex)
          {
          }
          Principal principal = SubjectHelper.getPrincipal(subject, User.class);
          sRequest = wrapperRequest(request, subject, principal);
          request.getSession().removeAttribute(LoginConstants.ERRORCODE);
          HttpSession session = request.getSession(true);
          session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
        }
        else
        {
          audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "ShibbolethFilter");
          request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
        }
      }
      else
      {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.audit.AuditActivity

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.