Description

Activity

As I think over this some more, I'm not sure where direct support for password grant would fall within the connection framework or if it's even needed. All that's needed is to obtain an AccessGrant, create a Connection, and to save that Connection. If you have a connection factory and a connection repository in hand, it's these lines of code:

And, of course, handle DuplicateConnectionException or any HttpClientErrorException thrown in the process.

Although these 3 lines (plus catch blocks) could be wrapped up in a convenience method, where would that method live? It doesn't belong on the connection factory nor on the connection repository. For authorization code grant connections, this is split between ConnectController and ConnectSupport.

I suppose it could go into ConnectSupport, but that class is really intended as support for ConnectController or equivalent web component...password grant would be most likely performed on a native Android app and the web library wouldn't otherwise be needed.

I suppose I could create a new type to contain this simple 3 lines, but that seems overkill.

At the moment, I'm thinking that any effort to encapsulate those 3 lines is unnecessary and that the best solution would be to simply document how to handle password grant with Spring Social.

Craig Walls
added a comment - 20/Aug/13 12:17 PM - edited As I think over this some more, I'm not sure where direct support for password grant would fall within the connection framework or if it's even needed. All that's needed is to obtain an AccessGrant, create a Connection, and to save that Connection. If you have a connection factory and a connection repository in hand, it's these lines of code:
AccessGrant accessGrant = connectionFactory.getOAuthOperations().exchangeCredentialsForAccess(username, password, null );
Connection<?> connection = connectionFactory.createConnection(accessGrant);
connectionRepository.addConnection(connection);
And, of course, handle DuplicateConnectionException or any HttpClientErrorException thrown in the process.
Although these 3 lines (plus catch blocks) could be wrapped up in a convenience method, where would that method live? It doesn't belong on the connection factory nor on the connection repository. For authorization code grant connections, this is split between ConnectController and ConnectSupport.
I suppose it could go into ConnectSupport, but that class is really intended as support for ConnectController or equivalent web component...password grant would be most likely performed on a native Android app and the web library wouldn't otherwise be needed.
I suppose I could create a new type to contain this simple 3 lines, but that seems overkill.
At the moment, I'm thinking that any effort to encapsulate those 3 lines is unnecessary and that the best solution would be to simply document how to handle password grant with Spring Social.
At very least, I'm descoping this from 1.1.0.