Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
59
app/services.js
Normal file
59
app/services.js
Normal file
@@ -0,0 +1,59 @@
|
||||
var uuid = require('node-uuid'),
|
||||
authCodes = {},
|
||||
accessTokens = {},
|
||||
clients = {
|
||||
'F8Nbz9gGUvLgdn8T': {
|
||||
id: '1',
|
||||
secret: 'Fesmx7hHCCMx7Cby7FhV2fAtf2NYEFzP5fCKuwEEdpf8hpnsnnQn9qYhNHt6SsDD',
|
||||
grantTypes: ['implicit', 'password', 'client_credentials', 'authorization_code']
|
||||
},
|
||||
'rtGWJ8gbAWCr3bD6': {
|
||||
id: '2',
|
||||
secret: 'WnGh3nSNUQQsQt9Pug6dwmmUcBMwREYtw8ssJP6cLBeH7zESqb8KBa8uXpR4hjST',
|
||||
grantTypes: ['implicit', 'password', 'client_credentials', 'authorization_code']
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
authCodes,
|
||||
getAccessTokens: function() {
|
||||
return accessTokens;
|
||||
},
|
||||
clientService: {
|
||||
getById: function (id, callback) {
|
||||
return callback(null, clients[id]);
|
||||
},
|
||||
isValidRedirectUri: function (/*client, requestedUri*/) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
tokenService: {
|
||||
generateToken: function (callback) {
|
||||
callback(null, uuid.v4());
|
||||
},
|
||||
generateAuthorizationCode: function (callback) {
|
||||
callback(null, uuid.v4());
|
||||
}
|
||||
},
|
||||
authorizationService: {
|
||||
saveAuthorizationCode: function (codeData, callback) {
|
||||
authCodes[codeData.clientId] = codeData;
|
||||
return callback(null, authCodes[codeData.clientId]);
|
||||
},
|
||||
saveAccessToken: function (tokenData, callback) {
|
||||
accessTokens[tokenData.access_token] = tokenData;
|
||||
return callback(null, accessTokens[tokenData.access_token]);
|
||||
},
|
||||
getAuthorizationCode: function (code, callback) {
|
||||
return callback(null, authCodes[code]);
|
||||
},
|
||||
getAccessToken: function (token, callback) {
|
||||
return callback(null, accessTokens[token]);
|
||||
}
|
||||
},
|
||||
membershipService: {
|
||||
areUserCredentialsValid: function (userName, password, scope, callback) {
|
||||
return callback(null, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user