Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Simplified Cloud Foundry Identity Service calls for javascript.

License

Notifications You must be signed in to change notification settings

swisscom/cloudfoundry-identity-admin

Repository files navigation

cloudfoundry-identity-admin

NPM version Build Status semantic-release JavaScript Style Guide License: MIT

Simplified Cloudfoundry Identity Service calls for javascript.

Install

Install with npm:

$ npm install cloudfoundry-identity-admin --save

Usage

var cloudfoundryIdentityAdmin = require('cloudfoundry-identity-admin');

API

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
    }))

forthebadge forthebadge forthebadge forthebadge