Package org.openid4java.message

Examples of org.openid4java.message.ParameterList


    public String verifyResponse(HttpServletRequest httpReq)
    {
        try {
            // extract the parameters from the authentication response
            // (which comes in as a HTTP request from the OpenID provider)
            ParameterList response =
                new ParameterList(httpReq.getParameterMap());
         
            // extract the receiving URL from the HTTP request
            StringBuffer receivingURL = httpReq.getRequestURL();
            String queryString = httpReq.getQueryString();
            if (queryString != null && queryString.length() > 0)
View Full Code Here


    }

    public OpenIDAuthenticationToken endConsumption(HttpServletRequest request) throws OpenIDConsumerException {
        // extract the parameters from the authentication response
        // (which comes in as a HTTP request from the OpenID provider)
        ParameterList openidResp = new ParameterList(request.getParameterMap());

        // retrieve the previously stored discovery information
        DiscoveryInformation discovered = (DiscoveryInformation) request.getSession().getAttribute(DISCOVERY_INFO_KEY);

        if (discovered == null) {
View Full Code Here

   {
      try
      {
         // extract the parameters from the authentication response
         // (which comes in as a HTTP request from the OpenID provider)
         ParameterList parameterList = new ParameterList(httpRequest.getParameterMap());

         // retrieve the previously stored discovery information
         DiscoveryInformation discovered = openIdRequest.getDiscoveryInformation();
         if (discovered == null)
         {
View Full Code Here

   @Inject
   private Instance<OpenIdProviderBean> opBean;

   public void handleIncomingMessage(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws InvalidRequestException
   {
      ParameterList parameterList = new ParameterList(httpRequest.getParameterMap());

      String mode = parameterList.getParameterValue("openid.mode");

      Message associationResponse;

      if ("associate".equals(mode))
      {
         associationResponse = openIdServerManager.get().associationResponse(parameterList);
         writeMessageToResponse(associationResponse, httpResponse);
      }
      else if ("checkid_setup".equals(mode) || "checkid_immediate".equals(mode))
      {
         dialogueManager.beginDialogue();
         String claimedIdentifier = parameterList.getParameterValue("openid.claimed_id");
         String opLocalIdentifier = parameterList.getParameterValue("openid.identity");

         openIdProviderRequest.get().setParameterList(parameterList);
         openIdProviderRequest.get().setClaimedIdentifier(claimedIdentifier);

         MessageExtension ext = null;
         try
         {
            AuthRequest authReq = AuthRequest.createAuthRequest(parameterList, openIdServerManager.get().getRealmVerifier());
            if (authReq.hasExtension(AxMessage.OPENID_NS_AX))
            {
               ext = authReq.getExtension(AxMessage.OPENID_NS_AX);
            }
         }
         catch (MessageException e)
         {
            throw new RuntimeException(e);
         }

         if (ext instanceof FetchRequest)
         {
            FetchRequest fetchRequest = (FetchRequest) ext;

            List<OpenIdRequestedAttribute> requestedAttributes = new LinkedList<OpenIdRequestedAttribute>();
            handleAttributeRequests(fetchRequest, requestedAttributes, false);
            handleAttributeRequests(fetchRequest, requestedAttributes, true);
            openIdProviderRequest.get().setRequestedAttributes(requestedAttributes);
            openIdProviderRequest.get().setFetchRequest(fetchRequest);
         }

         if (claimedIdentifier != null && opLocalIdentifier != null)
         {
            boolean immediate = "checkid_immediate".equals(mode);
            String realm = parameterList.getParameterValue("openid.realm");
            if (realm == null)
            {
               realm = parameterList.getParameterValue("openid.return_to");
            }

            if (opLocalIdentifier.equals(AuthRequest.SELECT_ID))
            {
               openIdProviderSpi.get().authenticate(realm, null, immediate, responseHandler.createResponseHolder(httpResponse));
View Full Code Here

      }
   }

   public void sendAuthenticationResponse(boolean authenticationSuccesful, Map<String, List<String>> attributeValues, HttpServletResponse response)
   {
      ParameterList parameterList = openIdProviderRequest.get().getParameterList();
      String userName = openIdProviderRequest.get().getUserName();
      String opLocalIdentifier = opBean.get().getOpLocalIdentifierForUserName(userName);
      String claimedIdentifier = openIdProviderRequest.get().getClaimedIdentifier();
      if (claimedIdentifier.equals(AuthRequest.SELECT_ID))
      {
View Full Code Here

     * get authentication response from OpenID Provider
     */
    public void parseAuthResponse(HttpServletRequest request, HttpServletResponse response){
        try {
            HttpSession session = request.getSession();
            ParameterList openidResp = new ParameterList(request.getParameterMap());
           
            DiscoveryInformation discovered = (DiscoveryInformation)session.getAttribute("discovered");
            session.removeAttribute("discovered");

            StringBuffer receivingURL = request.getRequestURL();
View Full Code Here

   
    private Identifier verifyResponse(final HttpServletRequest request) {
        try {
            // extract the parameters from the authentication response
            // (which comes in as a HTTP request from the OpenID provider)
            final ParameterList response = new ParameterList(request.getParameterMap());
            // retrieve the previously stored discovery information
            final DiscoveryInformation discovered = (DiscoveryInformation) request.getSession().getAttribute("openid-disc");

            // extract the receiving URL from the HTTP request
            final StringBuffer receivingURL = request.getRequestURL();
View Full Code Here

     * @throws IdentityProviderException
     */
    public ParameterList buildHeader(String openID, String opAddress, String appliesTo)
            throws IdentityProviderException {

        ParameterList params = null;

        params = new ParameterList();
        this.nonce = getNonce();
        this.returnTo = appliesTo;
        this.openID = openID;
        this.opAdress = opAddress;

        params.set(new Parameter(IdentityConstants.OpenId.ATTR_NS,
                IdentityConstants.OpenId.OPENID_URL));
        params.set(new Parameter(IdentityConstants.OpenId.ATTR_OP_ENDPOINT, opAddress));
        params.set(new Parameter(IdentityConstants.OpenId.ATTR_CLAIM_ID, openID));
        params.set(new Parameter(IdentityConstants.OpenId.ATTR_RESPONSE_NONCE, nonce));
        params.set(new Parameter(IdentityConstants.OpenId.ATTR_MODE, "id_res"));
        params.set(new Parameter(IdentityConstants.OpenId.ATTR_IDENTITY, openID));
        params.set(new Parameter(IdentityConstants.OpenId.ATTR_RETURN_TO, appliesTo));

        try {
            this.assoc = getAssocHandle();
            params
                    .set(new Parameter(IdentityConstants.OpenId.ATTR_ASSOC_HANDLE, assoc
                            .getHandle()));
            if (log.isDebugEnabled()) {
                log.debug("Association generated :::::" + assoc.getHandle());
            }
        } catch (AssociationException e) {
            log.error("Failed to retreive assoc handle while building OpenID InfoCard header", e);
            throw new IdentityProviderException(e.getMessage());
        }

        params.set(new Parameter(IdentityConstants.OpenId.ATTR_SIGNED,
                "op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle"));

        try {
            params.set(new Parameter(IdentityConstants.OpenId.ATTR_SIG, getSignature(false)));
        } catch (AssociationException e) {
            throw new IdentityProviderException(e.getMessage());
        } catch (MessageException msgEx) {
            throw new IdentityProviderException(msgEx.getMessage());
        }
View Full Code Here

     * @throws IdentityException
     */
    public OpenIDDTO validateOpenIDAuthentication(HttpServletRequest request)
            throws IdentityException {

        ParameterList response = null;
        AuthSuccess authSuccess = null;
        String mode = null;
        OpenIDExtension extension = null;
        List<ClaimDTO> claimList = null;
        OpenIDDTO openID = null;

        try {
            // Extract the parameters from the authentication response
            // (which comes in as a HTTP request from the OpenID provider)
            response = new ParameterList(request.getParameterMap());

            mode = response.getParameterValue(IdentityConstants.OpenId.ATTR_MODE);

            if (mode != null && IdentityConstants.OpenId.CANCEL.equals(mode)) {
                // User has denied sending his profile info :(
                throw new IdentityException("User has denied sending his profile info");
            }
View Full Code Here

     */
    protected OMElement createOpenIdToken(OMElement rstrElem) throws IdentityProviderException {
        OMElement rdt = null;
        OpenIDInfoCardToken token = null;
        Message message = null;
        ParameterList params = null;
        String claimID = null;
        OpenIDInfoCardHeader header = null;

        rdt = IdentityProviderUtil.createOpenIdToken(rstrElem, ipData);
        header = new OpenIDInfoCardHeader(OpenIDProvider.getInstance().getManager());
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.