Spring Social
  1. Spring Social
  2. SOCIAL-336

Connection Framework Support for Resource Owner Credentials Grant

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Enable connection framework support for ROCG. See SOCIAL-305.

        Activity

        Hide
        Craig Walls added a comment - - 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.

        Show
        Craig Walls added a comment - - 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.

          People

          • Assignee:
            Craig Walls
            Reporter:
            Craig Walls
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: