Ghost/core/server/middleware/client-auth.js
Sebastian Gierlinger f22796ff7d Add dynamic client_id/client_secret
no issue
- added ghost-admin client_id to admin
- added ghost-admin client_secret to admin
- added client.read() api endpoint
- added random generation of client_secret to migration
- removed addClientSecret method
- updated tests
2015-09-02 16:39:34 +01:00

26 lines
776 B
JavaScript

var passport = require('passport'),
oauthServer,
clientAuth;
function cacheOauthServer(server) {
oauthServer = server;
}
clientAuth = {
// ### Authenticate Client Middleware
// authenticate client that is asking for an access token
authenticateClient: function authenticateClient(req, res, next) {
return passport.authenticate(['oauth2-client-password'], {session: false})(req, res, next);
},
// ### Generate access token Middleware
// register the oauth2orize middleware for password and refresh token grants
generateAccessToken: function generateAccessToken(req, res, next) {
return oauthServer.token()(req, res, next);
}
};
module.exports = clientAuth;
module.exports.cacheOauthServer = cacheOauthServer;