Package org.jboss.identity.federation.api.openid.provider.OpenIDProviderManager

Examples of org.jboss.identity.federation.api.openid.provider.OpenIDProviderManager.OpenIDMessage


      }

      String mode = requestp.hasParameter("openid.mode") ?
                  requestp.getParameterValue("openid.mode") : null;

      OpenIDMessage responsem;
      String responseText;
     
      log("[OpenIDProviderServlet]:mode=" + mode + "::ParameterMap:" + requestp);

      if ("associate".equals(mode))
      {
         // --- process an association request ---
         responsem = serverManager.processAssociationRequest(requestp);
         responseText = responsem.getResponseText();
      }
      else if ("checkid_setup".equals(mode)
            || "checkid_immediate".equals(mode))
      {
         // interact with the user and obtain data needed to continue
         //List userData = userInteraction(requestp);
         String userSelectedId = null;
         String userSelectedClaimedId = null;
         Boolean authenticatedAndApproved = Boolean.FALSE;

         if ((session.getAttribute("authenticatedAndApproved") == null) ||
               (((Boolean)session.getAttribute("authenticatedAndApproved")) == Boolean.FALSE) )
         {
            session.setAttribute("parameterlist", requestp);
            response.sendRedirect( request.getContextPath() + "/" + this.securePageName);
         }
         else
         {
            userSelectedId = (String) session.getAttribute("openid.claimed_id");
            userSelectedClaimedId = (String) session.getAttribute("openid.identity");
            authenticatedAndApproved = (Boolean) session.getAttribute("authenticatedAndApproved");
            // Remove the parameterlist so this provider can accept requests from elsewhere
            session.removeAttribute("parameterlist");
            session.setAttribute("authenticatedAndApproved", Boolean.FALSE); // Makes you authorize each and every time
         }

         // --- process an authentication request ---
         responsem = serverManager.processAuthenticationRequest(requestp,
               userSelectedId,
               userSelectedClaimedId,
               authenticatedAndApproved.booleanValue());

         // caller will need to decide which of the following to use:
         // - GET HTTP-redirect to the return_to URL
         // - HTML FORM Redirection
         //responseText = response.wwwFormEncoding();
         if (responsem.isSuccessful())
         {
            response.sendRedirect( responsem.getDestinationURL(true));
            return;
         }
         else
         {
            responseText="<pre>"+ responsem.getResponseText() +"</pre>";
         }
      }
      else if ("check_authentication".equals(mode))
      {
         // --- processing a verification request ---
         responsem = serverManager.verify(requestp);
         responseText = responsem.getResponseText();
      }
      else
      {
         // --- error response ---
         responsem = serverManager.getDirectError("Unknown request");
         responseText = responsem.getResponseText();
      }
   
      log("[OpenIDProviderServlet]:response="+responseText);
      response.getWriter().write(responseText);
  
View Full Code Here


      }

      String mode = requestp.hasParameter("openid.mode") ?
                  requestp.getParameterValue("openid.mode") : null;

      OpenIDMessage responsem;
      String responseText;
     
      log("[OpenIDProviderServlet]:mode=" + mode + "::ParameterMap:" + requestp);

      if ("associate".equals(mode))
      {
         // --- process an association request ---
         responsem = serverManager.processAssociationRequest(requestp);
         responseText = responsem.getResponseText();
      }
      else if ("checkid_setup".equals(mode)
            || "checkid_immediate".equals(mode))
      {
         // interact with the user and obtain data needed to continue
         //List userData = userInteraction(requestp);
         String userSelectedId = null;
         String userSelectedClaimedId = null;
         Boolean authenticatedAndApproved = Boolean.FALSE;

         if ((session.getAttribute("authenticatedAndApproved") == null) ||
               (((Boolean)session.getAttribute("authenticatedAndApproved")) == Boolean.FALSE) )
         {
            session.setAttribute("parameterlist", requestp);
            response.sendRedirect( request.getContextPath() + "/" + this.securePageName);
         }
         else
         {
            userSelectedId = (String) session.getAttribute("openid.claimed_id");
            userSelectedClaimedId = (String) session.getAttribute("openid.identity");
            authenticatedAndApproved = (Boolean) session.getAttribute("authenticatedAndApproved");
            // Remove the parameterlist so this provider can accept requests from elsewhere
            session.removeAttribute("parameterlist");
            session.setAttribute("authenticatedAndApproved", Boolean.FALSE); // Makes you authorize each and every time
         }

         // --- process an authentication request ---
         responsem = serverManager.processAuthenticationRequest(requestp,
               userSelectedId,
               userSelectedClaimedId,
               authenticatedAndApproved.booleanValue());

         // caller will need to decide which of the following to use:
         // - GET HTTP-redirect to the return_to URL
         // - HTML FORM Redirection
         //responseText = response.wwwFormEncoding();
         if (responsem.isSuccessful())
         {
            response.sendRedirect( responsem.getDestinationURL(true));
            return;
         }
         else
         {
            responseText="<pre>"+ responsem.getResponseText() +"</pre>";
         }
      }
      else if ("check_authentication".equals(mode))
      {
         // --- processing a verification request ---
         responsem = serverManager.verify(requestp);
         responseText = responsem.getResponseText();
      }
      else
      {
         // --- error response ---
         responsem = serverManager.getDirectError("Unknown request");
         responseText = responsem.getResponseText();
      }
   
      log("[OpenIDProviderServlet]:response="+responseText);
      response.getWriter().write(responseText);
  
View Full Code Here

TOP

Related Classes of org.jboss.identity.federation.api.openid.provider.OpenIDProviderManager.OpenIDMessage

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.