@byu-oit/ts-wso2-claims-request v2.0.0
ts-wso2-claims-request
Installation
npm i @byu-oit/ts-wso2-claims-request
Introduction
This module is an extension of the Claims Adjudicator Client. It adds a few helper functions that are specific to users who commonly use the BYU WSO2 Request package.
Example
const {AdjudicatorClient: CEC} = require('@byu-oit/ts-claims-engine-client')
const client = new CEC();
client.subject('John')
.mode('all')
.claim(CEC.claim()
.concept('subject-exists')
.relationship('eq')
.value('true')
.qualify('age', 43))
// Must set the wso2 settings before attempting to verify a claim!
CEC.setOauthSettings(clientKey, clientSecret)
.then(() => client.verify())
.then(response => console.log(JSON.stringify(response, null, 2)))
.catch(console.error)
API
Some of the parameters and return types are complex objects. Instead of listing them in the method definitions, they have been listed in the Appendix under API Reference.
AdjudicatorWSO2RequestClient
Creates a new instance of the AdjudicatorWSO2RequestClient, which is an extension of the Claims Adjudicator Client.
AdjudicatorWSO2RequestClient(config: AdjudicatorWSO2RequestClientParams, assertionParams?: AssertionClientParams)
Static Methods
AdjudicatorWSO2RequestClient.setOauthSettings
: Exposes the BYU WSO2 Request setOauthSettings function.
AdjudicatorWSO2RequestClient.request
: Exposes the BYU WSO2 Request request function.
Public Methods
info
: Calls the "getConcepts" endpoint of the claims engine at the URL specified in the class configuration.
AdjudicatorWSO2RequestClient.info(): Promise<any>
verify
: Calls the "verifyClaim" endpoint of the claims engine at the URL specified in the class configuration. The request body is given the current assertion stored in the class if no assertions are passed in. In the case that assertions are passed in, they are placed in the request body.
AdjudicatorWSO2RequestClient.verify(assertions?: any): Promise<any>
Appendix
API Reference
interface AdjudicatorWSO2RequestClientParams {
url: string
request?: RequestPromiseOptions
}