File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77from ..entities .Settings import Settings
88from ..utils .configUtil import getConfigSettings
99from ..utils .bb2Util import generateAuthorizeUrl , getAccessToken , getBenefitData
10- from ..utils .userUtil import getLoggedInUser
10+ from ..utils .userUtil import clearBB2Data , getLoggedInUser
1111from ..shared .LoggerFactory import LoggerFactory
1212import json
1313
1616front-end to communicate with the server to retrieve data from Blue Button and Medicare.gov
1717"""
1818
19+ BENE_DENIED_ACCESS = 'access_denied'
20+
1921# initialize the logger object
2022myLogger = LoggerFactory .get_logger (log_file = __name__ ,log_level = 'DEBUG' )
2123loggedInUser = getLoggedInUser ()
@@ -56,7 +58,13 @@ def getCurrentAuthToken():
5658def authorizationCallback ():
5759 try :
5860 requestQuery = request .args
59-
61+
62+ if (requestQuery .get ('error' ) == BENE_DENIED_ACCESS ):
63+ # clear all saved claims data since the bene has denied access for the application
64+ clearBB2Data ()
65+ myLogger .error ('Beneficiary denied application access to their data' )
66+ return redirect ('http://localhost:3000' )
67+
6068 if (requestQuery .get ('code' ) == '' ):
6169 myLogger .error ('Response was missing access code!' )
6270 if (DBsettings .pkce and requestQuery .get ('state' )):
Original file line number Diff line number Diff line change 1111
1212def getLoggedInUser ():
1313 return DBusers [0 ]
14+
15+ def clearBB2Data ():
16+ logged_in_user = getLoggedInUser ()
17+ logged_in_user .update ({'authToken' : {
18+ 'access_token' : '' ,
19+ 'expires_in' : 0 ,
20+ 'expires_at' : 0 ,
21+ 'token_type' : '' ,
22+ 'scope' : '' ,
23+ 'refresh_token' : '' ,
24+ 'patient' : ''
25+ }})
26+ logged_in_user .update ({'eobData' : '' })
You can’t perform that action at this time.
0 commit comments