Version: 1.0
Status: ⚫⚫⚫
SecurityAgent plugin for Thunder framework.
This document describes purpose and functionality of the SecurityAgent plugin. It includes detailed specification of its configuration and methods provided.
All identifiers on the interface described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
Security Agent of thunder is responsible to allow or block access to the Thunder API.
The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].
The table below lists configuration options of the plugin.
Name | Type | Description |
---|---|---|
callsign | string | Plugin instance name (default: SecurityAgent) |
classname | string | Class name: SecurityAgent |
locator | string | Library name: libWPEFrameworkSecurityAgent.so |
autostart | boolean | Determines if the plugin is to be started automatically along with the framework |
The following methods are provided by the SecurityAgent plugin:
SecurityAgent interface methods:
Method | Description |
---|---|
createtoken | Creates Token |
validate | Validates Token |
Creates Token.
Create a signed JsonWeb token from provided payload.
Name | Type | Description |
---|---|---|
params | object | |
params?.url | string | (optional) Url of application origin |
params?.user | string | (optional) Username |
params?.hash | string | (optional) Random hash |
Name | Type | Description |
---|---|---|
result | object | |
result.token | string | Signed JsonWeb token |
Code | Message | Description |
---|---|---|
1 | ERROR_GENERAL |
Token creation failed |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "SecurityAgent.1.createtoken",
"params": {
"url": "https://test.comcast.com",
"user": "Test",
"hash": "1CLYex47SY"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICAgImpzb25ycGMiOiAiMi4wIiwgCiAgICAiaWQiOiAxMjM0NTY3ODkwLCAKICAgICJtZXRob2QiOiAiQ29udHJvbGxlci4xLmFjdGl2YXRlIiwgCiAgICAicGFyYW1zIjogewogICAgICAgICJjYWxsc2lnbiI6ICJTZWN1cml0eUFnZW50IgogICAgfQp9.lL40nTwRyBvMwiglZhl5_rB8ycY1uhAJRFx9pGATMRQ"
}
}
Validates Token.
Checks whether the token is valid and properly signed.
Name | Type | Description |
---|---|---|
params | object | |
params.token | string | Token that will be validated |
Name | Type | Description |
---|---|---|
result | object | |
result.valid | boolean | Tells whether token is signature is correct |
Code | Message | Description |
---|
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "SecurityAgent.1.validate",
"params": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICAgImpzb25ycGMiOiAiMi4wIiwgCiAgICAiaWQiOiAxMjM0NTY3ODkwLCAKICAgICJtZXRob2QiOiAiQ29udHJvbGxlci4xLmFjdGl2YXRlIiwgCiAgICAicGFyYW1zIjogewogICAgICAgICJjYWxsc2lnbiI6ICJTZWN1cml0eUFnZW50IgogICAgfQp9.lL40nTwRyBvMwiglZhl5_rB8ycY1uhAJRFx9pGATMRQ"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"valid": false
}
}