Package org.openid4java.message

Examples of org.openid4java.message.ParameterList


     * @throws IdentityException
     */
    public String processRequest(HttpServletRequest request, HttpServletResponse response)
            throws IdentityException {

        ParameterList paramList = null;
        String responseText = null;
        HttpSession session = null;
        OpenIDAdminClient client = null;
        String cookie = null;
        ConfigurationContext configContext = null;
        String serverURL = null;

        if (request == null || response == null) {
            throw new IdentityException("Required attributes missing");
        }

        try {
            session = request.getSession();
            serverURL = CarbonUIUtil.getServerURL(session.getServletContext(), session);
            configContext = (ConfigurationContext) session.getServletContext().getAttribute(
                    CarbonConstants.CONFIGURATION_CONTEXT);
            cookie = (String) session.getAttribute(OpenIDAdminClient.OPENID_ADMIN_COOKIE);
            client = new OpenIDAdminClient(configContext, serverURL, cookie);

            if (OpenId.COMPLETE.equals(session.getAttribute(OpenId.ACTION))
                    || OpenId.CANCEL.equals(session.getAttribute(OpenId.ACTION))) {
                // Ready for authentication.
                paramList = (ParameterList) session.getAttribute(OpenId.PARAM_LIST);
            } else {
                // Extract the parameters from the request.Authentication not
                // completed.
                paramList = new ParameterList(request.getParameterMap());
            }

            if (paramList == null) {
                responseText = getErrorResponseText("Invalid OpenID authentication request");
                if (log.isDebugEnabled()) {
                    log.debug("Invalid OpenID authentication request :" + responseText);
                }
                directResponse(response, responseText);
                return null;
            }

            String mode = paramList.hasParameter(OpenId.ATTR_MODE) ? paramList
                    .getParameterValue(OpenId.ATTR_MODE) : null;

            if (log.isDebugEnabled()) {
                log.debug("OpenID authentication mode :" + mode);
            }
View Full Code Here


   * an HttpServletRequest.
   * @param req the HttpServletRequest
   * @return a ParameterList
   */
  public static ParameterList getParameterList(HttpServletRequest req) {
    return new ParameterList(req.getParameterMap());
  }
View Full Code Here

  public static AuthSuccess createAuthSuccessMessage(String opEndpoint,
      String returnTo, String nonce, String invalidateHandle,
      Association assoc) {

    ParameterList params = new ParameterList();

    params.set(new Parameter("openid.ns", Message.OPENID2_NS));
    params.set(new Parameter("openid.mode", AuthRequest.MODE_IDRES));

    AuthSuccess resp = new GenericAuthSuccess(params);

    resp.setOpEndpoint(opEndpoint);
    resp.setNonce(nonce);
View Full Code Here

  private String language = null;
  private UiMode mode = null;
  private Boolean icon = null;

  public ParameterList getParameters() {
    ParameterList list = new ParameterList();
    if (language != null) {
      list.set(new Parameter(UiMessage.LANG_KEY, language));
    }
    if (mode != null) {
      list.set(new Parameter(UiMessage.MODE_KEY, mode.getMode()));
    }
    if (icon != null) {
      list.set(new Parameter(UiMessage.ICON_KEY, icon.toString()));
    }
    return list;
  }
View Full Code Here

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    HttpSession session = req.getSession();
    ParameterList openidResp = Step2.getParameterList(req);
    String receivingUrl = Step2.getUrlWithQueryString(req);
    DiscoveryInformation discovered =
      (DiscoveryInformation) session.getAttribute("discovered");

    String requestToken = NO_TOKEN;
View Full Code Here

      ":" + httpReq.getServerPort() + "/step2-example-provider/";
    manager.setOPEndpointUrl(endpoint);

    HttpSession session = httpReq.getSession();
    // extract the parameters from the request
    ParameterList requestParams;
    if ("complete".equals(httpReq.getParameter("_action"))) {
      requestParams = (ParameterList) session.getAttribute("parameterlist");
    } else {
      requestParams = new ParameterList(httpReq.getParameterMap());
    }

    String mode = requestParams.getParameterValue("openid.mode");
    StringBuffer responseText = new StringBuffer();
    Message responseMessage;

    if ("associate".equals(mode)) {
      // --- process an association request ---
View Full Code Here

        try {
            log.setLevel(Level.FINEST);
            Logger.getLogger("").setLevel(Level.FINEST);
            // extract the parameters from the authentication response
            // (which comes in as a HTTP request from the OpenID provider)
            ParameterList response = new ParameterList(getQuery()
                    .getValuesMap());
            log.info("response = " + response);

            // retrieve the previously stored discovery information
            log.info("GET COOKIES");
View Full Code Here

            Request request, Response resp) {
        Logger l = Context.getCurrentLogger();
        try {
            // extract the parameters from the authentication response
            // (which comes in as a HTTP request from the OpenID provider)
            ParameterList response = new ParameterList(params.getValuesMap());
            l.info("response = " + response);

            // retrieve the previously stored discovery information
            l.info("GET COOKIES");
            String openidDisc = request.getCookies().getFirstValue(
View Full Code Here

    }

    @Post("form")
    public Representation represent(Representation input) {
        Form f = new Form(input);
        return handle(new ParameterList(f.getValuesMap()));
    }
View Full Code Here

    }

    @Get("form")
    public Representation represent() {

        return handle(new ParameterList(getQuery().getValuesMap()));
    }
View Full Code Here

TOP

Related Classes of org.openid4java.message.ParameterList

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.