Skip to content

Commit

Permalink
Merge pull request #51 from synapsestudios/oss134/create-user-endpoint
Browse files Browse the repository at this point in the history
create user endpoint for admin scope
  • Loading branch information
spruce-bruce authored May 9, 2017
2 parents 458e5ab + c23c737 commit 67d325b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions api/src/application/api/api-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,28 @@ module.exports = (userService, mixedValidation, rowNotExists, rowExists) => [
}
}
}
},
{
method: 'POST',
path: '/api/users',
handler: (request, reply) => {
const { email, password } = request.payload;
reply(userService.create(email, password));
},
config: {
auth: {
strategy: 'client_credentials',
scope: 'admin'
},
validate: {
payload: mixedValidation({
email: Joi.string().email().required(),
password: Joi.string(),
}, {
email: rowNotExists('user', 'email', 'Email already in use')
})
}
}
}
];

Expand Down
Binary file modified oidc-provider.paw
Binary file not shown.

0 comments on commit 67d325b

Please sign in to comment.