Keith Donald (Migrated from SEC-1505) said:

Something like this would be nice:

   @RequestMapping(value="/twitter", method=RequestMethod.GET)
    public String twitterConnectView(Authentication<GreenhouseUserDetails> auth) {
        if (isConnected(auth.getPrincipal())) {
            return "/settings/twitterConnected";
        } else {
            return "/settings/twitterConnect";
        }
    }

    private boolean isConnected(GreenhouseUserDetails principal) {
        return false;
    }

Comment From: spring-projects-issues

Keith Donald said:

What it looks like today:

@RequestMapping(value="/twitter", method=RequestMethod.GET)
public String twitterConnectView(Authentication auth) {
    if (isConnected((GreenhouseUserDetails) auth.getPrincipal())) {
        return "/settings/twitterConnected";
    } else {
        return "/settings/twitterConnect";
    }
}

Comment From: spring-projects-issues

Luke Taylor said:

Doing this properly will probably also involve changes to many of the interfaces which use Authentication, so deferring till 3.2.

Comment From: rwinch

I don't think we are going to do this because you can already use @AuthenticationPrincipal to resolve the principal without reference to the Authentication object. This is the preferred approach since you don't need to depend on any Spring Security classes.