import React, {PureComponent} from 'react' import { Alert, InputGroup, Navbar, Nav, NavItem, NavDropdown, MenuItem, Glyphicon, Jumbotron, Button} from 'react-bootstrap' import {Panel, Row, Col, Collapse, FormControl, FormGroup, ControlLabel, HelpBlock} from 'react-bootstrap' import FontAwesome from 'react-fontawesome' import WhiteBox from './WhiteBox' const fontStyling = { fontWeight: 'bold', fontFamily: 'colfaxBold,Helvetica,Arial,sans-serif' } class Component extends PureComponent { constructor(props) { super(props) // console.log("--- props", this.props) // With these Location object properties you can access all of these URL components // // hash - Sets or returns the anchor portion of a URL. // host - Sets or returns the hostname and port of a URL. // hostname - Sets or returns the hostname of a URL. // href - Sets or returns the entire URL. // pathname - Sets or returns the path name of a URL. // port - Sets or returns the port number the server uses for a URL. // protocol - Sets or returns the protocol of a URL. // search - Sets or returns the query portion of a URL var currentURL = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '' ) + '/callback' // console.log("currentURL", currentURL) this.state = { overrideToggle: null, client_id: "6233aedf-f08a-4112-9a1b-f33c3cd9b396", // clientSecret: "", redirectURL: currentURL, // scopes: "", // response_type: "token" } } authenticateStart() { let config = Object.assign({}, this.props.serverConfig, this.state) console.error("Authenticaiton start with config", config) this.props.authenticateStart(config) } logoutStart() { this.props.logoutStart() } updateFieldHandler(field) { return (e) => { const upd = { [field]: e.target.value } this.props.updateConfig(upd) // this.setState(upd) } } actTogglePanel = (e) => { e.preventDefault() e.stopPropagation() if (this.state.overrideToggle === null) { this.setState({overrideToggle: !(this.props.expanded)}) } else { this.setState({overrideToggle: !(this.state.overrideToggle === true)}) } } render() { // console.log("X This props", this.props) // console.log("X This state", this.state) let authorizationEndpoint = '' if (this.props.serverConfig) { authorizationEndpoint = this.props.serverConfig.authorization_endpoint } let tokenEndpoint = '' if (this.props.serverConfig) { tokenEndpoint = this.props.serverConfig.token_endpoint } let userinfoEndpoint = '' if (this.props.serverConfig) { userinfoEndpoint = this.props.serverConfig.userinfo_endpoint } let clientId = '' if (this.props.serverConfig && typeof this.props.serverConfig.client_id !== 'undefined') { clientId = this.props.serverConfig.client_id this.state.client_id = this.props.serverConfig.client_id console.error("Setting clientid to serverconfig", clientId) } else if (this.state && this.state.client_id) { clientId = this.state.client_id } let clientSecret = '' let scopes = '' if (this.props.serverConfig) { scopes = this.props.serverConfig.scopes } let expanded = (this.state.overrideToggle === true) || this.props.expanded return ( Configuration

Server configuration

OAuth Authorization endpoint

OAuth Token endpoint

Userinfo Endpoint

Client configuration

Client ID

{/*

Client secret

*/}

Scopes

Response Type

Redirect URI

When you configure your client, please register the following redirect uri:

{this.state.redirectURL}

 
) } } export default Component