Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth2Controller#OAuth2StateKey should be protected val #161

Closed
tototoshi opened this issue Nov 27, 2015 · 2 comments
Closed

OAuth2Controller#OAuth2StateKey should be protected val #161

tototoshi opened this issue Nov 27, 2015 · 2 comments

Comments

@tototoshi
Copy link
Contributor

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?

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)
          )
        )
    }
  }
@gakuzzzz
Copy link
Member

gakuzzzz commented Mar 8, 2016

I understood the motivation. I change it to protected

gakuzzzz added a commit that referenced this issue Mar 8, 2016
@gakuzzzz
Copy link
Member

gakuzzzz commented Mar 8, 2016

done, I'll publish it.

@gakuzzzz gakuzzzz closed this as completed Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants