FabianTerhorst / openid4java

openid4java
Apache License 2.0
1 stars 0 forks source link

ConsumerServlet producing invalid attribute exchange request #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. User consumer servlet to send a checkid_setup to an openid4java based 
provider
2. Call FetchRequest f = (FetchRequest) 
authRequest.getExtension(AxMessage.OPENID_NS_AX);
3. Set breakpoint in FecthRequest on line 277 _log.warn("One of 'required' or 
'if_available' parameters must be present.");

What is the expected output? What do you see instead?
Expected behavior is a valid ax-request. But instead consumer send ax-request 
without attribute to fetch.

What version of the product are you using? On what operating system?
openid4java-0.9.5

Please provide any additional information below.
Fix: 
    private void addAttributeExchangeToAuthRequest(HttpServletRequest httpReq,
            AuthRequest authReq) throws MessageException {
                .......
                // only add ax fetch request if there is at least one attribute to fetch.
        if (typeUris!=null && typeUris.length>0){
            authReq.addExtension(fetch);
        }
    }

Original issue reported on code.google.com by francis....@gmail.com on 6 Aug 2010 at 3:28

GoogleCodeExporter commented 9 years ago
FetchRequest (and most Message and MessageExtension subclases) have validation 
methods that can be used for this purpose by clients.

Original comment by Johnny.B...@gmail.com on 31 Oct 2012 at 11:43