Announcement Announcement Module
Collapse
No announcement yet.
[Suggestion] Make more methods in core 'protected' / issue only want one providerUser Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Suggestion] Make more methods in core 'protected' / issue only want one providerUser

    Periodically I'm running into cases where I'd like to extend a class and add some functionality but often times the methods or instances I need access to are private.

    Currently, I'd like to override addConnection(...) in my own ConnectController for the following reason:

    I want to insure that when a connection is made that the FB id has not been in use previously and stored in the UserConnection table. This could occur in a situation where a user decides to login to the app with a different username/password and then tries to make a connection to a Facebook account that they previously already connected to a different userid with. (As described in another thread, the problem with this is when the user comes back and tries to signin with their facebookId- things will blow up since more than one userid would be returned and you'll get multipleusers back in handleSignIn of ProviderSigninController - another method which I think would benefit being protected.)

    I was looking for the best way to handle this, and it seems like the easiest solution is right before the 'addConnection' is called in the ConnectController, I go and simply try a quick delete call based on the providerUserId (which I can get from connection.getKey().getProviderUserId().) The current issue is I can't override addConnection since it's private.

    [ Another option is to modify ConnectController to allow for another interceptor that get's called right before addConnection, but after preConnect. That might just add more confusion though... seems easier to just let someone override addConnection if need be. ]

    Another option is that I could instead extend JdbcConnectionRepository addConnection (which is public), but since I've already extended ConnectController for some other needs, it would be nice to just extend that one class.
Working...
X