From 03a981ae4f9b1c6c9223c63b0f70cf592a21b8ed Mon Sep 17 00:00:00 2001 From: Lars Nymand Jensen Date: Wed, 25 May 2022 18:46:11 +0200 Subject: [PATCH] feat(swagger-ui-react): Add oauth2RedirectUrl prop (#8028) --- flavors/swagger-ui-react/README.md | 8 ++++++++ flavors/swagger-ui-react/index.jsx | 2 ++ 2 files changed, 10 insertions(+) diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index 555a0916..cf6806fd 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -164,6 +164,14 @@ If set to `true`, enables passing credentials, [as defined in the Fetch standard ⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. +#### `oauth2RedirectUrl`: PropTypes.string + +Redirect url given as parameter to the oauth2 provider. Default the url refers to oauth2-redirect.html at the same path as the Swagger UI is available. + +⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. + + + ## Limitations * Not all configuration bindings are available. diff --git a/flavors/swagger-ui-react/index.jsx b/flavors/swagger-ui-react/index.jsx index 946d7c4c..dcfe92d2 100644 --- a/flavors/swagger-ui-react/index.jsx +++ b/flavors/swagger-ui-react/index.jsx @@ -36,6 +36,7 @@ export default class SwaggerUI extends React.Component { filter: ["boolean", "string"].includes(typeof this.props.filter) ? this.props.filter : false, persistAuthorization: this.props.persistAuthorization, withCredentials: this.props.withCredentials, + oauth2RedirectUrl: this.props.oauth2RedirectUrl }) this.system = ui @@ -131,6 +132,7 @@ SwaggerUI.propTypes = { displayRequestDuration: PropTypes.bool, persistAuthorization: PropTypes.bool, withCredentials: PropTypes.bool, + oauth2RedirectUrl: PropTypes.string, } SwaggerUI.defaultProps = {