Package org.openid4java.message

Examples of org.openid4java.message.MessageException


            throws MessageException
    {
        SRegRequest req = new SRegRequest(params);

        if (! req.isValid())
            throw new MessageException("Invalid parameters for a SReg request");

        if (DEBUG)
            _log.debug("Created SReg request from parameter list:\n" + params);

        return req;
View Full Code Here


        try
        {
            new URL(policyUrl);
        } catch (MalformedURLException e)
        {
            throw new MessageException("Invalid policy_url: " + policyUrl);
        }

        if (DEBUG) _log.debug("Setting SReg request policy_url: " + policyUrl);

        _parameters.set(new Parameter("policy_url", policyUrl));
View Full Code Here

     */
    private void validate() throws MessageException
    {
        if (! _parameters.hasParameter("auth_policies"))
        {
            throw new MessageException(
                "auth_policies is required in a PAPE response.",
                OpenIDException.PAPE_ERROR);
        }

        String authTime = getAuthTime();
        if (authTime != null)
        {
            try
            {
                _dateFormat.parse(authTime);
            }
            catch (ParseException e)
            {
                throw new MessageException(
                    "Invalid auth_time in PAPE response: " + authTime,
                    OpenIDException.PAPE_ERROR, e);
            }
        }

        Iterator it = _parameters.getParameters().iterator();
        while (it.hasNext())
        {
            String paramName = ((Parameter) it.next()).getKey();

            if (PAPE_FIELDS.contains(paramName) ||  paramName.startsWith(PapeMessage.AUTH_LEVEL_NS_PREFIX))
                continue;

            if ( paramName.startsWith(AUTH_LEVEL_PREFIX) &&
                 (authLevelAliases.values().contains(paramName.substring(AUTH_LEVEL_PREFIX.length()))))
                continue;

            throw new MessageException(
                "Invalid parameter in PAPE response: " + paramName,
                OpenIDException.PAPE_ERROR);
        }
    }
View Full Code Here

            throws MessageException
    {
        SRegRequest req = new SRegRequest(params);

        if (! req.isValid())
            throw new MessageException("Invalid parameters for a SReg request");

        if (DEBUG)
            _log.debug("Created SReg request from parameter list:\n" + params);

        return req;
View Full Code Here

        try
        {
            new URL(policyUrl);
        } catch (MalformedURLException e)
        {
            throw new MessageException("Invalid policy_url: " + policyUrl);
        }

        if (DEBUG) _log.debug("Setting SReg request policy_url: " + policyUrl);

        _parameters.set(new Parameter("policy_url", policyUrl));
View Full Code Here

            throws MessageException
    {
        SRegResponse resp = new SRegResponse(params);

        if (! resp.isValid())
            throw new MessageException("Invalid parameters for a SReg response");

        if (DEBUG)
            _log.debug("Created SReg response from parameter list:\n" + params);

        return resp;
View Full Code Here

    public void addAttribute(String attr, String value) throws MessageException
    {
        _parameters.set(new Parameter(attr, value));

        if (! SREG_FIELDS.contains(attr))
            throw new MessageException("Invalid attribute for SReg: " + attr);

        if (DEBUG)
            _log.debug("Added new attribute to SReg response: " + attr +
                       " value: " + value);
    }
View Full Code Here

            throws MessageException
    {
        FetchResponse resp = new FetchResponse(params);

        if (! resp.isValid())
            throw new MessageException("Invalid parameters for a fetch response");

        if (DEBUG)
            _log.debug("Created fetch response from parameter list:\n" + params);

        return resp;
View Full Code Here

        {
            new URL(updateUrl);
        }
        catch (MalformedURLException e)
        {
            throw new MessageException("Invalid update_url: " + updateUrl);
        }

        if (DEBUG) _log.debug("Setting fetch response update_url: " + updateUrl);

        _parameters.set(new Parameter("update_url", updateUrl));
View Full Code Here

     */
    public void validate() throws MessageException
    {
        if (! _parameters.hasParameter("preferred_auth_policies"))
        {
            throw new MessageException(
                "preferred_auth_policies is required in a PAPE request.",
                OpenIDException.PAPE_ERROR);
        }

        Iterator it = _parameters.getParameters().iterator();
        while (it.hasNext())
        {
            String paramName = ((Parameter) it.next()).getKey();
            if (! PAPE_FIELDS.contains(paramName) && ! paramName.startsWith(PapeMessage.AUTH_LEVEL_NS_PREFIX))
            {
                throw new MessageException(
                    "Invalid parameter name in PAPE request: " + paramName,
                    OpenIDException.PAPE_ERROR);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.openid4java.message.MessageException

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.