Skip to content

Commit 602d53b

Browse files
feature/Tweak endpoint verifyUserCredentials v6.0.0
1 parent 83e4dae commit 602d53b

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

obp-api/src/main/scala/code/api/v6_0_0/APIMethods600.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8752,8 +8752,7 @@ trait APIMethods600 {
87528752
case "users" :: "verify-credentials" :: Nil JsonPost json -> _ => {
87538753
cc => implicit val ec = EndpointContext(Some(cc))
87548754
for {
8755-
(Full(u), callContext) <- authenticatedAccess(cc)
8756-
postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the PostVerifyUserCredentialsJsonV600", 400, callContext) {
8755+
postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the PostVerifyUserCredentialsJsonV600", 400, Some(cc)) {
87578756
json.extract[PostVerifyUserCredentialsJsonV600]
87588757
}
87598758
// Validate credentials using the existing AuthUser mechanism
@@ -8788,27 +8787,27 @@ trait APIMethods600 {
87888787
}
87898788
}
87908789
// Check if account is locked
8791-
_ <- Helper.booleanToFuture(UsernameHasBeenLocked, 401, callContext) {
8790+
_ <- Helper.booleanToFuture(UsernameHasBeenLocked, 401, Some(cc)) {
87928791
resourceUserIdBox != Full(code.model.dataAccess.AuthUser.usernameLockedStateCode)
87938792
}
87948793
// Check if credentials are valid
87958794
resourceUserId <- Future {
87968795
resourceUserIdBox
87978796
} map {
8798-
x => unboxFullOrFail(x, callContext, s"$InvalidLoginCredentials Failed to authenticate user credentials.", 401)
8797+
x => unboxFullOrFail(x, Some(cc), s"$InvalidLoginCredentials Failed to authenticate user credentials.", 401)
87998798
}
88008799
// Get the user object
88018800
user <- Future {
88028801
Users.users.vend.getUserByResourceUserId(resourceUserId)
88038802
} map {
8804-
x => unboxFullOrFail(x, callContext, s"$InvalidLoginCredentials User account not found in system.", 401)
8803+
x => unboxFullOrFail(x, Some(cc), s"$InvalidLoginCredentials User account not found in system.", 401)
88058804
}
88068805
// Verify provider matches if specified and not empty
8807-
_ <- Helper.booleanToFuture(s"$InvalidLoginCredentials Authentication provider mismatch.", 401, callContext) {
8806+
_ <- Helper.booleanToFuture(s"$InvalidLoginCredentials Authentication provider mismatch.", 401, Some(cc)) {
88088807
postedData.provider.isEmpty || user.provider == postedData.provider
88098808
}
88108809
} yield {
8811-
(JSONFactory200.createUserJSON(user), HttpCode.`200`(callContext))
8810+
(JSONFactory200.createUserJSON(user), HttpCode.`200`(Some(cc)))
88128811
}
88138812
}
88148813
}

0 commit comments

Comments
 (0)