forked from dushansachinda/rpservice
-
Notifications
You must be signed in to change notification settings - Fork 3
/
add_access_token_plugin.bal
25 lines (20 loc) · 972 Bytes
/
add_access_token_plugin.bal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import ballerinax/gateway;
import ballerina/log;
const PLUGIN_ID_ADD_ACCESS_TOKEN = "AddAccessTokenPlugin";
public isolated class AddAccessTokenPlugin {
*gateway:Plugin;
private final gateway:PluginConfig pluginConfig;
// Define custom error types here.
public isolated function init(gateway:PluginConfig pluginConfig) returns error? {
self.pluginConfig = pluginConfig;
// Validate the config
}
public isolated function processRequest(gateway:RequestPluginContext pluginCtx) returns gateway:PluginStatus {
log:printDebug("Plugin processRequest invoked", plugin = PLUGIN_ID_ADD_ACCESS_TOKEN);
return gateway:PLUGIN_STATUS_CONTINUE;
}
public isolated function processResponse(gateway:ResponsePluginContext pluginCtx) returns gateway:PluginStatus {
log:printDebug("Plugin processResponse invoked", plugin = PLUGIN_ID_ADD_ACCESS_TOKEN);
return gateway:PLUGIN_STATUS_CONTINUE;
}
}