UNPKG

uaa-client

Version:

REST support for UAA in cloud foundry using javascript.

62 lines (43 loc) 1.86 kB
# Overview Simple to use object whose methods are REST wrappers for a UAA in Cloud Foundry. # Login the Get Users Example There must be a UAA instance running in a Cloud Foundry cloud. Then try this: ```javascript // Per your UAA set these vars var uaaUrl = 'my-uaa-url'; var clientId = 'my-client-id'; var secret = 'my-client-secret'; var UaaClient = require('https://github.com/richdost/uaa-client'); var uaa = new UaaClient(uaaUrl); uaa.login(clientId,secret) .then(loginResult=>{ console.log('loginResult:',JSON.stringify(loginResult,null,2)); uaa.getUsers(loginResult.access_token) .then(getUsersResult=>{ console.log('getUsersResult:',JSON.stringify(getUsersResult,null,2)); }) .catch(console.log); }) .catch(console.log); ``` # Methods Look at the integration tests for examples of use. Here briefly for reference: - Constructor UaaClient(uaaUrl) - login(client,secret) - createClient([clientOptions](https://docs.cloudfoundry.org/api/uaa/#create94),token) - getClients(token) // token is access_token from login result - deleteClient(clientId,token) - getUsers(token) - addUser([addUserOptions](https://github.com/cloudfoundry/uaa/blob/master/docs/UAA-APIs.rst#create-a-user-post-users),token) - removeUser(userId,token) - updatePassword(userId,oldPassword,newPassword,token) - refreshToken(refreshToken) // test TODO - decodeAccessToken(accessToken) // test TODO # Testing To run the tests do: ```bash npm run test -- --UAA_URL=<your-uaa-url> --USERNAME=<your-username> --PASSWORD=<your-password> ``` # License Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Forked from [IBM-Bluemix/cf-nodejs-client](https://github.com/IBM-Bluemix/cf-nodejs-client) which was in turn forked from [prosociallearnEU/cf-nodejs-client](https://github.com/prosociallearnEU/cf-nodejs-client).