I’m attempting to create a new basic auth user using the undocumented dashboard api (please add docs!)
However, even though the user has access to an API via a policy, I’m not able to access that API. Can you please let me know what I’m doing wrong. All calls below:
$ curl -X POST http://192.168.99.100:3000/api/apis/keys/basic/[email protected] -H 'Authorization: eafe2167d76547777ec75a1f7dc5312a' -d '{"last_check":0,"allowance":1000,"rate":1000,"per":1,"expires":0,"quota_max":-1,"quota_renews":1491497420,"quota_remaining":0,"quota_renewal_rate":31104000,"access_rights":{"151222f37e7447f56df39b0f94b8dc14":{"api_id":"151222f37e7447f56df39b0f94b8dc14","api_name":"Login API","versions":["Default"]},"feda9795301d4f4e5f6992ae3a638dcd":{"api_id":"feda9795301d4f4e5f6992ae3a638dcd","api_name":"Portal","versions":["Default"]}},"apply_policy_id":"57058d630b79010001000009","tags":["newuser"],"jwt_data":{"secret":""},"meta_data":{},"basic_auth_data":{"password":"test123","hash_type":"bcrypt"}}'
{"api_model":{},"key_id":"","data":{"last_check":0,"allowance":1000,"rate":1000,"per":1,"expires":0,"quota_max":-1,"quota_renews":1491497420,"quota_remaining":0,"quota_renewal_rate":31104000,"access_rights":{"151222f37e7447f56df39b0f94b8dc14":{"api_name":"Login API","api_id":"151222f37e7447f56df39b0f94b8dc14","versions":["Default"],"allowed_urls":null},"feda9795301d4f4e5f6992ae3a638dcd":{"api_name":"Portal","api_id":"feda9795301d4f4e5f6992ae3a638dcd","versions":["Default"],"allowed_urls":null}},"org_id":"570534390b79010001000001","oauth_client_id":"","basic_auth_data":{"password":"test123","hash_type":"bcrypt"},"jwt_data":{"secret":""},"hmac_enabled":false,"hmac_string":"","is_inactive":false,"apply_policy_id":"57058d630b79010001000009","data_expires":0,"monitor":{"trigger_limits":null},"meta_data":{},"tags":["newuser"]}}
$ echo '[email protected]:test123' | base64
dGVzdEB0ZXN0LmNvbTp0ZXN0MTIzCg==
$ curl http://192.168.99.100/login-api/login -H 'Authorization: Basic dGVzdEB0ZXN0LmNvbTp0ZXN0MTIzCg=='
{
"error": "User not authorised"
}
$ curl -s -X GET http://192.168.99.100:3000/api/apis/ -H 'Authorization: eafe2167d76547777ec75a1f7dc5312a' | python -mjson.tool | grep -E 'api_id|"listen_path"'
"api_id": "1f7701e7f1c640017b8fd0d66fbac8a7",
"listen_path": "/portal-assets/",
"api_id": "04401112703f49af4d9bd4c2172e8eb9",
"listen_path": "/portal-api/",
"api_id": "feda9795301d4f4e5f6992ae3a638dcd",
"listen_path": "/portal/",
"api_id": "151222f37e7447f56df39b0f94b8dc14",
"listen_path": "/login-api/",
$ curl -s -X GET http://192.168.99.100:3000/api/portal/policies -H 'Authorization: eafe2167d76547777ec75a1f7dc5312a' | python -mjson.tool
{
"Data": [
{
"_id": "57058d630b79010001000009",
"access_rights": {
"151222f37e7447f56df39b0f94b8dc14": {
"allowed_urls": [],
"apiid": "151222f37e7447f56df39b0f94b8dc14",
"apiname": "Login API",
"versions": [
"Default"
]
}
},
"active": true,
"date_created": "0001-01-01T00:00:00Z",
"hmac_enabled": false,
"is_inactive": false,
"key_expires_in": 0,
"name": "Default API Policy",
"org_id": "570534390b79010001000001",
"per": 60,
"quota_max": -1,
"quota_renewal_rate": 60,
"rate": 1000,
"tags": []
}
],
"Pages": 0
}