Skip to content

Commit dd02778

Browse files
authored
Merge pull request #3716 from swagger-api/ft/oas3-disable-auth
Disable Swagger2 auth features in OAS3
2 parents c6a6643 + e15b4c8 commit dd02778

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { createSelector } from "reselect"
2+
import { isOAS3 as isOAS3Helper } from "../helpers"
3+
4+
5+
// Helpers
6+
7+
function onlyOAS3(selector) {
8+
return (ori, system) => (...args) => {
9+
const spec = system.getSystem().specSelectors.specJson()
10+
if(isOAS3Helper(spec)) {
11+
return selector(...args)
12+
} else {
13+
return ori(...args)
14+
}
15+
}
16+
}
17+
18+
const nullSelector = createSelector(() => null)
19+
20+
const OAS3NullSelector = onlyOAS3(nullSelector)
21+
22+
// Hasta la vista, authentication!
23+
export const shownDefinitions = OAS3NullSelector
24+
export const definitionsToAuthorize = OAS3NullSelector
25+
export const getDefinitionsByNames = OAS3NullSelector
26+
export const authorized = OAS3NullSelector
27+
export const isAuthorized = OAS3NullSelector
28+
export const getConfigs = OAS3NullSelector

src/core/plugins/oas3/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// import reducers from "./reducers"
22
// import * as actions from "./actions"
33
import * as specWrapSelectors from "./spec-extensions/wrap-selectors"
4+
import * as authWrapSelectors from "./auth-extensions/wrap-selectors"
45
import * as specSelectors from "./spec-extensions/selectors"
56
import components from "./components"
67
import wrapComponents from "./wrap-components"
@@ -17,6 +18,9 @@ export default function() {
1718
wrapSelectors: specWrapSelectors,
1819
selectors: specSelectors
1920
},
21+
auth: {
22+
wrapSelectors: authWrapSelectors
23+
},
2024
oas3: {
2125
actions: oas3Actions,
2226
reducers: oas3Reducers,

src/core/plugins/oas3/spec-extensions/wrap-selectors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const basePath = OAS3NullSelector
5353
export const consumes = OAS3NullSelector
5454
export const produces = OAS3NullSelector
5555
export const schemes = OAS3NullSelector
56+
export const securityDefinitions = OAS3NullSelector
5657

5758
// New selectors
5859

0 commit comments

Comments
 (0)