import React, { PropTypes } from "react" import ImPropTypes from "react-immutable-proptypes" export default class Auths extends React.Component { static propTypes = { definitions: PropTypes.object.isRequired, getComponent: PropTypes.func.isRequired, authSelectors: PropTypes.object.isRequired, authActions: PropTypes.object.isRequired, specSelectors: PropTypes.object.isRequired } constructor(props, context) { super(props, context) this.state = {} } onAuthChange =(auth) => { let { name } = auth this.setState({ [name]: auth }) } submitAuth =(e) => { e.preventDefault() let { authActions } = this.props authActions.authorize(this.state) } logoutClick =(e) => { e.preventDefault() let { authActions, definitions } = this.props let auths = definitions.map( (val, key) => { return key }).toArray() authActions.logout(auths) } render() { let { definitions, getComponent, authSelectors, errSelectors } = this.props const ApiKeyAuth = getComponent("apiKeyAuth") const BasicAuth = getComponent("basicAuth") const Oauth2 = getComponent("oauth2", true) const Button = getComponent("Button") let authorized = authSelectors.authorized() let authorizedAuth = definitions.filter( (definition, key) => { return !!authorized.get(key) }) let nonOauthDefinitions = definitions.filter( schema => schema.get("type") !== "oauth2") let oauthDefinitions = definitions.filter( schema => schema.get("type") === "oauth2") return (
Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.
API requires the following scopes. Select which ones you want to grant to Swagger UI.