Announcement Announcement Module
No announcement yet.
Social without MVC Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Social without MVC


    I am starting to work with social networks and I found 2 frameworks to use.

    I have finish testing the other framework and now I am starting to test this one, the advantage that I found in first place for using this one is that my web is working with spring-security already. But the main disadvantage that I found is that as far as I understood social uses spring-web what makes me use a MVC wen pattern. My application is not working with MVC pattern so I will like to know if there is any chance to use the social framework without working with MVC Pattern.

    Thanks in advance.

  • #2
    Spring Social's ConnectController and ProviderSignInController are Spring MVC controllers, so if you'd like to use those, you'll need at least enough Spring MVC in your app to support those controllers.

    That said, you aren't required to use those controllers if you don't want to. Those controllers simply handle the redirect and callback portions of the OAuth 1 and OAuth 2 connection flows; the bulk of Spring Social happens outside of those controllers in the connection factories, OAuth templates, and API bindings which have nothing to do with Spring MVC. Therefore, I see no reason why you couldn't mimic what those controllers do in any other web framework.


    • #3
      Thanks for the answer habuma, the thing is that I am trying to follow the example and I got dizzy with interceptors and the controllers and all those things.
      I am using spring-security in my app for the login already, I will be needing to make the social fmk work with that.
      I have found these 2 options:


      These maybe fit more to my application architecture anyways I wil have to read more and understand the whole thing better .



      • #4
        FWIW, one of the things on the roadmap for a Spring Social 1.1 release (no date set yet) would be tighter integration with Spring Security. I'll be considering a few existing implementations and trying to find the best fit for it in Spring Social. But as I said, there is no date set on a 1.1 release yet, so I can't promise any specifics...just know that it is part of the plan.


        • #5
          Hi Kadorrna, Habuma
          I am facing exactly the same situation. I use spring-security without MVC and I need to use Oauth (mainly facebook).

          If you know any easy of doing this, please do let know. I did check spring-secuirty-social and its not compatible with latest release of spring-oauth.

          How tricky it would be to use spring-social for this?



          • #6
            Well, as I said, tighter integration with Spring Security is still on the 1.1.0 roadmap, but I've had other priorities prevent me from making much progress in that area. I'm hoping to get some more focused time to move forward on this in the near future, though. In the meantime, I'm always willing to receive contributions from the community if anyone has this sorted out already (or wants to update the existing solutions to work with the latest stuff).

            There's also the option of building non-Spring MVC equivalents of ConnectController and ProviderSignInController. These controllers *primarily* handle redirects to/from a provider, but delegate the harder parts of OAuth to ort which depends on a few Spring MVC support classes, but otherwise doesn't require you to use Spring MVC. Depending on what web framework you're using, you could develop equivalents of those controllers that call on ConnectSupport to handle the heavy lifting. If you do this, then you'd be using Spring Social for everything except for those redirects.

            If I may ask, what are you using if not Spring MVC? I'm assuming it's a web framework, but I suppose it's possible that you're not doing web at all and it's a standalone app or a desktop app.


            • #7
              Thanks for the reply. Our's is mainly REST application (we use jersey). We dont use any of the MVC framework.


              • #8
                When you say it's a "REST application", do you mean that your application exposes a REST API?

                If so, then how do you anticipate obtaining an access token on behalf of your users (who I assume are actually users of some application that is consuming your REST API)? Since most FB API calls are performed on behalf of a user, you'll need a way to obtain an access token for that user, authorized by that user. Since you're exposing a REST API which isn't consumed by a user, this can be tricky.

                One way is to actually expose a human-facing web application where a user signs up and authorizes your app; during which time you obtain the access token. But it may seem awkward for a user to do that if they're not actually touching your application for any other reason.

                Another approach is to have the application that consumes your REST API handle the OAuth flow and then hand the access token off to your REST API to create a connection and for the backend to consume Facebook's Graph API. How the consumer gets that access token is largely dependent on what type of client you're dealing with (ultimately there *must* be human involvement...what is that? a web app? a desktop app? a mobile app?). In this case, there's nothing directly supporting this scenario in Spring Social, but once the server-side has the access token, you can use it to create a Connection and then save it via a ConnectionRepository.

                Again, there are a lot of things I don't know about your app, so I'm only able to describe how it might work in generalities. Tell me who is consuming your REST API and I'll have a better idea of what you should do.