@@ -2,11 +2,6 @@ import React from "react"
22import PropTypes from "prop-types"
33import oauth2Authorize from "core/oauth2-authorize"
44
5- const IMPLICIT = "implicit"
6- const ACCESS_CODE = "accessCode"
7- const PASSWORD = "password"
8- const APPLICATION = "application"
9-
105export default class Oauth2 extends React . Component {
116 static propTypes = {
127 name : PropTypes . string ,
@@ -16,6 +11,7 @@ export default class Oauth2 extends React.Component {
1611 authSelectors : PropTypes . object . isRequired ,
1712 authActions : PropTypes . object . isRequired ,
1813 errSelectors : PropTypes . object . isRequired ,
14+ specSelectors : PropTypes . object . isRequired ,
1915 errActions : PropTypes . object . isRequired ,
2016 getConfigs : PropTypes . any
2117 }
@@ -83,7 +79,9 @@ export default class Oauth2 extends React.Component {
8379 }
8480
8581 render ( ) {
86- let { schema, getComponent, authSelectors, errSelectors, name } = this . props
82+ let {
83+ schema, getComponent, authSelectors, errSelectors, name, specSelectors
84+ } = this . props
8785 const Input = getComponent ( "Input" )
8886 const Row = getComponent ( "Row" )
8987 const Col = getComponent ( "Col" )
@@ -92,6 +90,14 @@ export default class Oauth2 extends React.Component {
9290 const JumpToPath = getComponent ( "JumpToPath" , true )
9391 const Markdown = getComponent ( "Markdown" )
9492
93+ const { isOAS3 } = specSelectors
94+
95+ // Auth type consts
96+ const IMPLICIT = "implicit"
97+ const PASSWORD = "password"
98+ const ACCESS_CODE = isOAS3 ( ) ? "authorizationCode" : "accessCode"
99+ const APPLICATION = isOAS3 ( ) ? "clientCredentials" : "application"
100+
95101 let flow = schema . get ( "flow" )
96102 let scopes = schema . get ( "allowedScopes" ) || schema . get ( "scopes" )
97103 let authorizedAuth = authSelectors . authorized ( ) . get ( name )
@@ -102,7 +108,7 @@ export default class Oauth2 extends React.Component {
102108
103109 return (
104110 < div >
105- < h4 > OAuth2.0 < JumpToPath path = { [ "securityDefinitions" , name ] } /> </ h4 >
111+ < h4 > { name } ( OAuth2, { schema . get ( "flow" ) } ) < JumpToPath path = { [ "securityDefinitions" , name ] } /> </ h4 >
106112 { ! this . state . appName ? null : < h5 > Application: { this . state . appName } </ h5 > }
107113 { description && < Markdown source = { schema . get ( "description" ) } /> }
108114
0 commit comments