Simplified Cloudfoundry Identity Service calls for javascript.
Install with npm:
$ npm install cloudfoundry-identity-admin --save
var cloudfoundryIdentityAdmin = require('cloudfoundry-identity-admin');
Checks token for his validity.
Params
endpointUrlCheckToken
{String}: url endpoint.clientId
{String}: client id of corpid service.clientSecret
{String}: client secret of corpid service.token
{String}: token to validate.returns
{Promise}
Example
var cloudfoundryIdentityAdmin = require('cloudfoundry-identity-admin');
cloudfoundryIdentityAdmin.checkToken(
'http://localhost/check_token',
'YOUR_CLIENT_ID',
'YOUR_CLIENT_SECRET',
'TOKEN_TO_VALIDATE'
)
.then((results) => {
//check in results if token valid
})
.catch((error => {
//token not valid
}))
Get userinfo from a usertoken.
Params
endpointUrlUserinfo
{String}: url endpoint.token
{String}: usertoken.returns
{Promise}
Example
var cloudfoundryIdentityAdmin = require('cloudfoundry-identity-admin');
cloudfoundryIdentityAdmin.userinfo(
'http://localhost/userinfo',
'USERTOKEN'
)
.then((results) => {
//check results for userinfo
})
.catch((error => {
//userinfo not found
}))