All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cat_2.9.0-1.0.1.0.source-code.credentials.scala Maven / Gradle / Ivy

The newest version!
package hubcat

import dispatch._
import com.ning.http.client.RequestBuilder

sealed trait Credentials {
  def sign(req: RequestBuilder): RequestBuilder
}

case class OAuth2(access: String) extends Credentials {
  def sign(req: RequestBuilder) =
    req <:< Map("Authorization" -> "token %s".format(access))
}

case class BasicAuth(user: String, pass: String) extends Credentials {
  def sign(req: RequestBuilder) =
    req.as_!(user, pass)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy