Skip to content

Instantly share code, notes, and snippets.

@trane
Last active October 27, 2015 17:54
Show Gist options
  • Save trane/4bfe681455e2cf18d2a1 to your computer and use it in GitHub Desktop.
Save trane/4bfe681455e2cf18d2a1 to your computer and use it in GitHub Desktop.
trait LoginProvider {
val loginPath: Path // listen for POST on this
val location: String
def redirect: Response =
tap(Response(Status.Found))(_.location = location)
}
case class InternalLoginProvider(path: Path, hosts: String, loginPath: Path) extends LoginProvider {
val location = path.toString
val server = Http.newClient(hosts)
}
case class ExternalLoginProvider(url: URL, loginPath: Path) extends LoginProvider {
val location = url.toString
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment