I am using Play Framework 2.3.2 with Activator 1.2.3 and am experimenting with SecureSocial plugin master-SNAPSHOT.
Documentation says the following:
SecureSocial is designed in a modular architecture using plugins. This means you can easily enable/disable them to include only what you need and also that you can change the built-in plugins for your own implementation if there is a need to customize how things work.
Plugins are defined in the play.plugins file under the conf directory. If you don't have that file yet create one and add:
[example list of plugins]
Only the authentication providers you include in the play.plugins file will appear on the login page.
(Emphasis added.)
I am now trying out the Java Demo included in the SecureSocial repository. The play.plugins
file contains only a single row:
1500:com.typesafe.plugin.CommonsMailerPlugin
But if I run the demo, all the providers are available:
How do I turn off some providers? Based on the documentation I'd expect to comment out some lines in play.plugins
, but there are none to comment out.
What is going on here?
If the providers are not configured in the plugins file you must be using master-SNAPSHOT - instead of 2.1.3 - which does not use Play plugins anymore. Instead there is now a RuntimeEnvironment where you configure the services available for the module (including the UserService you need to implement).
The default environment includes all the providers and is what the demo uses: https://github.com/jaliss/securesocial/blob/master/samples/java/demo/app/service/MyEnvironment.scala
There a lot of changes in master and the docs have not been updated yet. To customize the providers available you need to create your own environment class extending RuntimeEnvironment.Default and override the providers field. For example:
class MyEnvironment extends RuntimeEnvironment.Default[DemoUser] {
override val userService: UserService[DemoUser] = new MyUserService()
override lazy val providers = ListMap(
include(
new FacebookProvider(routes, cacheService,oauth2ClientFor(FacebookProvider.Facebook))
),
include(
new FoursquareProvider(routes,cacheService,oauth2ClientFor(FoursquareProvider.Foursquare))
),
include(
new UsernamePasswordProvider[DemoUser](userService, avatarService, viewTemplates, passwordHashers)
)
)
}
Where MyUserService
is your UserService
implementation and DemoUser
is the class you want to use to represent users in your actions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With