Hello, I have some questions and hope to get your help.
According to the REST API, I performed the following operations in PostMan:
1. Request the following address to get access token
|
POST https://<nifi-host>:<nifi-port>/nifi-api/access/token
with body:
{
"username": xxx,
"password": xxx
}
|
The request returned a cookie that allowed access to the REST API
`__Secure-Authorization-Bearer=xxxxxxxxxxxxxxxxxxx;__Secure-Request-Token=xxxxxxxx`
2. When I visit the following address with this cookie to obtain basic
information, I can get the expected response result
|
①: GET https://<nifi-host>:<nifi-port>/nifi-api/process-groups/{group_id}
②: GET
https://<nifi-host>:<nifi-port>/nifi-api/process-groups/{group_id}/processors
|
3. But when I use this cookie to access the following address and try to create
a new processor, there is a "403 Forbidden" exception
|
POST
https://<nifi-host>:<nifi-port>/nifi-api/process-groups/{group_id}/processors
with body:
{
"permissions": {
"canRead": true,
"canWrite": true
},
"component": {
"name": "GET_IC_COPPER_RESOURCES_MINING",
"type": "org.apache.nifi.processors.mongodb.GetMongo",
"bundle": {
"group": "org.apache.nifi",
"artifact": "nifi-mongodb-nar",
"version": "1.22.0"
},
"state": "STOPPED",
"relationships": [
{
"name": "failure",
"autoTerminate": true,
"retry": false
},
{
"name": "original",
"autoTerminate": true,
"retry": false
},
{
"name": "success",
,
"autoTerminate": false,
"retry": false
}
],
"supportsParallelProcessing": true,
"supportsEventDriven": false,
"supportsBatching": false,
"supportsSensitiveDynamicProperties": false,
"persistsState": false,
"restricted": false,
"deprecated": false,
"executionNodeRestricted": false,
"multipleVersionsAvailable": false,
"inputRequirement": "INPUT_ALLOWED",
"config": {
"properties": {
"mongo-client-service": null,
"Mongo URI": "mongodb://hostxx:portxx",
"Mongo Database Name": "xxx",
"Mongo Collection Name": "xxxx",
"ssl-context-service": null,
"ssl-client-auth": "REQUIRED",
"json-type": "Standard",
"use-pretty-printing": "true",
"mongo-charset": "UTF-8",
"mongo-date-format": "yyyy-MM-dd HH:mm:ss",
"get-mongo-send-empty": "false"
},
"schedulingPeriod": "5 sec",
"schedulingStrategy": "TIMER_DRIVEN",
"executionNode": "PRIMARY",
"penaltyDuration": "30 sec",
"yieldDuration": "1 sec",
"bulletinLevel": "WARN",
"runDurationMillis": 0,
"concurrentlySchedulableTaskCount": 1,
"lossTolerant": false,
"retryCount": 10,
"retriedRelationships": [
],
"backoffMechanism": "PENALIZE_FLOWFILE",
"maxBackoffPeriod": "10 mins"
},
"validationErrors": [
],
"validationStatus": "VALID",
"extensionMissing": false
},
"inputRequirement": "INPUT_ALLOWED",
"operatePermissions": {
"canRead": true,
"canWrite": true
}
}
|
And the response is:
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<title>Error 403 Forbidden</title>
</head>
<body>
<h2>HTTP ERROR 403 Forbidden</h2>
<table>
<tr>
<th>URI:</th>
<td>/nifi-api/process-groups/80a631d9-d4cf-134b-a6b7-1ef07a3de334/processors</td>
</tr>
<tr>
<th>STATUS:</th>
<td>403</td>
</tr>
<tr>
<th>MESSAGE:</th>
<td>Forbidden</td>
</tr>
<tr>
<th>SERVLET:</th>
<td>jerseySpring</td>
</tr>
</table>
</body>
</html>
|
How to solve the "HTTP ERROR 403 Forbidden" encountered in step 3?