Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit path to authorization/index.js to fix imports within Jest environments #160

Merged
merged 2 commits into from
Oct 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions lib/actions/authorization.js

This file was deleted.

89 changes: 68 additions & 21 deletions lib/actions/authorization/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,68 @@
module.exports.checkClient = require('./check_client');
module.exports.checkResponseMode = require('./check_response_mode');
module.exports.throwNotSupported = require('./throw_not_supported');
module.exports.oauthRequired = require('./oauth_required');
module.exports.checkOpenidPresent = require('./check_openid_present');
module.exports.noRedirectUriClients = require('./no_redirect_uri_clients');
module.exports.fetchRequestUri = require('./fetch_request_uri');
module.exports.decodeRequest = require('./decode_request');
module.exports.oidcRequired = require('./oidc_required');
module.exports.checkPrompt = require('./check_prompt');
module.exports.checkScope = require('./check_scope');
module.exports.checkResponseType = require('./check_response_type');
module.exports.checkRedirectUri = require('./check_redirect_uri');
module.exports.assignDefaults = require('./assign_defaults');
module.exports.checkClaims = require('./check_claims');
module.exports.loadAccount = require('./load_account');
module.exports.interactions = require('./interactions');
module.exports.respond = require('./respond');
module.exports.checkPixy = require('./check_pixy');
module.exports.processResponseTypes = require('./process_response_types');
module.exports.authorizationEmit = require('./authorization_emit');
const checkClient = require('./check_client');
const checkResponseMode = require('./check_response_mode');
const throwNotSupported = require('./throw_not_supported');
const oauthRequired = require('./oauth_required');
const checkOpenidPresent = require('./check_openid_present');
const noRedirectUriClients = require('./no_redirect_uri_clients');
const fetchRequestUri = require('./fetch_request_uri');
const decodeRequest = require('./decode_request');
const oidcRequired = require('./oidc_required');
const checkPrompt = require('./check_prompt');
const checkScope = require('./check_scope');
const checkResponseType = require('./check_response_type');
const checkRedirectUri = require('./check_redirect_uri');
const assignDefaults = require('./assign_defaults');
const checkClaims = require('./check_claims');
const loadAccount = require('./load_account');
const interactions = require('./interactions');
const respond = require('./respond');
const checkPixy = require('./check_pixy');
const processResponseTypes = require('./process_response_types');
const authorizationEmit = require('./authorization_emit');

const compose = require('koa-compose');

const bodyParser = require('../../shared/conditional_body');
const rejectDupes = require('../../shared/check_dupes');
const paramsMiddleware = require('../../shared/get_params');

const instance = require('../../helpers/weak_cache');

const { PARAM_LIST } = require('../../consts');

const parseBody = bodyParser('application/x-www-form-urlencoded');

module.exports = function authorizationAction(provider) {
const whitelist = new Set(PARAM_LIST);
const extras = instance(provider).configuration('extraParams');
extras.forEach(whitelist.add.bind(whitelist));

const getParams = paramsMiddleware(whitelist);

return compose([
parseBody,
getParams,
checkClient(provider),
rejectDupes,
checkResponseMode(provider),
throwNotSupported(provider),
oauthRequired,
checkOpenidPresent,
noRedirectUriClients,
fetchRequestUri(provider),
decodeRequest(provider, whitelist),
oidcRequired,
checkPrompt(provider),
checkResponseType(provider),
checkScope(provider),
checkRedirectUri,
checkPixy(provider),
assignDefaults,
authorizationEmit(provider),
checkClaims(provider),
loadAccount(provider),
interactions(provider),
respond(provider),
processResponseTypes(provider),
]);
};
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/helpers/initialize_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = function initializeApp() {

configuration.grantTypes.forEach((grantType) => {
try {
const grant = require(`../actions/token/${grantType}`); // eslint-disable-line global-require, import/no-dynamic-require
const grant = require(`../actions/grants/${grantType}`); // eslint-disable-line global-require, import/no-dynamic-require
this.registerGrantType(grantType, grant.handler, grant.parameters);
} catch (err) {
/* istanbul ignore if */
Expand Down