Package org.apache.catalina.authenticator

Examples of org.apache.catalina.authenticator.SingleSignOn


         else
            session.removeNote(Constants.SESS_PASSWORD_NOTE);
      }

      // JBAS-4424: Programmatic web authentication with SSO
      SingleSignOn sso = this.getSingleSignOn(request);
      if (sso == null)
         return;

      // Only create a new SSO entry if the SSO did not already set a note
      // for an existing entry (as it would do with subsequent requests
      // for DIGEST and SSL authenticated contexts)
      String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
      if (ssoId == null)
      {
         // Construct a cookie to be returned to the client
         ssoId = generateSessionId();
         Cookie cookie = new Cookie(Constants.SINGLE_SIGN_ON_COOKIE, ssoId);
         cookie.setMaxAge(-1);
         cookie.setPath("/");

         // Bugzilla 41217
         cookie.setSecure(request.isSecure());

         // Bugzilla 34724
         String ssoDomain = sso.getCookieDomain();
         if (ssoDomain != null)
         {
            cookie.setDomain(ssoDomain);
         }

         Response response = ActiveRequestResponseCacheValve.activeResponse.get();
         response.addCookie(cookie);

         // Register this principal with our SSO valve
         sso.register(ssoId, principal, AUTH_TYPE, username, this.getPasswordAsString(password));
         request.setNote(Constants.REQ_SSOID_NOTE, ssoId);

      }
      else
      {
         // Update the SSO session with the latest authentication data
         sso.update(ssoId, principal, AUTH_TYPE, username, this.getPasswordAsString(password));
      }

      // Always associate a session with a new SSO reqistration.
      // SSO entries are only removed from the SSO registry map when
      // associated sessions are destroyed; if a new SSO entry is created
      // above for this request and the user never revisits the context, the
      // SSO entry will never be cleared if we don't associate the session
      if (session == null)
         session = request.getSessionInternal(true);
      sso.associate(ssoId, session);
   }
View Full Code Here


         session.setPrincipal(null);
         session.removeNote(Constants.SESS_USERNAME_NOTE);
         session.removeNote(Constants.SESS_PASSWORD_NOTE);
      }
      // Unregister the SSOID.
      SingleSignOn sso = this.getSingleSignOn(request);
      if (sso != null)
      {
         String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
         sso.deregister(ssoId);
      }
   }
View Full Code Here

    * @return   a reference to the <code>SingleSignOn</code> valve, or <code>null</code> if no SSO valve
    * has been configured.
    */
   private SingleSignOn getSingleSignOn(Request request)
   {
      SingleSignOn sso = null;
      Container parent = request.getContext().getParent();
      while ((sso == null) && (parent != null))
      {
         if (!(parent instanceof Pipeline))
         {
View Full Code Here

        }
        return rewriteValve;
    }

    Valve createSsoValve(final Container container, final ModelNode element) throws StartException {
        final SingleSignOn ssoValve = element.hasDefined(Constants.CACHE_CONTAINER) ? new ClusteredSingleSignOn(this.ssoManager.getValue()) : new SingleSignOn();
        if (element.hasDefined(Constants.DOMAIN)) ssoValve.setCookieDomain(element.get(Constants.DOMAIN).asString());
        if (element.hasDefined(Constants.REAUTHENTICATE)) ssoValve.setRequireReauthentication(element.get(Constants.REAUTHENTICATE).asBoolean());
        return ssoValve;
    }
View Full Code Here

         else
            session.removeNote(Constants.SESS_PASSWORD_NOTE);
      }

      // JBAS-4424: Programmatic web authentication with SSO
      SingleSignOn sso = this.getSingleSignOn(request);
      if (sso == null)
         return;

      // Only create a new SSO entry if the SSO did not already set a note
      // for an existing entry (as it would do with subsequent requests
      // for DIGEST and SSL authenticated contexts)
      String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
      if (ssoId == null)
      {
         // Construct a cookie to be returned to the client
         ssoId = generateSessionId();
         Cookie cookie = new Cookie(Constants.SINGLE_SIGN_ON_COOKIE, ssoId);
         cookie.setMaxAge(-1);
         cookie.setPath("/");

         // Bugzilla 41217
         cookie.setSecure(request.isSecure());

         // Bugzilla 34724
         String ssoDomain = sso.getCookieDomain();
         if (ssoDomain != null)
         {
            cookie.setDomain(ssoDomain);
         }

         Response response = (Response) SecurityAssociationValve.activeResponse.get();
         response.addCookie(cookie);

         // Register this principal with our SSO valve
         sso.register(ssoId, principal, AUTH_TYPE, username, this.getPasswordAsString(password));
         request.setNote(Constants.REQ_SSOID_NOTE, ssoId);

      }
      else
      {
         // Update the SSO session with the latest authentication data
         sso.update(ssoId, principal, AUTH_TYPE, username, this.getPasswordAsString(password));
      }

      // Always associate a session with a new SSO reqistration.
      // SSO entries are only removed from the SSO registry map when
      // associated sessions are destroyed; if a new SSO entry is created
      // above for this request and the user never revisits the context, the
      // SSO entry will never be cleared if we don't associate the session
      if (session == null)
         session = request.getSessionInternal(true);
      sso.associate(ssoId, session);
   }
View Full Code Here

         session.setPrincipal(null);
         session.removeNote(Constants.SESS_USERNAME_NOTE);
         session.removeNote(Constants.SESS_PASSWORD_NOTE);
      }
      // Unregister the SSOID.
      SingleSignOn sso = this.getSingleSignOn(request);
      if (sso != null)
      {
         String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
         sso.deregister(ssoId);
      }
   }
View Full Code Here

    * @return   a reference to the <code>SingleSignOn</code> valve, or <code>null</code> if no SSO valve
    * has been configured.
    */
   private SingleSignOn getSingleSignOn(Request request)
   {
      SingleSignOn sso = null;
      Container parent = request.getContext().getParent();
      while ((sso == null) && (parent != null))
      {
         if (!(parent instanceof Pipeline))
         {
View Full Code Here

        for (Container parent = container.getParent(); parent != null; parent = parent.getParent()) {
            if (parent instanceof Pipeline) {
                Valve[] valves = ((Pipeline) parent).getValves();
                for (int i = 0; i < valves.length; i++) {
                    if (valves[i] instanceof SingleSignOn) {
                        SingleSignOn sso = (SingleSignOn) valves[i];
                        log.debug("Found SingleSignOn Valve at " + sso);
                        return sso;
                    }
                }
            }
View Full Code Here

     */
    public String createSingleSignOn(String parent)
        throws Exception {

        // Create a new SingleSignOn instance
        SingleSignOn valve = new SingleSignOn();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        String type = pname.getKeyProperty("type");
        Server server = ServerFactory.getServer();
View Full Code Here

     */
    public String createSingleSignOn(String parent)
        throws Exception {

        // Create a new SingleSignOn instance
        SingleSignOn valve = new SingleSignOn();

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ContainerBase containerBase = getParentContainerFromParent(pname);
        containerBase.addValve(valve);
        ObjectName oname = valve.getObjectName();
        return (oname.toString());

    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.authenticator.SingleSignOn

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.