Skip to content

Commit

Permalink
Disable Swagger2 auth features in OAS3
Browse files Browse the repository at this point in the history
  • Loading branch information
shockey committed Sep 30, 2017
1 parent c6a6643 commit 7e6f740
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/core/plugins/oas3/auth-extensions/wrap-selectors.js
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/core/plugins/oas3/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// import reducers from "./reducers"
// import * as actions from "./actions"
import * as specWrapSelectors from "./spec-extensions/wrap-selectors"
import * as authWrapSelectors from "./auth-extensions/wrap-selectors"
import * as specSelectors from "./spec-extensions/selectors"
import components from "./components"
import wrapComponents from "./wrap-components"
Expand All @@ -17,6 +18,9 @@ export default function() {
wrapSelectors: specWrapSelectors,
selectors: specSelectors
},
auth: {
wrapSelectors: authWrapSelectors
},
oas3: {
actions: oas3Actions,
reducers: oas3Reducers,
Expand Down
1 change: 1 addition & 0 deletions src/core/plugins/oas3/spec-extensions/wrap-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const basePath = OAS3NullSelector
export const consumes = OAS3NullSelector
export const produces = OAS3NullSelector
export const schemes = OAS3NullSelector
export const securityDefinitions = OAS3NullSelector

// New selectors

Expand Down

0 comments on commit 7e6f740

Please sign in to comment.