mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 19:16:53 +00:00
feature/Add props connector.user.authentication
This commit is contained in:
parent
34602a3d62
commit
292c215b49
@ -99,6 +99,9 @@ resource_docs_requires_role=false
|
||||
## Enable user authentication via obpjvm
|
||||
#obpjvm.user.authentication=true
|
||||
|
||||
## Enable user authentication via the connector
|
||||
#connector.user.authentication=true
|
||||
|
||||
## Enable SSL for JWT, if set to true must set paths for the keystore locations
|
||||
jwt.use.ssl=false
|
||||
|
||||
|
||||
@ -859,27 +859,24 @@ def restoreSomeSessions(): Unit = {
|
||||
S.error(S.?("account.validation.error")) // Note: This does not seem to get hit when user is not validated.
|
||||
|
||||
// If not found locally, try to authenticate user via Kafka, if enabled in props
|
||||
case Empty if (connector.startsWith("kafka") || connector == "obpjvm") &&
|
||||
(APIUtil.getPropsAsBoolValue("kafka.user.authentication", false) ||
|
||||
case Empty if (APIUtil.getPropsAsBoolValue("connector.user.authentication", false) ||
|
||||
APIUtil.getPropsAsBoolValue("kafka.user.authentication", false) ||
|
||||
APIUtil.getPropsAsBoolValue("obpjvm.user.authentication", false)) =>
|
||||
val preLoginState = capturePreLoginState()
|
||||
logger.info("login redirect: " + loginRedirect.get)
|
||||
val redirect = redirectUri()
|
||||
for {
|
||||
user_ <- externalUserHelper(usernameFromGui, passwordFromGui)
|
||||
} yield {
|
||||
user_
|
||||
} match {
|
||||
case user:AuthUser =>
|
||||
|
||||
val preLoginState = capturePreLoginState()
|
||||
logger.info("login redirect: " + loginRedirect.get)
|
||||
val redirect = redirectUri()
|
||||
externalUserHelper(usernameFromGui, passwordFromGui) match {
|
||||
case Full(user: AuthUser) =>
|
||||
LoginAttempt.resetBadLoginAttempts(usernameFromGui)
|
||||
checkInternalRedirecAndLogUseIn(preLoginState, redirect, user)
|
||||
case _ =>
|
||||
LoginAttempt.incrementBadLoginAttempts(username.get)
|
||||
Empty
|
||||
}
|
||||
}
|
||||
//If the username is not exiting, throw the error message.
|
||||
case Empty => S.error(S.?("Invalid Login Credentials"))
|
||||
|
||||
case Empty =>
|
||||
S.error(S.?("Invalid Login Credentials"))
|
||||
case _ =>
|
||||
LoginAttempt.incrementBadLoginAttempts(usernameFromGui)
|
||||
S.error(S.?(ErrorMessages.UnexpectedErrorDuringLogin)) // Note we hit this if user has not clicked email validation link
|
||||
@ -939,6 +936,15 @@ def restoreSomeSessions(): Unit = {
|
||||
} yield {
|
||||
user
|
||||
}
|
||||
} else if (connector.startsWith("stored_procedure")) {
|
||||
for {
|
||||
user <- checkExternalUserViaConnector(name, password)
|
||||
//u <- user.user.foreign // this will be issue when the resource user is in remote side
|
||||
u <- Users.users.vend.getUserByUserName(name)
|
||||
v <- Full (updateUserAccountViews(u, None))
|
||||
} yield {
|
||||
user
|
||||
}
|
||||
} else Empty
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user