[4.0.0] Impossible to instanciate OpenIDProvider

Hi,

I try to instancite a custom OpenIDProvider but when i try it i get this error message :

java.lang.NullPointerException
com.mohiva.play.silhouette.impl.providers.SocialProvider$class.$init$(SocialProvider.scala:57)

Someone can explain me ?

Hi,

could you please provide a bit more code?

Best regards,
Christian

Yep,

class AsfaliaProvider(val settings: OpenIDSettings, openIDService: OpenIDService) extends OpenIDProvider/* with OpenIDComponents*/ {
	val PROVIDER_ID = "Asfalia"

	override protected val service: OpenIDService = openIDService
		//new PlayOpenIDService(new WsOpenIdClient(WS.client, new WsDiscovery(WS.client)), settings)

	override type Self = AsfaliaProvider
	override protected val httpLayer: HTTPLayer = new PlayHTTPLayer(WS.client)(defaultContext)

	override def id: String = PROVIDER_ID

	//override def wsClient: WSClient = WS.client

	override protected def urls: Map[String, String] = Map()

	override type Content = Unit
	override type Profile = AsfaliaProfile

	override protected def buildProfile(authInfo: OpenIDInfo): Future[AsfaliaProfile] = {
		profileParser.parse((), authInfo)
	}

	override protected def profileParser: SocialProfileParser[Unit, AsfaliaProfile, OpenIDInfo] = new SocialProfileParser[Unit, AsfaliaProfile, OpenIDInfo] {
		override def parse(content: Unit, authInfo: OpenIDInfo): Future[AsfaliaProfile] = {
			Future.successful(AsfaliaProfile(LoginInfo(id, authInfo.id)))
		}
	}

	override def withSettings(f: OpenIDSettings => OpenIDSettings): AsfaliaProvider = this
}

case class AsfaliaProfile(loginInfo: LoginInfo) extends SocialProfile

and doing this cause null pointer exception :

val settings = OpenIDSettings(
				"localhost:8080/authorize?response_type=token&client_id=c1&scope=uid&state=whatever",
				"/api/v1/authproviders/asfalia"
			)

			new AsfaliaProvider(
				settings,
				new PlayOpenIDService(new WsOpenIdClient(WS.client, new WsDiscovery(WS.client)), settings)
			)

Do you reproduce my issue ?
When i try to instanciate another provider extening OpenIDProvider (e.g YahooProvider) that works.

Ok I find it.
It is because we must declare httpLayer as val in the constructor of the class and not override it in the body class.