jbufu / openid4java

Automatically exported from code.google.com/p/openid4java
Apache License 2.0
98 stars 58 forks source link

How to create a dumb mode or stateless consumer #204

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
            // perform discovery on the user-supplied identifier
            List discoveries = manager.discover(userSuppliedString);

            // attempt to associate with the OpenID provider
            // and retrieve one service endpoint for authentication
            DiscoveryInformation discovered = manager.associate(discoveries);

            // store the discovery information in the user's session
            httpReq.getSession().setAttribute("openid-disc", discovered);

            // obtain a AuthRequest message to be sent to the OpenID provider
            AuthRequest authReq = manager.authenticate(discovered, returnToUrl);

========================================================

How to create a dumb mode or stateless consumer without discovery and 
associate? 

thanks

Original issue reported on code.google.com by i...@chenxiaosheng.com on 16 Dec 2013 at 7:32

GoogleCodeExporter commented 9 years ago
Assciations are optional but discovery is required.

Forcing stateless mode can be done by setting following (before 
manager.associate() is called):

manager.setMaxAssocAttempts(0)

manager.associate() will in this case not attempt to associate and will return 
the first entry from the discoveries list. This should be passed later to 
manager.verify(), to avoid re-running discovery (which involves network calls) 
if possible.

Original comment by Johnny.B...@gmail.com on 17 Dec 2013 at 12:07