Permalink
Browse files

Some cleanup.

Signed-off-by: François de Metz <fdemetz@af83.com>
  • Loading branch information...
1 parent 903b6e7 commit d638206425da02583a492522a28f7d72ff2dd3d2 François de Metz committed Apr 11, 2011
Showing with 21 additions and 23 deletions.
  1. +21 −23 lib/server.js
View
@@ -38,25 +38,25 @@ function server_error(res, err) {
var SERVER = exports;
// To be set by connect middleware: SERVER.RFactory, SERVER.authentication
+/* Render a particular error.
+ *
+ * Arguments:
+ * - res
+ * - type: the class of the error ('eua' or 'oat').
+ * - id: the id of the error (invalid_request, invalid_client...).
+ */
SERVER.oauth_error = function(res, type, id) {
- /* Render a particular error.
- *
- * Arguments:
- * - res
- * - type: the class of the error ('eua' or 'oat').
- * - id: the id of the error (invalid_request, invalid_client...).
- */
res.writeHead(400, {'Content-Type': 'text/plain'});
res.end(JSON.stringify({error: {
type: 'OAuthException',
message: id + ': ' + oauth2.ERRORS[type][id],
}}));
};
-
+/**
+ * To call when an unknown error happens (server error).
+ */
var unknown_error = exports.unknown_error = function(res, err) {
- /* To call when an unknown error happens (server error).
- */
server_error(res, err);
};
@@ -96,7 +96,6 @@ PARAMS.eua.all = PARAMS.eua.mandatory.concat(PARAMS.eua.optional);
*
*/
exports.send_grant = function(res, Grant, user_id, client_data, additional_info) {
- console.log(client_data);
var grant = new Grant({
client_id: client_data.client_id,
time: Date.now(),
@@ -221,19 +220,18 @@ var token_endpoint = exports.token_endpoint = function(req, res) {
});
};
-
+/* OAuth2 Authorize function.
+ * Serve an authentication form to the end user at browser.
+ *
+ * This function should only be called by oauth2.authorize
+ *
+ * Arguments:
+ * - params:
+ * - req
+ * - res
+ *
+ */
SERVER.authorize = function(params, req, res) {
- /* OAuth2 Authorize function.
- * Serve an authentication form to the end user at browser.
- *
- * This function should only be called by oauth2.authorize
- *
- * Arguments:
- * - params:
- * - req
- * - res
- *
- */
// We check there is no invalid_requet error:
var error = false;
PARAMS.eua.mandatory.forEach(function(param) {

0 comments on commit d638206

Please sign in to comment.