Usage
Typescript Import Format
//To import this class, use the format below.
import {OAuth} from "ojs/ojmodel";
For additional information visit:
Final classes in JET
Classes in JET are generally final and do not support subclassing. At the moment, final is not enforced. However, this will likely change in an upcoming JET release.
Constructor
new OAuth(attributes, header)
Parameters:
Name | Type | Description |
---|---|---|
attributes |
Object | Initial set of attribute/value pairs with which to seed this OAuth object |
header |
string | Actual name for the Authorization header (default 'Authorization') |
Methods
-
cleanAccessTokenRequest : {undefined}
-
Clean request part of the OAuth object (client credentials, uri endpoint) Null and remove all data from request part of the OAuth object
Returns:
- Type
- undefined
-
cleanAccessTokenResponse : {undefined}
-
Clean response part of the OAuth object (access_token, e.t.c.) Null and remove all data from response part of the OAuth object
Returns:
- Type
- undefined
-
clientCredentialGrant : {undefined}
-
Request for access_token(bearer token) using Client Credential Authorization Grant. Initialize response part of the OAuth object (access_token, e.t.c.)
Returns:
- Type
- undefined
-
getAccessTokenRequest : {Object}
-
Get request part of the OAuth object (client credentials, uri endpoint)
Returns:
cached request
- Type
- Object
-
getAccessTokenResponse : {Object}
-
Get response part of the OAuth object (access_token, e.t.c.)
Returns:
cached response
- Type
- Object
-
getHeader : {Object}
-
Calculates Authorization header based on client credentials or access_token
Returns:
OAuth 2.0 Authorization header
- Type
- Object
-
isInitialized : {boolean}
-
Check is OAuth initialized (not null access_token).
Returns:
true/false
- Type
- boolean
-
setAccessTokenRequest(data) : {undefined}
-
Set request part of the OAuth object (client credentials, uri endpoint)
Parameters:
Name Type Description data
Object current client credentials and uri Returns:
- Type
- undefined
-
setAccessTokenResponse(data) : {undefined}
-
Set response part of the OAuth object (access_token, e.t.c.)
Parameters:
Name Type Description data
Object current response Returns:
- Type
- undefined