Examples of ISecurityContext


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
      final long start = System.currentTimeMillis();
      securityContext.authenticate();
      final long elapsed = System.currentTimeMillis() - start;
      // Check to see if the user was authenticated
      if (securityContext.isAuthenticated()) {
         lastAuthentication = authenticationTimes.add(elapsed); // metric
         // 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

            }
           
            userInstance = new GuestUserInstance(person, guestUserPreferencesManager, request);
        }
        else {
            final ISecurityContext securityContext = person.getSecurityContext();
            if (securityContext.isAuthenticated()) {
                userInstance = new UserInstance(person, request);
            }
            else {
                // we can't allow for unauthenticated, non-guest user to come into the system
                throw new PortalSecurityException("System does not allow for unauthenticated non-guest users.");
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

      super.authenticate();

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

Examples of org.jasig.portal.security.ISecurityContext

    }
   
    // get the CasSecurityContext
        final IUserInstance userInstance = userInstanceManager.getUserInstance(httpServletRequest);
        final IPerson person = userInstance.getPerson();
    final ISecurityContext context = person.getSecurityContext();
    if (context == null) {
      log.error("no security context, no proxy ticket passed to the portlet");
      return null;
    }
    ISecurityContext casContext = getCasContext(context);
    if (casContext == null) {
      log.debug("no CAS security context, no proxy ticket passed to the portlet");
      return null;
    }
    if (!casContext.isAuthenticated()) {
      log.debug("no CAS authentication, no proxy ticket passed to the portlet");
      return null;
    }
   
    // get a proxy ticket for our portlet from the CasSecurityContext
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

    if (context instanceof ICasSecurityContext) {
      return context;
    }
    Enumeration contextEnum = context.getSubContexts();
    while (contextEnum.hasMoreElements()) {
      ISecurityContext subContext = (ISecurityContext) contextEnum.nextElement();
      if (subContext instanceof ICasSecurityContext) {
        return subContext;
      }
    }
    return null;
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 {
          if (sctx instanceof IParentAwareSecurityContext) {
              ((IParentAwareSecurityContext) sctx).authenticate(this);
          } else {
              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

Examples of org.jasig.portal.security.ISecurityContext

   
    public void init(ChannelStaticData sd) {
        this.staticData = sd;
        this.person = sd.getPerson();
       
        ISecurityContext ic = this.person.getSecurityContext();
        if (ic instanceof ICasSecurityContext && ic.isAuthenticated())
            this.casSecurityContext = (ICasSecurityContext) ic;
       
        // loop through subcontexts to find implementations of
        // ICasSecurityContext
        Enumeration en = ic.getSubContexts();
        while (en.hasMoreElements()) {
            ISecurityContext sctx = (ISecurityContext) en.nextElement();
            if (sctx instanceof ICasSecurityContext && sctx.isAuthenticated())
                this.casSecurityContext = (ICasSecurityContext) sctx;
        }
       
        if (this.casSecurityContext == null)
            log.error("Unable to find authenticated ICasSecurityContext");
View Full Code Here

Examples of org.jasig.portal.security.ISecurityContext

    if (isPasswordRequested(request, portletWindow)) {

          final HttpServletRequest httpServletRequest = this.portalRequestUtils.getOriginalPortletAdaptorRequest(request);
          final IUserInstance userInstance = userInstanceManager.getUserInstance(httpServletRequest);
          final IPerson person = userInstance.getPerson();
      final ISecurityContext context = person.getSecurityContext();

      // if it is, attempt to request a proxy ticket
      String password = getPassword(context);
      if (this.decryptPassword && password != null) {
        password = stringEncryptionService.decrypt(password);
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.