Examples of ISecurityContext


Examples of org.jasig.portal.security.ISecurityContext

        }

        // If still no password, loop through subcontexts to find cached credentials
        Enumeration en = baseContext.getSubContexts();
        while (password == null && en.hasMoreElements()) {
            ISecurityContext subContext = (ISecurityContext)en.nextElement();
            password = this.getPassword(subContext);
        }

        return password;
    }
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

      try {
         // Get the person object associated with the request
         person = PersonManagerFactory.getPersonManagerInstance().getPerson(request);
         if (person != null) {
             // Retrieve the security context for the user
             ISecurityContext securityContext = person.getSecurityContext();
             if (securityContext.isAuthenticated()) {
                 if (log.isDebugEnabled())
                     log.debug("LogoutServlet::getRedirectionUrl()" +
                         " Looking for redirect string for the root context");
                redirect = (String)REDIRECT_MAP.get("root");
                if (redirect != null && !redirect.equals("")) {
                   return redirect;
                }
             }
             Enumeration subCtxNames = securityContext.getSubContextNames();
             while (subCtxNames.hasMoreElements()) {
                String subCtxName = (String)subCtxNames.nextElement();
                if (log.isDebugEnabled())
                    log.debug("LogoutServlet::getRedirectionUrl() " +
                            " subCtxName = " + subCtxName);
                // strip off "root." part of name
                ISecurityContext sc = securityContext.getSubContext(subCtxName);
                if (log.isDebugEnabled())
                    log.debug("LogoutServlet::getRedirectionUrl()" +
                            " subCtxName isAuth = " + sc.isAuthenticated());
                if (sc.isAuthenticated()) {
                    if (log.isDebugEnabled())
                        log.debug("LogoutServlet::getRedirectionUrl()" +
                                " Looking for redirect string for subCtxName = " + subCtxName);
                   redirect = (String)REDIRECT_MAP.get(subCtxName);
                   if (redirect != null && !redirect.equals("")) {
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

   
    /**
     * Test that setSecurityContext does not change the security context.
     */
    public void testSetSecurityContext() {
        ISecurityContext baselineContext = this.person.getSecurityContext();
        assertNotNull(baselineContext);
       
        assertNull(this.restrictedPerson.getSecurityContext());
       
        this.restrictedPerson.setSecurityContext(new DummySecurityContext());
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

   
    /**
     * Test that setSecurityContext does not change the security context.
     */
    public void testSetSecurityContext() {
        ISecurityContext baselineContext = this.person.getSecurityContext();
        assertNotNull(baselineContext);
       
        assertNull(this.restrictedPerson.getSecurityContext());
       
        this.restrictedPerson.setSecurityContext(new DummySecurityContext());
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

      }
      try {
         // Get the person object associated with the request
         person = PersonManagerFactory.getPersonManagerInstance().getPerson(request);
         // Retrieve the security context for the user
         ISecurityContext securityContext = person.getSecurityContext();
         if (securityContext.isAuthenticated()) {
             if (log.isDebugEnabled())
                 log.debug("LogoutServlet::getRedirectionUrl()" +
                     " Looking for redirect string for the root context");
            redirect = (String)REDIRECT_MAP.get("root");
            if (redirect != null && !redirect.equals("")) {
               return redirect;
            }
         }
         Enumeration subCtxNames = securityContext.getSubContextNames();
         while (subCtxNames.hasMoreElements()) {
            String subCtxName = (String)subCtxNames.nextElement();
            if (log.isDebugEnabled())
                log.debug("LogoutServlet::getRedirectionUrl() " +
                        " subCtxName = " + subCtxName);
            // strip off "root." part of name
            ISecurityContext sc = securityContext.getSubContext(subCtxName);
            if (log.isDebugEnabled())
                log.debug("LogoutServlet::getRedirectionUrl()" +
                        " subCtxName isAuth = " + sc.isAuthenticated());
            if (sc.isAuthenticated()) {
                if (log.isDebugEnabled())
                    log.debug("LogoutServlet::getRedirectionUrl()" +
                            " Looking for redirect string for subCtxName = " + subCtxName);
               redirect = (String)REDIRECT_MAP.get(subCtxName);
               if (redirect != null && !redirect.equals("")) {
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

      // retrieve the existing security contexts.  If one of the existing security contexts is a RemoteUserSecurityContext,
      // we set the REMOTE_USER field of the existing RemoteUserSecurityContext context.
      //
      // If a RemoteUserSecurityContext does not already exist, we create one and populate the REMOTE_USER field.
     
      ISecurityContext context = null;
      Enumeration subContexts = null;
      boolean remoteUserSecurityContextExists = false;
     
      // Retrieve existing security contexts.
      context = person.getSecurityContext( );     
      if ( context != null )
          subContexts = context.getSubContexts( );     
     
      if ( subContexts != null ) {               
        while ( subContexts.hasMoreElements( ) ) {
            ISecurityContext ctx = (ISecurityContext)subContexts.nextElement( );
            // Check to see if a RemoteUserSecurityContext already exists, and set the REMOTE_USER
            if ( ctx instanceof RemoteUserSecurityContext ) {
                RemoteUserSecurityContext remoteuserctx = (RemoteUserSecurityContext)ctx;
                remoteuserctx.setRemoteUser( remoteUser );
                remoteUserSecurityContextExists = true;
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

    * @exception PortalSecurityException
    */
   public void authenticate (HashMap principals, HashMap credentials, IPerson person) throws PortalSecurityException {
      
      // Retrieve the security context for the user
      ISecurityContext securityContext = person.getSecurityContext();
     
      //Set the principals and credentials for the security context chain
      this.configureSecurityContextChain(principals, credentials, person, securityContext, BASE_CONTEXT_NAME);
     
      // NOTE: The LoginServlet looks in the security.properties file to
      // determine what tokens to look for that represent the principals and
      // credentials for each context. It then retrieves the values from the request
      // and stores the values in the principals and credentials HashMaps that are
      // passed to the Authentication service.

      // Attempt to authenticate the user
      securityContext.authenticate();
      // Check to see if the user was authenticated
      if (securityContext.isAuthenticated()) {
         // Add the authenticated username to the person object
         // the login name may have been provided or reset by the security provider
         // so this needs to be done after authentication.
         person.setAttribute(IPerson.USERNAME, securityContext.getPrincipal().getUID());
         // Retrieve the additional descriptor from the security context
         IAdditionalDescriptor addInfo = person.getSecurityContext().getAdditionalDescriptor();
         // Process the additional descriptor if one was created
         if (addInfo != null) {
            // Replace the passed in IPerson with the additional descriptor if the
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

           String localSubCtxName = fullSubCtxName;
           if (fullSubCtxName.startsWith(baseContextName + ".")) {
               localSubCtxName = localSubCtxName.substring(baseContextName.length() + 1);
           }
         
           final ISecurityContext sc = securityContext.getSubContext(localSubCtxName);
          
           this.configureSecurityContextChain(principals, credentials, person, sc, fullSubCtxName);
       }
   }  
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

      super.authenticate();

      Enumeration e = getSubContexts();
      while (e.hasMoreElements()) {
        ISecurityContext subCtx = (ISecurityContext) e.nextElement();
        if (subCtx.isAuthenticated()) {
            this.myPrincipal=(ChainingPrincipal)subCtx.getPrincipal();
            this.myAdditionalDescriptor=subCtx.getAdditionalDescriptor();
            this.isauth=true;
            break;
            }
        }
  }
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

    int i;
    Enumeration e = mySubContexts.elements();
    boolean error = false;

    while (e.hasMoreElements()) {
      ISecurityContext sctx = ((Entry) e.nextElement()).getCtx();
      // The principal and credential are now set for all subcontexts in Authentication
      try {
        sctx.authenticate();
      } catch (Exception ex) {
        error = true;
        log.error("Exception authenticating subcontext " + sctx, ex);
      }
      // Stop attempting to authenticate if authenticated and if the property flag is set
      if(stopWhenAuthenticated && sctx.isAuthenticated()) {
        break;
      }
    }

    // Zero out the actual credentials if it isn't already null
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.