mirror of
https://github.com/ysoftdevs/odc-analyzer.git
synced 2026-01-15 08:14:02 +01:00
18 lines
606 B
Scala
18 lines
606 B
Scala
package services
|
|
|
|
import play.api.libs.json.Json
|
|
import play.api.libs.ws.{WS, WSClient}
|
|
|
|
import scala.concurrent.{Future, ExecutionContext}
|
|
|
|
class ExternalCredentialsVerificationService(url: String)(implicit executionContext: ExecutionContext, wSClient: WSClient) extends CredentialsVerificationService{
|
|
override def verifyCredentials(username: String, password: String): Future[Boolean] = {
|
|
WS.clientUrl(url).post(Json.toJson(Map("username" -> username, "password" -> password))).map{ response =>
|
|
response.body match {
|
|
case "OK" => true
|
|
case "bad" => false
|
|
}
|
|
}
|
|
}
|
|
}
|