done with JWT
This commit is contained in:
@@ -45,7 +45,7 @@ def serve_paths(filename):
|
|||||||
|
|
||||||
# EligibilityCheck Endpoint
|
# EligibilityCheck Endpoint
|
||||||
@api.route("/EligibilityCheck", methods=["POST"])
|
@api.route("/EligibilityCheck", methods=["POST"])
|
||||||
@require_auth
|
@jwt_required()
|
||||||
def eligibility_check():
|
def eligibility_check():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
# logger.info(f"EligibilityCheck request received: {data}")
|
# logger.info(f"EligibilityCheck request received: {data}")
|
||||||
@@ -55,7 +55,7 @@ def eligibility_check():
|
|||||||
|
|
||||||
# SelectOffer Endpoint
|
# SelectOffer Endpoint
|
||||||
@api.route("/SelectOffer", methods=["POST"])
|
@api.route("/SelectOffer", methods=["POST"])
|
||||||
@require_auth
|
@jwt_required()
|
||||||
def select_offer():
|
def select_offer():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
# logger.info(f"SelectOffer request received: {data}")
|
# logger.info(f"SelectOffer request received: {data}")
|
||||||
@@ -65,7 +65,7 @@ def select_offer():
|
|||||||
|
|
||||||
# ProvideLoan Endpoint
|
# ProvideLoan Endpoint
|
||||||
@api.route("/ProvideLoan", methods=["POST"])
|
@api.route("/ProvideLoan", methods=["POST"])
|
||||||
@require_auth
|
@jwt_required()
|
||||||
def provide_loan():
|
def provide_loan():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
# logger.info(f"ProvideLoan request received: {data}")
|
# logger.info(f"ProvideLoan request received: {data}")
|
||||||
@@ -75,7 +75,7 @@ def provide_loan():
|
|||||||
|
|
||||||
# LoanStatus Endpoint
|
# LoanStatus Endpoint
|
||||||
@api.route("/LoanStatus", methods=["POST"])
|
@api.route("/LoanStatus", methods=["POST"])
|
||||||
@require_auth
|
@jwt_required()
|
||||||
def loan_status():
|
def loan_status():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
# logger.info(f"LoanStatus request received: {data}")
|
# logger.info(f"LoanStatus request received: {data}")
|
||||||
@@ -85,7 +85,7 @@ def loan_status():
|
|||||||
|
|
||||||
# Repayment Endpoint
|
# Repayment Endpoint
|
||||||
@api.route("/Repayment", methods=["POST"])
|
@api.route("/Repayment", methods=["POST"])
|
||||||
@require_auth
|
@jwt_required()
|
||||||
def repayment():
|
def repayment():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
# logger.info(f"Repayment request received: {data}")
|
# logger.info(f"Repayment request received: {data}")
|
||||||
@@ -95,7 +95,7 @@ def repayment():
|
|||||||
|
|
||||||
# CustomerConsent Endpoint
|
# CustomerConsent Endpoint
|
||||||
@api.route("/CustomerConsent", methods=["POST"])
|
@api.route("/CustomerConsent", methods=["POST"])
|
||||||
@require_auth
|
@jwt_required()
|
||||||
def customer_consent():
|
def customer_consent():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
# logger.info(f"CustomerConsent request received: {data}")
|
# logger.info(f"CustomerConsent request received: {data}")
|
||||||
@@ -105,7 +105,7 @@ def customer_consent():
|
|||||||
|
|
||||||
# NotificationCallback Endpoint
|
# NotificationCallback Endpoint
|
||||||
@api.route("/NotificationCallback", methods=["POST"])
|
@api.route("/NotificationCallback", methods=["POST"])
|
||||||
@require_auth
|
@jwt_required()
|
||||||
def notification_callback():
|
def notification_callback():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
# logger.info(f"NotificationCallback request received: {data}")
|
# logger.info(f"NotificationCallback request received: {data}")
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ from flask_jwt_extended import (
|
|||||||
create_refresh_token,
|
create_refresh_token,
|
||||||
get_jwt_identity,
|
get_jwt_identity,
|
||||||
)
|
)
|
||||||
|
from app.config import Config
|
||||||
|
|
||||||
|
USERNAME = Config.BASIC_AUTH_USERNAME
|
||||||
|
PASSWORD = Config.BASIC_AUTH_PASSWORD
|
||||||
|
|
||||||
|
|
||||||
class AuthorizationService(BaseService):
|
class AuthorizationService(BaseService):
|
||||||
@@ -39,8 +43,8 @@ class AuthorizationService(BaseService):
|
|||||||
### TODO: Access Database credentials here ###
|
### TODO: Access Database credentials here ###
|
||||||
|
|
||||||
if (
|
if (
|
||||||
validated_data["username"] != "username"
|
validated_data["username"] != USERNAME
|
||||||
or validated_data["password"] != "password"
|
or validated_data["password"] != PASSWORD
|
||||||
):
|
):
|
||||||
return ResponseHelper.unauthorized(message="Invalid credentials")
|
return ResponseHelper.unauthorized(message="Invalid credentials")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user