Skip to content

Commit 5015348

Browse files
authored
Merge pull request #3965 from shockey/bug/oauth2-authorization-interceptor
Bug/oauth2 authorization interceptor
2 parents ec787cf + d5a4cab commit 5015348

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ displayRequestDuration | Controls the display of the request duration (in millis
162162
maxDisplayedTags | If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations.
163163
filter | If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be true/false to enable or disable, or an explicit filter string in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag.
164164
deepLinking | If set to `true`, enables dynamic deep linking for tags and operations. [Docs](https://github.com/swagger-api/swagger-ui/blob/master/docs/deep-linking.md)
165-
requestInterceptor | MUST be a function. Function to intercept try-it-out requests. Accepts one argument requestInterceptor(request) and must return the potentially modified request.
166-
responseInterceptor | MUST be a function. Function to intercept try-it-out responses. Accepts one argument responseInterceptor(response) and must return the potentially modified response.
165+
requestInterceptor | MUST be a function. Function to intercept remote definition, Try-It-Out, and OAuth2 requests. Accepts one argument requestInterceptor(request) and must return the potentially modified request.
166+
responseInterceptor | MUST be a function. Function to intercept remote definition, Try-It-Out, and OAuth2 responses. Accepts one argument responseInterceptor(response) and must return the potentially modified response.
167167
showMutatedRequest | If set to `true` (the default), uses the mutated request returned from a rquestInterceptor to produce the curl command in the UI, otherwise the request before the requestInterceptor was applied is used.
168168
showExtensions | Controls the display of vendor extension (`x-`) fields and values for Operations, Parameters, and Schema. The default is `false`.
169169

src/core/plugins/auth/actions.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const authorizeAccessCodeWithBasicAuthentication = ( { auth, redirectUrl
139139
return authActions.authorizeRequest({body: buildFormData(form), name, url: schema.get("tokenUrl"), auth, headers})
140140
}
141141

142-
export const authorizeRequest = ( data ) => ( { fn, authActions, errActions, authSelectors } ) => {
142+
export const authorizeRequest = ( data ) => ( { fn, getConfigs, authActions, errActions, authSelectors } ) => {
143143
let { body, query={}, headers={}, name, url, auth } = data
144144
let { additionalQueryStringParams } = authSelectors.getConfigs() || {}
145145
let fetchUrl = url
@@ -158,7 +158,9 @@ export const authorizeRequest = ( data ) => ( { fn, authActions, errActions, aut
158158
method: "post",
159159
headers: _headers,
160160
query: query,
161-
body: body
161+
body: body,
162+
requestInterceptor: getConfigs().requestInterceptor,
163+
responseInterceptor: getConfigs().responseInterceptor
162164
})
163165
.then(function (response) {
164166
let token = JSON.parse(response.data)

0 commit comments

Comments
 (0)