Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import ActiveDirectory from 'activedirectory';
- export default class ActiveDirectoryComponent extends React.Component {
- state = {
- authResponse: undefined
- };
- componentDidMount() {
- var config = {
- url: 'ldap://compandomain.com:389',
- baseDN: 'dc=domainname,dc=com',
- username: 'user',
- password: 'pass'
- };
- var ad = new ActiveDirectory(config);
- var username = 'john.smith@domain.com';
- var password = 'password';
- ad.authenticate(username, password, function (err, auth) {
- if (err) {
- this.setState({ authResponse: { error: JSON.stringify(err) } });
- return;
- }
- if (auth) {
- this.setState({ authResponse: auth });
- } else {
- console.log('Authentication failed!');
- this.setState({ authResponse: { authFailed: true } });
- }
- });
- }
- render() {
- if (!this.state.authResponse) {
- return <div>Authenticating....</div>;
- }
- if (this.state.authResponse.error) {
- return <div>{this.state.authResponse.error}</div>
- }
- if (this.state.authResponse.authFailed) {
- return <div>Authentication Failed</div>
- }
- return <div>.....</div>
- }
- }
- import ActiveDirectoryAuthentication from '../components/ActiveDirectoryAuthentication';
- Uncaught TypeError: unknown stream type "undefined"
- at Logger.addStream (bunyan.js?a10b:620)
- at eval (bunyan.js?a10b:470)
- at Array.forEach (<anonymous>)
- at new Logger (bunyan.js?a10b:469)
- at Function.createLogger (bunyan.js?a10b:1618)
- at Object.eval (activedirectory.js?f995:16)
- at eval (990:1836)
- at Object.<anonymous> (bundle.js:1)
- at e (bundle.js:1)
- at eval (index.js?048a:1)
Add Comment
Please, Sign In to add comment