Skip to content

Commit

Permalink
v3.0.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmantz committed Jan 19, 2017
1 parent 9aa1585 commit 6b3d3b2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 60 deletions.
2 changes: 1 addition & 1 deletion dist/redux-oidc.js

Large diffs are not rendered by default.

53 changes: 23 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-oidc",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"description": "A package for managing OpenID Connect authentication in redux apps",
"main": "dist/redux-oidc.js",
"scripts": {
Expand All @@ -26,41 +26,34 @@
"author": "Maximilian Mantz",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.4.5",
"babel-eslint": "^4.1.8",
"babel-loader": "^6.2.1",
"babel-plugin-rewire": "^1.0.0-rc-2",
"babel-core": "^6.21.0",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-plugin-rewire": "^1.0.0",
"babel-plugin-uglify": "^1.0.2",
"babel-polyfill": "^6.7.4",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"babel-register": "^6.7.2",
"babel-require": "^1.0.1",
"babel-template": "^6.7.0",
"babel-types": "^6.7.2",
"browserify": "^13.0.0",
"babel-polyfill": "^6.20.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"babel-register": "^6.18.0",
"babel-template": "^6.16.0",
"babel-types": "^6.21.0",
"browserify": "^13.3.0",
"chai": "^3.5.0",
"chai-enzyme": "^0.4.2",
"cheerio": "^0.20.0",
"cheerio": "^0.22.0",
"co-mocha": "^1.1.3",
"enzyme": "^2.2.0",
"enzyme": "^2.7.0",
"es6-promise": "^4.0.5",
"expect": "^1.12.2",
"expect-jsx": "^2.1.2",
"file-loader": "^0.8.4",
"fs": "0.0.2",
"istanbul-instrumenter-loader": "^0.2.0",
"jsdom": "^8.3.0",
"expect": "^1.20.2",
"file-loader": "^0.9.0",
"jsdom": "^9.9.1",
"json-loader": "^0.5.4",
"mocha": "^2.4.5",
"mocha-webpack": "^0.3.1",
"mocha": "^3.2.0",
"mocha-webpack": "^0.7.0",
"node-storage-shim": "^1.0.1",
"react-addons-test-utils": "^15.1.0",
"react-shallow-testutils": "^2.0.0",
"sinon": "^1.17.3",
"webpack": "^1.12.14",
"webpack-node-externals": "^1.2.0"
"sinon": "^1.17.7",
"webpack": "^2.2.0",
"webpack-node-externals": "^1.5.4"
},
"peerDependencies": {
"co": ">=4.6.0",
Expand Down
20 changes: 6 additions & 14 deletions src/CallbackComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import { redirectSuccess } from './actions';

class CallbackComponent extends React.Component {
static propTypes = {
// the content to render
children: PropTypes.element.isRequired,

// the userManager
userManager: PropTypes.object.isRequired,

// a function invoked when the callback succeeds
successCallback: PropTypes.func.isRequired,

// a function invoked when the callback fails
errorCallback: PropTypes.func,

// the route this component is registered in (react-router or similar library)
route: PropTypes.string
errorCallback: PropTypes.func
};

componentDidMount() {
this.props.userManager.signinRedirectCallback(this.props.route)
this.props.userManager.signinRedirectCallback()
.then((user) => this.onRedirectSuccess(user))
.catch((error) => this.onRedirectError(error));
}
Expand All @@ -34,16 +34,8 @@ class CallbackComponent extends React.Component {
}
};

get defaultContent() {
return <div>Redirecting...</div>;
}

render() {
return (
<div>
{this.props.children || this.defaultContent}
</div>
);
return React.Children.only(this.props.children);
}
}

Expand Down
12 changes: 0 additions & 12 deletions tests/callbackComponent.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import './setup';
import ReactTestUtils from 'react-addons-test-utils';
import expect from 'expect';
import React from 'react';
import CallbackComponent from '../src/CallbackComponent';
Expand Down Expand Up @@ -70,15 +69,4 @@ describe('<CallbackComponent />', () => {

expect(() => component.onRedirectError(error)).toThrow(/error/);
});

it('should call the signinSilentCallback with a route when it has been provided', () => {
const route = '/some/route';
props = { ...props, route };
component = new CallbackComponent(props);
component.props = Object.assign({}, { ...component.props }, { ...propsMock });

component.componentDidMount();

expect(signinRedirectCallbackStub.calledWith(route)).toEqual(true);
});
});
1 change: 0 additions & 1 deletion tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import jsdom from 'jsdom';
import StorageShim from 'node-storage-shim';


const DEFAULT_HTML = '<html><body></body></html>';

global.document = jsdom.jsdom(DEFAULT_HTML);
Expand Down
2 changes: 1 addition & 1 deletion webpack.config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
loaders: [
{
test: /\.js$/,
loader: 'babel?plugins=rewire',
loader: 'babel-loader?plugins=rewire',
exclude: /node_modules/
}
]
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
loaders: [
{
test: /\.js$/,
loader: 'babel',
loader: 'babel-loader',
exclude: /node_modules/
}
]
Expand Down

0 comments on commit 6b3d3b2

Please sign in to comment.