Disable Swagger2 auth features in OAS3
This commit is contained in:
33
src/core/plugins/oas3/auth-extensions/wrap-selectors.js
Normal file
33
src/core/plugins/oas3/auth-extensions/wrap-selectors.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { createSelector } from "reselect"
|
||||||
|
import { Map } from "immutable"
|
||||||
|
import { isOAS3 as isOAS3Helper, isSwagger2 as isSwagger2Helper } from "../helpers"
|
||||||
|
|
||||||
|
|
||||||
|
// Helpers
|
||||||
|
|
||||||
|
function onlyOAS3(selector) {
|
||||||
|
return (ori, system) => (...args) => {
|
||||||
|
const spec = system.getSystem().specSelectors.specJson()
|
||||||
|
if(isOAS3Helper(spec)) {
|
||||||
|
return selector(...args)
|
||||||
|
} else {
|
||||||
|
return ori(...args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const state = state => {
|
||||||
|
return state || Map()
|
||||||
|
}
|
||||||
|
|
||||||
|
const nullSelector = createSelector(() => null)
|
||||||
|
|
||||||
|
const OAS3NullSelector = onlyOAS3(nullSelector)
|
||||||
|
|
||||||
|
// Hasta la vista, authentication!
|
||||||
|
export const shownDefinitions = OAS3NullSelector
|
||||||
|
export const definitionsToAuthorize = OAS3NullSelector
|
||||||
|
export const getDefinitionsByNames = OAS3NullSelector
|
||||||
|
export const authorized = OAS3NullSelector
|
||||||
|
export const isAuthorized = OAS3NullSelector
|
||||||
|
export const getConfigs = OAS3NullSelector
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
// import reducers from "./reducers"
|
// import reducers from "./reducers"
|
||||||
// import * as actions from "./actions"
|
// import * as actions from "./actions"
|
||||||
import * as specWrapSelectors from "./spec-extensions/wrap-selectors"
|
import * as specWrapSelectors from "./spec-extensions/wrap-selectors"
|
||||||
|
import * as authWrapSelectors from "./auth-extensions/wrap-selectors"
|
||||||
import * as specSelectors from "./spec-extensions/selectors"
|
import * as specSelectors from "./spec-extensions/selectors"
|
||||||
import components from "./components"
|
import components from "./components"
|
||||||
import wrapComponents from "./wrap-components"
|
import wrapComponents from "./wrap-components"
|
||||||
@@ -17,6 +18,9 @@ export default function() {
|
|||||||
wrapSelectors: specWrapSelectors,
|
wrapSelectors: specWrapSelectors,
|
||||||
selectors: specSelectors
|
selectors: specSelectors
|
||||||
},
|
},
|
||||||
|
auth: {
|
||||||
|
wrapSelectors: authWrapSelectors
|
||||||
|
},
|
||||||
oas3: {
|
oas3: {
|
||||||
actions: oas3Actions,
|
actions: oas3Actions,
|
||||||
reducers: oas3Reducers,
|
reducers: oas3Reducers,
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export const basePath = OAS3NullSelector
|
|||||||
export const consumes = OAS3NullSelector
|
export const consumes = OAS3NullSelector
|
||||||
export const produces = OAS3NullSelector
|
export const produces = OAS3NullSelector
|
||||||
export const schemes = OAS3NullSelector
|
export const schemes = OAS3NullSelector
|
||||||
|
export const securityDefinitions = OAS3NullSelector
|
||||||
|
|
||||||
// New selectors
|
// New selectors
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user