mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 14:06:56 +00:00
Merge pull request #2223 from constantine2nd/develop
A few features and bug
This commit is contained in:
commit
f0e3bb425a
@ -403,9 +403,12 @@ trait OBPRestHelper extends RestHelper with MdcLoggable {
|
||||
val (usr, callContext) = getUserAndCallContext(cc)
|
||||
usr match {
|
||||
case Full(u) => fn(callContext.copy(user = Full(u))) // Authentication is successful
|
||||
case Empty => fn(cc.copy(user = Empty)) // Anonymous access
|
||||
case ParamFailure(a, b, c, apiFailure : APIFailure) => ParamFailure(a, b, c, apiFailure : APIFailure)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
case _ => Failure("oauth error")
|
||||
case unhandled =>
|
||||
logger.debug(unhandled)
|
||||
Failure("oauth error")
|
||||
}
|
||||
} else if (hasAnOAuth2Header(authorization)) {
|
||||
val (user, callContext) = OAuth2Login.getUser(cc)
|
||||
@ -413,9 +416,12 @@ trait OBPRestHelper extends RestHelper with MdcLoggable {
|
||||
case Full(u) =>
|
||||
AuthUser.refreshUser(u, callContext)
|
||||
fn(cc.copy(user = Full(u))) // Authentication is successful
|
||||
case Empty => fn(cc.copy(user = Empty)) // Anonymous access
|
||||
case ParamFailure(a, b, c, apiFailure : APIFailure) => ParamFailure(a, b, c, apiFailure : APIFailure)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
case _ => Failure("oauth error")
|
||||
case unhandled =>
|
||||
logger.debug(unhandled)
|
||||
Failure("oauth error")
|
||||
}
|
||||
}
|
||||
// Direct Login Deprecated i.e Authorization: DirectLogin token=eyJhbGciOiJIUzI1NiJ9.eyIiOiIifQ.Y0jk1EQGB4XgdqmYZUHT6potmH3mKj5mEaA9qrIXXWQ
|
||||
|
||||
@ -1254,6 +1254,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
* @return List(HTTPParam("from_date","$DateWithMsExampleString"),HTTPParam("to_date","$DateWithMsExampleString"))
|
||||
*/
|
||||
def createHttpParamsByUrl(httpRequestUrl: String): Box[List[HTTPParam]] = {
|
||||
val sleep = getHttpRequestUrlParam(httpRequestUrl,"sleep")
|
||||
val sortDirection = getHttpRequestUrlParam(httpRequestUrl,"sort_direction")
|
||||
val fromDate = getHttpRequestUrlParam(httpRequestUrl,"from_date")
|
||||
val toDate = getHttpRequestUrlParam(httpRequestUrl,"to_date")
|
||||
@ -1300,6 +1301,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
HTTPParam("include_url_patterns", includeUrlPattern),
|
||||
HTTPParam("include_implemented_by_partial_functions", includeImplementedByPartialfunctions),
|
||||
HTTPParam("function_name", functionName),
|
||||
HTTPParam("sleep", sleep),
|
||||
HTTPParam("currency", currency),
|
||||
HTTPParam("amount", amount),
|
||||
HTTPParam("bank_id", bankId),
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package code.api.v5_1_0
|
||||
|
||||
|
||||
import java.io
|
||||
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.{apiCollectionJson400, apiCollectionsJson400, apiInfoJson400, postApiCollectionJson400, revokedConsentJsonV310}
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.util.APIUtil._
|
||||
@ -31,8 +33,10 @@ import com.openbankproject.commons.model.enums.AtmAttributeType
|
||||
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion}
|
||||
import net.liftweb.common.Full
|
||||
import net.liftweb.http.S
|
||||
import net.liftweb.http.provider.HTTPParam
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.mapper.By
|
||||
import net.liftweb.util.Helpers.tryo
|
||||
|
||||
import scala.collection.immutable.{List, Nil}
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
@ -77,9 +81,44 @@ trait APIMethods510 {
|
||||
|
||||
def root (apiVersion : ApiVersion, apiVersionStatus: String) : OBPEndpoint = {
|
||||
case (Nil | "root" :: Nil) JsonGet _ => {
|
||||
cc => Future {
|
||||
JSONFactory510.getApiInfoJSON(apiVersion,apiVersionStatus) -> HttpCode.`200`(cc.callContext)
|
||||
}
|
||||
cc =>
|
||||
for {
|
||||
_ <- Future() // Just start async call
|
||||
} yield {
|
||||
(JSONFactory510.getApiInfoJSON(apiVersion,apiVersionStatus), HttpCode.`200`(cc.callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
waitingForGodot,
|
||||
implementedInApiVersion,
|
||||
nameOf(waitingForGodot),
|
||||
"GET",
|
||||
"/waiting-for-godot",
|
||||
"Waiting For Godot",
|
||||
"""Waiting For Godot
|
||||
|
|
||||
|Uses query parameter "sleep" in milliseconds.
|
||||
|For instance: .../waiting-for-godot?sleep=50 means postpone response in 50 milliseconds.
|
||||
|""".stripMargin,
|
||||
EmptyBody,
|
||||
WaitingForGodotJsonV510(sleep_in_milliseconds = 50),
|
||||
List(UnknownError, "no connector set"),
|
||||
apiTagApi :: apiTagNewStyle :: Nil)
|
||||
|
||||
lazy val waitingForGodot: OBPEndpoint = {
|
||||
case "waiting-for-godot" :: Nil JsonGet _ => {
|
||||
cc =>
|
||||
for {
|
||||
httpParams <- NewStyle.function.extractHttpParamsFromUrl(cc.url)
|
||||
} yield {
|
||||
val sleep: String = httpParams.filter(_.name == "sleep").headOption
|
||||
.map(_.values.headOption.getOrElse("0")).getOrElse("0")
|
||||
val sleepInMillis: Long = tryo(sleep.trim.toLong).getOrElse(0)
|
||||
Thread.sleep(sleepInMillis)
|
||||
(JSONFactory510.waitingForGodot(sleepInMillis), HttpCode.`200`(cc.callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +56,7 @@ case class APIInfoJsonV510(
|
||||
energy_source : EnergySource400,
|
||||
resource_docs_requires_role: Boolean
|
||||
)
|
||||
case class WaitingForGodotJsonV510(sleep_in_milliseconds: Long)
|
||||
|
||||
case class CertificateInfoJsonV510(
|
||||
subject_domain_name: String,
|
||||
@ -195,6 +196,8 @@ case class AtmAttributesResponseJsonV510(atm_attributes: List[AtmAttributeRespon
|
||||
|
||||
|
||||
object JSONFactory510 {
|
||||
|
||||
def waitingForGodot(sleep: Long): WaitingForGodotJsonV510 = WaitingForGodotJsonV510(sleep)
|
||||
|
||||
def createAtmsJsonV510(atmAndAttributesTupleList: List[(AtmT, List[AtmAttribute])] ): AtmsJsonV510 = {
|
||||
AtmsJsonV510(atmAndAttributesTupleList.map(
|
||||
|
||||
@ -27,6 +27,7 @@ TESOBE (http://www.tesobe.com/)
|
||||
package code.snippet
|
||||
|
||||
import java.util
|
||||
|
||||
import code.api.{Constant, DirectLogin}
|
||||
import code.api.util.{APIUtil, ErrorMessages, X509}
|
||||
import code.consumer.Consumers
|
||||
@ -41,7 +42,6 @@ import net.liftweb.util.Helpers._
|
||||
import net.liftweb.util.{CssSel, FieldError, Helpers}
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.codehaus.jackson.map.ObjectMapper
|
||||
import sh.ory.hydra.model.OAuth2Client
|
||||
|
||||
import scala.collection.immutable.{List, ListMap}
|
||||
import scala.jdk.CollectionConverters.seqAsJavaListConverter
|
||||
@ -127,17 +127,19 @@ class ConsumerRegistration extends MdcLoggable {
|
||||
"#register-consumer-success" #> ""
|
||||
}
|
||||
|
||||
def createHydraClient(consumer: Consumer): Option[OAuth2Client] = {
|
||||
def showResults(consumer : Consumer) = {
|
||||
val urlOAuthEndpoint = Constant.HostName + "/oauth/initiate"
|
||||
val urlDirectLoginEndpoint = Constant.HostName + "/my/logins/direct"
|
||||
val jwksUri = jwksUriVar.is
|
||||
val jwks = jwksVar.is
|
||||
|
||||
var jwkPrivateKey: String = s"Please change this value to ${if (StringUtils.isNotBlank(jwksUri)) "jwks_uri" else "jwks"} corresponding private key"
|
||||
val jwsAlg = signingAlgVar.is
|
||||
var jwkPrivateKey: String = s"Please change this value to ${if(StringUtils.isNotBlank(jwksUri)) "jwks_uri" else "jwks"} corresponding private key"
|
||||
// In case we use Hydra ORY as Identity Provider we create corresponding client at Hydra side a well
|
||||
if (HydraUtil.integrateWithHydra) {
|
||||
if(HydraUtil.integrateWithHydra) {
|
||||
HydraUtil.createHydraClient(consumer, oAuth2Client => {
|
||||
val signingAlg = signingAlgVar.is
|
||||
|
||||
if (oidcCheckboxVar.is == false) {
|
||||
if(oidcCheckboxVar.is == false) {
|
||||
// TODO Set token_endpoint_auth_method in accordance to the Consumer.AppType value
|
||||
// Consumer.AppType = Confidential => client_secret_post
|
||||
// Consumer.AppType = Public => private_key_jwt
|
||||
@ -146,8 +148,8 @@ class ConsumerRegistration extends MdcLoggable {
|
||||
} else {
|
||||
oAuth2Client.setTokenEndpointAuthMethod(HydraUtil.clientSecretPost)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
oAuth2Client.setTokenEndpointAuthSigningAlg(signingAlg)
|
||||
oAuth2Client.setRequestObjectSigningAlg(signingAlg)
|
||||
|
||||
@ -155,34 +157,25 @@ class ConsumerRegistration extends MdcLoggable {
|
||||
new ObjectMapper().readValue(jwksJson, classOf[util.Map[String, _]])
|
||||
|
||||
val requestUri = requestUriVar.is
|
||||
if (StringUtils.isAllBlank(jwksUri, jwks)) {
|
||||
val (privateKey, publicKey) = HydraUtil.createJwk(signingAlg)
|
||||
if(StringUtils.isAllBlank(jwksUri, jwks)) {
|
||||
val(privateKey, publicKey) = HydraUtil.createJwk(signingAlg)
|
||||
jwkPrivateKey = privateKey
|
||||
val jwksJson = s"""{"keys": [$publicKey]}"""
|
||||
val jwksMap = toJson(jwksJson)
|
||||
oAuth2Client.setJwks(jwksMap)
|
||||
} else if (StringUtils.isNotBlank(jwks)) {
|
||||
} else if(StringUtils.isNotBlank(jwks)){
|
||||
val jwksMap = toJson(jwks)
|
||||
oAuth2Client.setJwks(jwksMap)
|
||||
} else if (StringUtils.isNotBlank(jwksUri)) {
|
||||
} else if(StringUtils.isNotBlank(jwksUri)){
|
||||
oAuth2Client.setJwksUri(jwksUri)
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(requestUri)) {
|
||||
if(StringUtils.isNotBlank(requestUri)) {
|
||||
oAuth2Client.setRequestUris(List(requestUri).asJava)
|
||||
}
|
||||
oAuth2Client
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
def showResults(consumer : Consumer) = {
|
||||
val urlOAuthEndpoint = Constant.HostName + "/oauth/initiate"
|
||||
val urlDirectLoginEndpoint = Constant.HostName + "/my/logins/direct"
|
||||
val jwsAlg = signingAlgVar.is
|
||||
val (jwkPrivateKey, _) = HydraUtil.createJwk(signingAlgVar.is)
|
||||
val registerConsumerSuccessMessageWebpage = getWebUiPropsValue(
|
||||
"webui_register_consumer_success_message_webpage",
|
||||
"Thanks for registering your consumer with the Open Bank Project API! Here is your developer information. Please save it in a secure location.")
|
||||
@ -248,16 +241,12 @@ class ConsumerRegistration extends MdcLoggable {
|
||||
}
|
||||
}
|
||||
|
||||
def showRegistrationResults(consumer : Consumer) = {
|
||||
// Create client at ORY Hydra side and update our consumer with a new Client ID
|
||||
val updatedConsumer = createHydraClient(consumer).flatMap { c =>
|
||||
Consumers.consumers.vend
|
||||
.updateConsumer(consumer.id.get,Some(c.getClientId),None,None,None,None,None,None,None,None)
|
||||
}.getOrElse(consumer)
|
||||
def showRegistrationResults(result : Consumer) = {
|
||||
|
||||
notifyRegistrationOccurred(updatedConsumer)
|
||||
sendEmailToDeveloper(updatedConsumer)
|
||||
showResults(updatedConsumer)
|
||||
notifyRegistrationOccurred(result)
|
||||
sendEmailToDeveloper(result)
|
||||
|
||||
showResults(result)
|
||||
}
|
||||
|
||||
def showErrors(errors : List[FieldError]) = {
|
||||
|
||||
@ -64,7 +64,7 @@ class PaymentOTP extends MdcLoggable with RestHelper with APIMethods400 {
|
||||
|
||||
val form = "form" #> {
|
||||
"#otp_input" #> SHtml.textElem(otpVar) &
|
||||
"type=submit" #> SHtml.submit("Send OTP", () => submitButtonDefense)
|
||||
"type=submit" #> SHtml.submit("Submit OTP", () => submitButtonDefense)
|
||||
}
|
||||
|
||||
def PaymentOTP = {
|
||||
|
||||
@ -77,8 +77,7 @@ object HydraUtil extends MdcLoggable{
|
||||
return None
|
||||
}
|
||||
val oAuth2Client = new OAuth2Client()
|
||||
// ORY Hydra: It is no longer possible to set an OAuth2 Client ID as a user. The system will generate a unique ID for you.
|
||||
// oAuth2Client.setClientId(consumer.key.get)
|
||||
oAuth2Client.setClientId(consumer.key.get)
|
||||
oAuth2Client.setClientSecret(consumer.secret.get)
|
||||
oAuth2Client.setClientName(consumer.name.get)
|
||||
|
||||
|
||||
@ -29,7 +29,11 @@ Berlin 13359, Germany
|
||||
|
||||
<div data-lift="surround?with=default;at=content">
|
||||
<div data-lift="PaymentOTP.validateOTP">
|
||||
<h1> Please send your OTP</h1>
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-xs-offset-4">
|
||||
<h1> Please submit your OTP</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-xs-offset-4">
|
||||
|
||||
@ -79,7 +79,7 @@ class OAuthTest extends ServerSetup {
|
||||
lazy val user1Password = randomString(10)
|
||||
lazy val user1 =
|
||||
AuthUser.create.
|
||||
email(randomString(3)+"@example.com").
|
||||
email(randomString(10)+"@example.com").
|
||||
username("username with_space").
|
||||
password(user1Password).
|
||||
validated(true).
|
||||
@ -90,7 +90,7 @@ class OAuthTest extends ServerSetup {
|
||||
lazy val user2Password = randomString(10)
|
||||
lazy val user2 =
|
||||
AuthUser.create.
|
||||
email(randomString(3)+"@example.com").
|
||||
email(randomString(10)+"@example.com").
|
||||
username("username with more than 1 space").
|
||||
password(user2Password).
|
||||
validated(false).
|
||||
@ -100,7 +100,7 @@ class OAuthTest extends ServerSetup {
|
||||
|
||||
lazy val consumer = new Consumer (testConsumer.key.get,testConsumer.secret.get)
|
||||
lazy val disabledConsumer = new Consumer (disabledTestConsumer.key.get, disabledTestConsumer.secret.get)
|
||||
lazy val notRegisteredConsumer = new Consumer (randomString(5),randomString(5))
|
||||
lazy val notRegisteredConsumer = new Consumer (randomString(10),randomString(10))
|
||||
|
||||
private def getAPIResponse(req : Req) : OAuthResponse = {
|
||||
Await.result(
|
||||
@ -264,7 +264,7 @@ class OAuthTest extends ServerSetup {
|
||||
scenario("the user cannot login because the token does not exist", Verifier, Oauth){
|
||||
Given("we will use a random request token")
|
||||
When("the browser is launched to login")
|
||||
val verifier = getVerifier(randomString(4), user1.username.get, user1Password)
|
||||
val verifier = getVerifier(randomString(10), user1.username.get, user1Password)
|
||||
Then("we should not get a verifier")
|
||||
verifier.isEmpty should equal (true)
|
||||
}
|
||||
@ -295,7 +295,7 @@ class OAuthTest extends ServerSetup {
|
||||
val reply = getRequestToken(consumer, oob)
|
||||
val requestToken = extractToken(reply.body)
|
||||
When("when we ask for an access token")
|
||||
val accessTokenReply = getAccessToken(consumer, requestToken, randomString(5))
|
||||
val accessTokenReply = getAccessToken(consumer, requestToken, randomString(10))
|
||||
Then("we should get a 401")
|
||||
accessTokenReply.code should equal (401)
|
||||
}
|
||||
@ -305,7 +305,7 @@ class OAuthTest extends ServerSetup {
|
||||
val requestToken = extractToken(reply.body)
|
||||
val verifier = getVerifier(requestToken.value, user1.username.get, user1Password)
|
||||
When("when we ask for an access token with a request token")
|
||||
val randomRequestToken = Token(randomString(5), randomString(5))
|
||||
val randomRequestToken = Token(randomString(10), randomString(10))
|
||||
val accessTokenReply = getAccessToken(consumer, randomRequestToken, verifier.openOrThrowException(attemptedToOpenAnEmptyBox))
|
||||
Then("we should get a 401")
|
||||
accessTokenReply.code should equal (401)
|
||||
@ -314,8 +314,8 @@ class OAuthTest extends ServerSetup {
|
||||
Given("we will first get request token and a verifier")
|
||||
val reply = getRequestToken(consumer, selfCallback)
|
||||
When("when we ask for an access token with a request token")
|
||||
val randomRequestToken = Token(randomString(5), randomString(5))
|
||||
val accessTokenReply = getAccessToken(consumer, randomRequestToken, randomString(5))
|
||||
val randomRequestToken = Token(randomString(10), randomString(10))
|
||||
val accessTokenReply = getAccessToken(consumer, randomRequestToken, randomString(10))
|
||||
Then("we should get a 401")
|
||||
accessTokenReply.code should equal (401)
|
||||
}
|
||||
|
||||
@ -1047,7 +1047,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
scenario("we don't get the hosted bank information", API1_2_1, GetHostedBank){
|
||||
Given("We will not use an access token and request a random bankId")
|
||||
When("the request is sent")
|
||||
val reply = getBankInfo(randomString(5))
|
||||
val reply = getBankInfo(randomString(10))
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
@ -1454,7 +1454,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val view = randomView(true, "")
|
||||
When("the request is sent")
|
||||
val reply = postView(bankId, randomString(3), view, user1)
|
||||
val reply = postView(bankId, randomString(10), view, user1)
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
@ -1482,7 +1482,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val viewsBefore = getAccountViews(bankId, bankAccount.id, user1).body.extract[ViewsJSONV121].views
|
||||
val viewWithEmptyName = CreateViewJsonV121(
|
||||
name = "",
|
||||
description = randomString(3),
|
||||
description = randomString(10),
|
||||
is_public = true,
|
||||
which_alias_to_use="alias",
|
||||
hide_metadata_if_alias_used = false,
|
||||
@ -1503,7 +1503,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val viewWithSystemName = CreateViewJsonV121(
|
||||
name = SYSTEM_OWNER_VIEW_ID,
|
||||
description = randomString(3),
|
||||
description = randomString(10),
|
||||
is_public = true,
|
||||
which_alias_to_use="alias",
|
||||
hide_metadata_if_alias_used = false,
|
||||
@ -1720,7 +1720,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
When("the request is sent")
|
||||
val reply = deleteView(bankId, bankAccount.id, randomString(3), user1)
|
||||
val reply = deleteView(bankId, bankAccount.id, randomString(10), user1)
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
@ -1833,7 +1833,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
When("the request is sent")
|
||||
val reply = getUserAccountPermission(bankId, bankAccount.id, randomString(5), user1)
|
||||
val reply = getUserAccountPermission(bankId, bankAccount.id, randomString(10), user1)
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
@ -1864,7 +1864,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
When("the request is sent")
|
||||
val reply = grantUserAccessToView(bankId, bankAccount.id, randomString(5), randomCustomViewPermalink(bankId, bankAccount), user1)
|
||||
val reply = grantUserAccessToView(bankId, bankAccount.id, randomString(10), randomCustomViewPermalink(bankId, bankAccount), user1)
|
||||
Then("we should get a 400 ok code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
@ -1878,7 +1878,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val userId = resourceUser2.idGivenByProvider
|
||||
val viewsBefore = getUserAccountPermission(bankId, bankAccount.id, userId, user1).body.extract[ViewsJSONV121].views.length
|
||||
When("the request is sent")
|
||||
val reply = grantUserAccessToView(bankId, bankAccount.id, userId, randomString(5), user1)
|
||||
val reply = grantUserAccessToView(bankId, bankAccount.id, userId, randomString(10), user1)
|
||||
Then("we should get a 404 code")
|
||||
reply.code should equal (404)
|
||||
And("we should get an error message")
|
||||
@ -1931,7 +1931,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token with a random user Id")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val userId = randomString(5)
|
||||
val userId = randomString(10)
|
||||
val viewsIdsToGrant= randomCustomViewsIdsToGrant(bankId, bankAccount.id)
|
||||
When("the request is sent")
|
||||
val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1)
|
||||
@ -1946,7 +1946,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val userId = resourceUser3.idGivenByProvider
|
||||
val viewsIdsToGrant= List(randomString(3),randomString(3))
|
||||
val viewsIdsToGrant= List(randomString(10),randomString(10))
|
||||
When("the request is sent")
|
||||
val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1)
|
||||
Then("we should get a 404 code")
|
||||
@ -1960,7 +1960,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val userId = resourceUser3.idGivenByProvider
|
||||
val viewsIdsToGrant= randomCustomViewsIdsToGrant(bankId, bankAccount.id) ++ List(randomString(3),randomString(3))
|
||||
val viewsIdsToGrant= randomCustomViewsIdsToGrant(bankId, bankAccount.id) ++ List(randomString(10),randomString(10))
|
||||
val viewsBefore = getUserAccountPermission(bankId, bankAccount.id, userId, user1).body.extract[ViewsJSONV121].views.length
|
||||
When("the request is sent")
|
||||
val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1)
|
||||
@ -1977,7 +1977,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val userId = resourceUser3.idGivenByProvider
|
||||
val viewsIdsToGrant= randomCustomViewsIdsToGrant(bankId, bankAccount.id) ++ List(randomString(3),randomString(3))
|
||||
val viewsIdsToGrant= randomCustomViewsIdsToGrant(bankId, bankAccount.id) ++ List(randomString(10),randomString(10))
|
||||
val viewsBefore = getUserAccountPermission(bankId, bankAccount.id, userId, user1).body.extract[ViewsJSONV121].views.length
|
||||
When("the request is sent")
|
||||
val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user3)
|
||||
@ -2031,7 +2031,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
When("the request is sent")
|
||||
val reply = revokeUserAccessToView(bankId, bankAccount.id, randomString(5), randomCustomViewPermalink(bankId, bankAccount), user1)
|
||||
val reply = revokeUserAccessToView(bankId, bankAccount.id, randomString(10), randomCustomViewPermalink(bankId, bankAccount), user1)
|
||||
Then("we should get a 400 ok code")
|
||||
reply.code should equal (400)
|
||||
}
|
||||
@ -2064,7 +2064,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val userId =resourceUser2.idGivenByProvider
|
||||
val viewsBefore = getUserAccountPermission(bankId, bankAccount.id, userId, user1).body.extract[ViewsJSONV121].views.length
|
||||
When("the request is sent")
|
||||
val reply = revokeUserAccessToView(bankId, bankAccount.id, userId, randomString(5), user1)
|
||||
val reply = revokeUserAccessToView(bankId, bankAccount.id, userId, randomString(10), user1)
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
val viewsAfter = getUserAccountPermission(bankId, bankAccount.id, userId, user1).body.extract[ViewsJSONV121].views.length
|
||||
@ -2107,7 +2107,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
When("the request is sent")
|
||||
val reply = revokeUserAccessToAllViews(bankId, bankAccount.id, randomString(5), user1)
|
||||
val reply = revokeUserAccessToAllViews(bankId, bankAccount.id, randomString(510), user1)
|
||||
Then("we should get a 400 ok code")
|
||||
reply.code should equal (400)
|
||||
}
|
||||
@ -2219,7 +2219,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
When("the request is sent")
|
||||
val reply = getTheCounterparties(bankId, bankAccount.id, randomString(5), user1)
|
||||
val reply = getTheCounterparties(bankId, bankAccount.id, randomString(10), user1)
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
@ -2277,7 +2277,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val otherBankAccount = randomCounterparty(bankId, bankAccount.id, randomCustomViewPermalink(bankId, bankAccount))
|
||||
When("the request is sent")
|
||||
val reply = getTheCounterparty(bankId, bankAccount.id, randomString(5), otherBankAccount.id, user1)
|
||||
val reply = getTheCounterparty(bankId, bankAccount.id, randomString(10), otherBankAccount.id, user1)
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
@ -2290,7 +2290,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = randomCustomViewPermalink(bankId, bankAccount)
|
||||
When("the request is sent")
|
||||
val reply = getTheCounterparty(bankId, bankAccount.id, view, randomString(5), user1)
|
||||
val reply = getTheCounterparty(bankId, bankAccount.id, view, randomString(10), user1)
|
||||
Then("we should get a 400 code")
|
||||
reply.code should equal (400)
|
||||
And("we should get an error message")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user