When I tried to override and slightly modify the implementation of OAuth2Controller#login, I couldn't use OAuth2StateKey in the subclass since it is private val. Should it be protected?
class MyOAuth2Controller extends OAuth2Controller {
...
// want to add some optional parameters but currently not supported.
override def login(scope: String, optionalParam: String /* 👈 */) = AsyncStack(ExecutionContextKey -> OAuthExecutionContext) { implicit request =>
implicit val ec = StackActionExecutionContext
doSomethingGood(optionalParam)
loggedIn match {
case Some(u) =>
loginSucceeded(request)
case None =>
val state = UUID.randomUUID().toString
Future.successful(
Redirect(authenticator.getAuthorizationUrl(scope, state)).withSession(
request.session + (OAuth2StateKey /* Oops, it's private ❗️ */ -> state)
)
)
}
}
https://github.com/t2v/play2-auth/blob/master/social/src/main/scala/jp/t2v/lab/play2/auth/social/core/OAuth2Controller.scala#L18
When I tried to override and slightly modify the implementation of
OAuth2Controller#login
, I couldn't use OAuth2StateKey in the subclass since it is private val. Should it be protected?