File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ content_by_lua_block {
1010 local access_token = ipax.get_access_token();
1111 ngx.log(ngx.DEBUG, "access_token: " .. access_token)
1212 local refresh_token = ipax.get_refresh_token();
13- ngx.log(ngx.DEBUG, "refresh_token: " .. refresh_token)
13+ ngx.log(ngx.DEBUG, "refresh_token: " .. tostring( refresh_token) )
1414
1515
1616 local data = {
1717 user = ipax.get_user(),
1818 headers = ngx.resp.get_headers(),
1919 access_token = access_token,
20- refresh_token = refresh_token,
20+ refresh_token = refresh_token or "Not Provided in token endpoint response" ,
2121 id_token = id_token,
2222 userinfo_json = ipax.get_userinfo_json(),
23- username = ipax.get_preferred_username_from_userinfo_or_idtoken(),
23+ username = ipax.get_preferred_username_from_userinfo_or_idtoken() or "Not Informed" ,
2424 user_actions = ipax.get_user_actions(),
2525 logout_uri = os.getenv("OIDC_LOGOUT_URI"),
2626 app_name = os.getenv("IPAX_APP_NAME")
Original file line number Diff line number Diff line change @@ -234,14 +234,15 @@ function _M.get_preferred_name_from_userinfo()
234234end
235235
236236function _M .get_preferred_username_from_userinfo_or_idtoken ()
237- local id_token = _M .get_id_token ()
238- local preferred_username = id_token .preferred_username
237+ local userinfo_preferred_username = _M .get_preferred_name_from_userinfo ()
239238
240- if preferred_username == nil then
241- return _M .get_preferred_name_from_userinfo ()
239+ if userinfo_preferred_username == nil then
240+ local id_token = _M .get_id_token ()
241+ return id_token .preferred_username
242242 else
243- return preferred_username
243+ return userinfo_preferred_username
244244 end
245+
245246end
246247
247248function _M .get_id_token ()
256257
257258function _M .get_refresh_token ()
258259 local res = _M .get_res ()
259- return res .refresh_token
260+ local refresh_token = res .refresh_token or nil
261+ return refresh_token
260262end
261263
262264function _M .get_res ()
Original file line number Diff line number Diff line change 156156 </ thead >
157157 < tbody >
158158 < tr > < td style ='word-break:break-word;white-space:pre-wrap;-moz-white-space:pre-wrap; '> {{access_token}}</ td > </ tr >
159- < tr id ="secondRow "> < td > View in < a href ='https://jwt.io/?value={{access_token}} ' target ='_blank '> https://jwt.io/</ a > </ td > </ tr >
159+ < tr id ="accessTokenSecondRow "> < td > View in < a href ='https://jwt.io/?value={{access_token}} ' target ='_blank '> https://jwt.io/</ a > </ td > </ tr >
160160 </ tbody >
161161 </ table >
162162 </ div >
169169 </ thead >
170170 < tbody >
171171 < tr > < td style ='word-break:break-word;white-space:pre-wrap;-moz-white-space:pre-wrap; '> {{refresh_token}}</ td > </ tr >
172- < tr id ="secondRow "> < td > View in < a href ='https://jwt.io/?value={{refresh_token}} ' target ='_blank '> https://jwt.io/</ a > </ td > </ tr >
172+ < tr id ="refreshTokenSecondRow "> < td > View in < a href ='https://jwt.io/?value={{refresh_token}} ' target ='_blank '> https://jwt.io/</ a > </ td > </ tr >
173173 </ tbody >
174174 </ table >
175175 </ div >
236236 const accessToken = "{{access_token}}" ;
237237
238238 if ( ! accessToken . startsWith ( "ey" ) ) {
239- document . getElementById ( "secondRow" ) . style . display = "none" ;
239+ document . getElementById ( "accessTokenSecondRow" ) . style . display = "none" ;
240+ }
241+
242+ const refreshToken = "{{refresh_token}}" ;
243+
244+ if ( refreshToken === "Not Provided in token endpoint response" ) {
245+ document . getElementById ( "refreshTokenSecondRow" ) . style . display = "none" ;
240246 }
241247 </ script >
242248 </ body >
You can’t perform that action at this time.
0 commit comments