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

v3.0-M7 play2.5 #602

Closed tigaly closed 7 years ago

tigaly commented 7 years ago

Hello, @jaliss

Official Getting Start Document of SecureSocial is Outdated

How to configure route, play.plugins, securesocial.conf, Securing Actions and UserService?

thanks

tigaly commented 7 years ago

I make a project like the simple of 3.0-M7

but it has some errors:

! @73fdc6a99 - Internal server error, for (GET) [/] ->

play.api.UnexpectedException: Unexpected exception[ProvisionException: Unable to provision, see the following errors:

1) No implementation for securesocial.core.RuntimeEnvironment was bound.
  while locating securesocial.core.RuntimeEnvironment
    for parameter 1 at controllers.CustomLoginController.<init>(CustomLoginController.scala:12)
  while locating controllers.CustomLoginController
    for parameter 11 at router.Routes.<init>(Routes.scala:67)
  while locating router.Routes
  while locating play.api.inject.RoutesProvider
  while locating play.api.routing.Router
    for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:200)
  while locating play.api.http.JavaCompatibleHttpRequestHandler
  while locating play.api.http.HttpRequestHandler
    for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:221)
  at play.api.DefaultApplication.class(Application.scala:221)
  while locating play.api.DefaultApplication
  while locating play.api.Application

1 error]
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:180)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131)
    at scala.Option.map(Option.scala:146)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129)
    at scala.util.Success.flatMap(Try.scala:231)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:129)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:121)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) No implementation for securesocial.core.RuntimeEnvironment was bound.
  while locating securesocial.core.RuntimeEnvironment
    for parameter 1 at controllers.CustomLoginController.<init>(CustomLoginController.scala:12)
  while locating controllers.CustomLoginController
    for parameter 11 at router.Routes.<init>(Routes.scala:67)
  while locating router.Routes
  while locating play.api.inject.RoutesProvider
  while locating play.api.routing.Router
    for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:200)
  while locating play.api.http.JavaCompatibleHttpRequestHandler
  while locating play.api.http.HttpRequestHandler
    for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:221)
  at play.api.DefaultApplication.class(Application.scala:221)
  while locating play.api.DefaultApplication
  while locating play.api.Application

1 error
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
    at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405)
    at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:400)
    at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
    at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
    at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:164)
jaliss commented 7 years ago

@tigaly it seems you are not binding your RuntimeEnvironment properly. Did you define a module with the bindings and registered it in the application.conf file?

See https://github.com/jaliss/securesocial/blob/master/samples/scala/demo/app/DemoModule.scala and https://github.com/jaliss/securesocial/blob/master/samples/scala/demo/conf/application.conf#L13.

Let me know if this helps.

jaliss commented 7 years ago

BTW this is an old post but can clarify some things as well: http://www.filtercode.com/play/play-scala-securesocial. See the sample apps as well since some comments in that post might not be valid any more. Will try to update the docs soon.

tigaly commented 7 years ago

@jaliss thanks a lot

I miss "play.modules.enabled += "DemoModule"" in the application.conf....