Examples of ServerManager


Examples of org.openid4java.server.ServerManager

          session.setAttribute("authenticatedAndApproved", authorizedUser);
        }
      }
    }
   
    ServerManager manager = ((SimpleServiceProxy)getServiceProxy()).getServerManager();
    // extract the parameters from the request
    ParameterList parameterList = null;
       
    if (session.getAttribute("parameterlist")!=null) {
      parameterList = (ParameterList) session.getAttribute("parameterlist");
View Full Code Here

Examples of org.openid4java.server.ServerManager

    // return the result to the user
    return directResponse(response,messageResponse.keyValueFormEncoding());
  }

  private String checkAuthentication(HttpServletRequest request, HttpServletResponse response, ParameterList parameterList) throws IOException {
    ServerManager manager = ((SimpleServiceProxy)getServiceProxy()).getServerManager();
    HttpSession session = request.getSession();
    Message messageResponse;
    String responseText;
   
    // --- processing a verification request ---
    messageResponse = manager.verify(parameterList);
    responseText = messageResponse.keyValueFormEncoding();
    return directResponse(response, messageResponse.keyValueFormEncoding());
  }
View Full Code Here

Examples of org.openid4java.server.ServerManager

    responseText = messageResponse.keyValueFormEncoding();
    return directResponse(response, messageResponse.keyValueFormEncoding());
  }

  private String checkId(HttpServletRequest request, HttpServletResponse response, ParameterList parameterList) throws ServletException, IOException {
    ServerManager manager = ((SimpleServiceProxy)getServiceProxy()).getServerManager();
    HttpSession session = request.getSession();
    Message messageResponse;
    String responseText;
   
    // interact with the user and obtain data needed to continue
    String userSelectedId = null;
    String userSelectedClaimedId = null;
    User authenticatedAndApproved = null;
    String email = "";

    if (session.getAttribute("authenticatedAndApproved") == null) {
      session.setAttribute("parameterlist", parameterList);
      String wwwParams = wwwFormEncoding(parameterList);
      String url = "login.jsp?" + wwwParams;
      response.sendRedirect(url);
      return null;
    } else {
      userSelectedId = (String) session.getAttribute("openid.claimed_id");
      userSelectedClaimedId = (String) session.getAttribute("openid.identity");
      authenticatedAndApproved = (User) session.getAttribute("authenticatedAndApproved");
      // Remove the parameterlist so this provider can accept requests from elsewhere
      session.removeAttribute("parameterlist");
      session.setAttribute("authenticatedAndApproved", null);
    }

    // --- process an authentication request ---
    AuthRequest authReq = null;
    String opLocalId = null;

    try {
      authReq = AuthRequest.createAuthRequest(parameterList, manager.getRealmVerifier());
      // if the user chose a different claimed_id than the one in request
      if (userSelectedClaimedId != null && userSelectedClaimedId.equals(authReq.getClaimed())) {
        //opLocalId = "http://localhost:8081/idp4java/idp";//lookupLocalId(userSelectedClaimedId);
      }
    } catch (MessageException e) {
      e.printStackTrace();
      throw new ServletException(e);
    }

    // --- process an authentication request ---
    //messageResponse = manager.authResponse(parameterList, userSelectedId, userSelectedClaimedId, true);
    messageResponse = manager.authResponse(parameterList, opLocalId, opLocalId, true);
   

    if (messageResponse instanceof DirectError)
      return directResponse(response, messageResponse.keyValueFormEncoding());
    else {

            try {
        if (authReq.hasExtension(AxMessage.OPENID_NS_AX))
        {
            MessageExtension ext = authReq.getExtension(AxMessage.OPENID_NS_AX);
            if (ext instanceof FetchRequest)
            {
                FetchRequest fetchReq = (FetchRequest) ext;
                Map required = fetchReq.getAttributes(true);
                Map optional = fetchReq.getAttributes(false);
                if (required.containsKey("email"))
                {
                    Map userDataExt = new HashMap();
                    userDataExt.put("email", "someone@someplace.com");
                    FetchResponse fetchResp = FetchResponse.createFetchResponse(fetchReq, userDataExt);
                    // (alternatively) manually add attribute values
                    //fetchResp.addAttribute("email", "http://schema.openid.net/contact/email", email);
                    messageResponse.addExtension(fetchResp);
                }
            }
            else //if (ext instanceof StoreRequest)
            {
                throw new UnsupportedOperationException("TODO");
            }
        }
        if (authReq.hasExtension(SRegMessage.OPENID_NS_SREG))
        {
            MessageExtension ext = authReq.getExtension(SRegMessage.OPENID_NS_SREG);
            if (ext instanceof SRegRequest)
            {
                SRegRequest sregReq = (SRegRequest) ext;
                List required = sregReq.getAttributes(true);
                List optional = sregReq.getAttributes(false);
                if (required.contains("email"))
                {
                    // data released by the user
                    Map userDataSReg = new HashMap();
                    userDataSReg.put("email", "user@example.com");

                    SRegResponse sregResp = SRegResponse.createSRegResponse(sregReq, userDataSReg);
                    // (alternatively) manually add attribute values
                    //sregResp.addAttribute("email", email);
                    messageResponse.addExtension(sregResp);
                }
            }
            else
            {
                throw new UnsupportedOperationException("TODO");
            }
        }

        // Sign the auth success message.
        // This is required as AuthSuccess.buildSignedList has a `todo' tag now.
        manager.sign((AuthSuccess) messageResponse);
      } catch (MessageException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (ServerException e) {
        // TODO Auto-generated catch block
View Full Code Here

Examples of org.openid4java.server.ServerManager

    }
    
  }

  private String associate(HttpServletRequest request, HttpServletResponse response, ParameterList parameterList) throws IOException {
    ServerManager manager = ((SimpleServiceProxy)getServiceProxy()).getServerManager();
    HttpSession session = request.getSession();
    Message messageResponse;
    String responseText;
    // --- process an association parameterList ---
    messageResponse = manager.associationResponse(parameterList);
    responseText = messageResponse.keyValueFormEncoding();
    return directResponse(response, messageResponse.keyValueFormEncoding());
   
  }
View Full Code Here

Examples of org.openid4java.server.ServerManager

 

    @Override
    public void init(ServletConfig config) throws ServletException {
      super.init(config);
      _serviceProxy = new SimpleServiceProxy(new ServerManager());
    }
View Full Code Here

Examples of robobeans.ServerManager

        this(updateWorldHandler, playModeHandler, teamName, isGoalie, null);
    }

    public Agent(UpdateWordHandler updateWorldHandler, PlayModeHandler playModeHandler, String teamName, boolean isGoalie, Integer serverVersionNumber) throws Exception {
        this.handler = new RBAFWHandler(updateWorldHandler, playModeHandler);
        si = new ServerManager(handler);
        si.setTeamName(teamName);
        si.setIsgoalie(isGoalie);
        if (serverVersionNumber != null) {
            si.setServerVersionNumber(serverVersionNumber);
        }
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.