jaliss / securesocial

A module that provides OAuth, OAuth2 and OpenID authentication for Play Framework applications
http://www.securesocial.ws
Apache License 2.0
1.19k stars 510 forks source link

Change UserService trait to use the GenericProfile trait as the user type, instead of locking in the BasicProfile case class #545

Open pkaeding opened 9 years ago

pkaeding commented 9 years ago

Since it isn't possible to subclass a case class, and implementors may have a different structure for users than the BasicProfile, and in general, it is best to stick to the Robustness Principle (and I'm guessing this is why the GenericProfile trait exists in the first place?)

In my case, I needed this because I am migrating from an old version of SecureSocial, where the IdentityId was a thing. I didn't want to migrate all of my user records in mongo, or tack on a transformation step in my DB layer. I imagine others may have other reasons for wanting to have the freedom to implement GenericProfile differently.

Of course, implementors are still free to just use BasicProfile.