@@ -94,21 +94,30 @@ function _M:access(context)
94
94
95
95
local components = resty_url .parse (context .service .oidc .issuer_endpoint )
96
96
self .credential = create_credential (components .user , components .password )
97
- self .introspection_url = context .proxy .oauth .config .token_introspection_endpoint
97
+ local oauth_config = context .proxy .oauth .config
98
+ -- token_introspection_endpoint being deprecated in RH SSO 7.4 and removed in 7.5
99
+ -- https://access.redhat.com/documentation/en-us/red_hat_single_sign-on/7.5/html-single/upgrading_guide/index#non_standard_token_introspection_endpoint_removed
100
+ self .introspection_url = oauth_config .introspection_endpoint or oauth_config .token_introspection_endpoint
98
101
end
99
102
100
103
if self .introspection_url then
101
104
local authorization = http_authorization .new (ngx .var .http_authorization )
102
105
local access_token = authorization .token
103
106
--- Introspection Response must have an "active" boolean value.
104
107
-- https://tools.ietf.org/html/rfc7662#section-2.2
105
- if not introspect_token (self , access_token ).active == true then
106
- ngx .log (ngx .INFO , ' token introspection for access token ' , access_token , ' : token not active' )
107
- ngx .status = context .service .auth_failed_status
108
- ngx .say (context .service .error_auth_failed )
109
- return ngx .exit (ngx .status )
108
+ if introspect_token (self , access_token ).active == true then
109
+ -- access granted
110
+ return
110
111
end
112
+
113
+ ngx .log (ngx .INFO , ' token introspection for access token ' , access_token , ' : token not active' )
114
+ else
115
+ ngx .log (ngx .WARN , ' token instropection cannot be performed as introspection endpoint is not available' )
111
116
end
117
+
118
+ ngx .status = context .service .auth_failed_status
119
+ ngx .say (context .service .error_auth_failed )
120
+ return ngx .exit (ngx .status )
112
121
end
113
122
114
123
return _M
0 commit comments