OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
swagger-ui-5.17.14
/
src
/
core
/
components
/
auth
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:34:05 AM
rwxr-xr-x
📄
api-key-auth.jsx
2.45 KB
08/07/2024 04:34:04 AM
rw-r--r--
📄
auth-item.jsx
1.81 KB
08/07/2024 04:34:04 AM
rw-r--r--
📄
authorization-popup.jsx
1.98 KB
08/07/2024 04:34:04 AM
rw-r--r--
📄
authorize-btn.jsx
964 bytes
08/07/2024 04:34:04 AM
rw-r--r--
📄
authorize-operation-btn.jsx
976 bytes
08/07/2024 04:34:04 AM
rw-r--r--
📄
auths.jsx
3.73 KB
08/07/2024 04:34:04 AM
rw-r--r--
📄
basic-auth.jsx
3.05 KB
08/07/2024 04:34:04 AM
rw-r--r--
📄
error.jsx
482 bytes
08/07/2024 04:34:04 AM
rw-r--r--
📄
oauth2.jsx
10.71 KB
08/07/2024 04:34:04 AM
rw-r--r--
Editing: basic-auth.jsx
Close
import React from "react" import PropTypes from "prop-types" import ImPropTypes from "react-immutable-proptypes" export default class BasicAuth extends React.Component { static propTypes = { authorized: ImPropTypes.map, schema: ImPropTypes.map, getComponent: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired, name: PropTypes.string.isRequired, errSelectors: PropTypes.object.isRequired, } constructor(props, context) { super(props, context) let { schema, name } = this.props let value = this.getValue() let username = value.username this.state = { name: name, schema: schema, value: !username ? {} : { username: username } } } getValue () { let { authorized, name } = this.props return authorized && authorized.getIn([name, "value"]) || {} } onChange =(e) => { let { onChange } = this.props let { value, name } = e.target let newValue = this.state.value newValue[name] = value this.setState({ value: newValue }) onChange(this.state) } render() { let { schema, getComponent, name, errSelectors } = this.props const Input = getComponent("Input") const Row = getComponent("Row") const Col = getComponent("Col") const AuthError = getComponent("authError") const JumpToPath = getComponent("JumpToPath", true) const Markdown = getComponent("Markdown", true) let username = this.getValue().username let errors = errSelectors.allErrors().filter( err => err.get("authId") === name) return ( <div> <h4>Basic authorization<JumpToPath path={[ "securityDefinitions", name ]} /></h4> { username && <h6>Authorized</h6> } <Row> <Markdown source={ schema.get("description") } /> </Row> <Row> <label htmlFor="auth_username">Username:</label> { username ? <code> { username } </code> : <Col> <Input id="auth_username" type="text" required="required" name="username" onChange={ this.onChange } autoFocus /> </Col> } </Row> <Row> <label htmlFor="auth_password">Password:</label> { username ? <code> ****** </code> : <Col> <Input id="auth_password" autoComplete="new-password" name="password" type="password" onChange={ this.onChange } /> </Col> } </Row> { errors.valueSeq().map( (error, key) => { return <AuthError error={ error } key={ key }/> } ) } </div> ) } }