1.0.1 OpenID documentation improvement

Bug #512988 reported by AMcBain
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Status tracked in 1.0
1.0
Fix Released
Undecided
Unassigned
1.1
Fix Committed
Undecided
Unassigned

Bug Description

The 1.0.1 documentation for OpenID (Integrate with OpenID / OpenID Integration sections) doesn't cover a possible case of failure. It is possible that the call to OpenID.id(user).verify() in the existing example could return false. If it does (a bad user String was given, for example) Play! will just render a blank page, as no redirects or calls to render are made.

My solution was to do the following, and wrap the call in an if statement that does the same as the first case failure:

    public static void authenticate(String user) {
        if(OpenID.isAuthenticationResponse()) {
            UserInfo verifiedUser = OpenID.getVerifiedID();
            if(verifiedUser == null) {
                flash.put("error", "Oops, authentication failed.");
                login();
            }
            session.put("user", verifiedUser.id);
            index();
        } else {
            // verify call will redirect user on success
            if(!OpenID.id(user).verify()) {
                flash.put("error", "Oops, authentication failed.");
                login();
            }
        }
    }

AMcBain (mcbain-asm)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.